Repository navigation
Conversation
Rebased onto Posting 3.0.0-beta.1 (main was force-pushed for the 3.0 release, so the original branch had unrelated histories and is re-created here on the new main). Closes darrenburns#394
0c64a53 to
daf8cbb
Compare
|
Rebased onto Posting 3.0.0-beta.1 - upstream main was force-pushed for the 3.0 release (unrelated histories), so the branch is re-created on the new main. Same feature as before: the collection_browser.open_on_highlight setting, tests ported and passing (2/2 locally). |
|
Bump — green, no conflicts. The setting defaults to off, so nothing changes for existing setups, and it reuses the same open path as Enter rather than adding a second one. Happy to drop it if you think this belongs on a keybinding instead of a config option. |
chiragjangiir
left a comment
There was a problem hiding this comment.
Technical Review of PR #400: feat: add collection_browser.open_on_highlight option
This is a very practical UX improvement for keyboard-driven navigation in Posting. Allowing j/k to step through collection items while keeping focus on the tree makes inspecting and rapid-testing collections much faster.
Highlights:
- Mount Timing Safety: Using
self.call_after_refresh(self._open_if_still_highlighted, event.node)is a smart design choice. It prevents race conditions during tree initialization when the editor panes or child widgets have not yet completed mounting. - Double Check on Active Cursor:
_open_if_still_highlightedchecksself.collection_tree.cursor_node is node, ensuring rapid arrow key presses don't trigger unnecessary re-renders of intermediate nodes. - Configuration & Documentation: Documented in
docs/guide/configuration.mdwith both YAML setting (collection_browser.open_on_highlight) and environment variable override (POSTING_COLLECTION_BROWSER__OPEN_ON_HIGHLIGHT), with defaultfalsepreserving existing behavior. - Unit Tests: Full pilot test suite verifying both default behavior (highlight without open) and enabled behavior (opening on
j/ktransitions).
Looks solid and ready to merge!
Summary
Adds a
collection_browser.open_on_highlightsetting (default off, so existing behavior is unchanged).When enabled, highlighting a request in the collection browser opens it in the editor �� the same path as pressing Enter �� while the tree keeps focus. That lets you step through requests with
j/k(or arrow keys) and have the editor always show what the cursor is on, then send with the usual send binding, without switching focus back and forth.Highlighting a folder does nothing; re-highlighting the already-open request does not re-open it.
Implementation notes
CollectionTree.currently_open's existing reactive path, so all Enter-open behavior (loading the model, focus-on-open, resave tracking) applies identically.call_after_refreshand re-checked against the cursor node: the tree's initial highlight fires during mount, before the editor panes exist, and opening synchronously there abortsMainScreen.compose(NoMatcheson the not-yet-mounted panes).Configuration
Environment variable:
POSTING_COLLECTION_BROWSER__OPEN_ON_HIGHLIGHT.Closes #394