feat(ui): add session history navigation, permission keys, and review shortcuts
mod+alt+arrows step through this window's session-open history (or between neighbouring tabs when session tabs are on), mod+k r renames the current session inline, and mod+k a toggles permission auto-accept. Pending permission cards respond to alt+enter / alt+shift+enter / alt+backspace with the keys printed on the buttons. The commit message box commits on mod+enter, alt+arrows step the diff review between changed files, and the command palette gains search-only commands for rare actions so the initial list stays short.
This commit is contained in:
@@ -26,6 +26,28 @@ export const activateSessionTabByIndex = (index: number): boolean => {
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Activate the tab one step right (+1) or left (-1) of the current session
|
||||
* in the rendered strip order, wrapping around the ends. Returns false when
|
||||
* the current session has no tab or there is nothing to move to.
|
||||
*/
|
||||
export const activateAdjacentSessionTab = (delta: -1 | 1): boolean => {
|
||||
const { tabIds } = useSessionTabsStore.getState();
|
||||
const { currentSessionId, setCurrentSession } = useSessionUIStore.getState();
|
||||
const sessionsById = new Map(
|
||||
useGlobalSessionsStore.getState().activeSessions.map((session) => [session.id, session] as const),
|
||||
);
|
||||
const renderable = tabIds.filter((id) => sessionsById.has(id));
|
||||
if (!currentSessionId || renderable.length < 2) return false;
|
||||
const index = renderable.indexOf(currentSessionId);
|
||||
if (index === -1) return false;
|
||||
const nextId = renderable[(index + delta + renderable.length) % renderable.length];
|
||||
const next = sessionsById.get(nextId);
|
||||
if (!next) return false;
|
||||
setCurrentSession(next.id, resolveGlobalSessionDirectory(next));
|
||||
return true;
|
||||
};
|
||||
|
||||
export const closeSessionTabAndActivateNeighbour = (sessionId: string): void => {
|
||||
const { tabIds, closeTab } = useSessionTabsStore.getState();
|
||||
if (!tabIds.includes(sessionId)) return;
|
||||
|
||||
Reference in New Issue
Block a user