feat(tui): keyboard selection, path/preview toggles for session browser - #407
Open
alecuba16 wants to merge 1 commit into
Open
feat(tui): keyboard selection, path/preview toggles for session browser#407alecuba16 wants to merge 1 commit into
alecuba16 wants to merge 1 commit into
Conversation
Add keyboard selection and display toggles to the session browser overlay. Key changes: - KeyContext::SessionBrowser variant with configurable bindings (defaults: arrows/j/k navigate, Enter resume, r rename, a toggle paths, p toggle preview, Esc close). All keys route through keybindings.rs, not inline. - SessionEntry gains working_dir field; render shows it under each row. - render_session_browser rewritten with fixed layout: windowed list (list_window helper keeps selection centered), optional preview panel, always-visible hint bar showing keybindings. - show_paths/show_preview state with toggle methods; 'a' shows the working-directory path of each listed session (does not reveal sessions from other projects), 'p' shows a preview panel of the selected session. - Fix Kuberwastaken#382: session browser opened empty because session loading lived in dead App::run code. Moved into run_interactive via session_list_tx channel. - session_resume_pending drives resume from the browser (same swap logic as /resume command: load messages, reset file history and turn bookkeeping, update working_dir). Tests: 7 new (5 session_browser unit tests + 2 TUI keybinding routing tests). CRLF preserved on session_browser.rs, keybindings.rs, commands.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Split A of #387. Adds keyboard selection and display toggles to the session browser overlay.
Changes
Keyboard routing through keybindings.rs
KeyContext::SessionBrowservariant with configurable default bindings:↑/↓orj/knavigate (prevSession/nextSession)PgDn/PgUppage navigation (nextSessionPage/prevSessionPage)Enterresume session (resumeSession)rrename session (renameSession)atoggle paths (toggleSessionPaths)ptoggle preview (toggleSessionPreview)Escclose (closeSessionBrowser)crates/core/src/keybindings.rs— no inline hardcoded key checks.Session browser rendering
SessionEntrygains aworking_dirfield, shown under each row when paths are toggled on.render_session_browserrewritten with a fixed layout:list_windowhelper keeps the selection centered in the visible window. No more scrolling past the viewport.p.Toggles
show_paths(toggle witha): shows the working-directory path of each listed session. Does not reveal sessions from other projects — only the sessions already listed.show_preview(toggle withp): shows a preview panel of the selected session.Fix #382
The session browser opened empty because the session-loading code lived in dead
App::runcode that was never called. The load now happens inrun_interactivevia asession_list_tx/session_list_rxchannel: when the browser opens, an asynclist_sessionstask spawns and drains entries into the browser.Session resume from browser
session_resume_pendingdrives resume from the browser, using the same swap logic as the/resumecommand: load messages, reset file history and turn bookkeeping, update working_dir.Tests
list_windowwindowing, render with paths+preview, render long list walks selection.settings_screen::tests::all_entries_returns_expected_settings(expects ≤20 settings, gets 21) is unrelated — it fails onmainand this PR does not touch settings.CRLF preservation
session_browser.rs,keybindings.rs, anddocs/commands.mdare CRLF files. All additions use\r\n. No LF churn on untouched lines.