feat: enhance terminal navigation and session management

- Implemented spatial navigation between terminal panes using directional shortcuts (Ctrl+Alt+Arrow keys).
- Improved session handling by ensuring stale sessions are automatically removed when the server indicates they are invalid.
- Added customizable keyboard shortcuts for terminal actions and enhanced search functionality with dedicated highlighting colors.
- Updated terminal themes to include search highlighting colors for better visibility during searches.
- Refactored terminal layout saving logic to prevent incomplete state saves during project restoration.
This commit is contained in:
SuperComboGamer
2025-12-21 15:33:43 -05:00
parent f504a00ce6
commit 7ddd9f8be1
6 changed files with 536 additions and 64 deletions

View File

@@ -2239,6 +2239,9 @@ export const useAppStore = create<AppState & AppActions>()(
...current,
activeTabId: tabId,
activeSessionId: newActiveSessionId,
// Clear maximized state when switching tabs - the maximized terminal
// belongs to the previous tab and shouldn't persist across tab switches
maximizedSessionId: null,
},
});
},
@@ -2636,6 +2639,36 @@ export const useAppStore = create<AppState & AppActions>()(
{
name: "automaker-storage",
version: 2, // Increment when making breaking changes to persisted state
// Custom merge function to properly restore terminal settings on every load
// The default shallow merge doesn't work because we persist terminalSettings
// separately from terminalState (to avoid persisting session data like tabs)
merge: (persistedState, currentState) => {
const persisted = persistedState as Partial<AppState> & { terminalSettings?: PersistedTerminalSettings };
const current = currentState as AppState & AppActions;
// Start with default shallow merge
const merged = { ...current, ...persisted } as AppState & AppActions;
// Restore terminal settings into terminalState
// terminalSettings is persisted separately from terminalState to avoid
// persisting session data (tabs, activeSessionId, etc.)
if (persisted.terminalSettings) {
merged.terminalState = {
// Start with current (initial) terminalState for session fields
...current.terminalState,
// Override with persisted settings
defaultFontSize: persisted.terminalSettings.defaultFontSize ?? current.terminalState.defaultFontSize,
defaultRunScript: persisted.terminalSettings.defaultRunScript ?? current.terminalState.defaultRunScript,
screenReaderMode: persisted.terminalSettings.screenReaderMode ?? current.terminalState.screenReaderMode,
fontFamily: persisted.terminalSettings.fontFamily ?? current.terminalState.fontFamily,
scrollbackLines: persisted.terminalSettings.scrollbackLines ?? current.terminalState.scrollbackLines,
lineHeight: persisted.terminalSettings.lineHeight ?? current.terminalState.lineHeight,
maxSessions: persisted.terminalSettings.maxSessions ?? current.terminalState.maxSessions,
};
}
return merged;
},
migrate: (persistedState: unknown, version: number) => {
const state = persistedState as Partial<AppState>;