Skip to content

feat: add collection_browser.open_on_highlight option - #400

Open
CJstate wants to merge 1 commit into
darrenburns:mainfrom
CJstate:feat/open-on-highlight
Open

CJstate wants to merge 1 commit into
darrenburns:mainfrom
CJstate:feat/open-on-highlight

Conversation

@CJstate

@CJstate CJstate commented Oct 12, 2026 •

Copy link
Copy Markdown

Summary

Adds a collection_browser.open_on_highlight setting (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

  • Opening goes through CollectionTree.currently_open's existing reactive path, so all Enter-open behavior (loading the model, focus-on-open, resave tracking) applies identically.
  • The open is deferred with call_after_refresh and re-checked against the cursor node: the tree's initial highlight fires during mount, before the editor panes exist, and opening synchronously there aborts MainScreen.compose (NoMatches on the not-yet-mounted panes).
  • New tests cover both the default-off behavior (highlight does not open) and the enabled behavior (open on highlight, follow on step, reopen on step back).

Configuration

collection_browser:
  open_on_highlight: true

Environment variable: POSTING_COLLECTION_BROWSER__OPEN_ON_HIGHLIGHT.

Closes #394

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
@CJstate
CJstate force-pushed the feat/open-on-highlight branch from 0c64a53 to daf8cbb Compare October 25, 2026 04:12
@CJstate

CJstate commented Oct 25, 2026

Copy link
Copy Markdown
Author

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).

@CJstate

CJstate commented Oct 26, 2026

Copy link
Copy Markdown
Author

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 chiragjangiir left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. 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.
  2. Double Check on Active Cursor: _open_if_still_highlighted checks self.collection_tree.cursor_node is node, ensuring rapid arrow key presses don't trigger unnecessary re-renders of intermediate nodes.
  3. Configuration & Documentation: Documented in docs/guide/configuration.md with both YAML setting (collection_browser.open_on_highlight) and environment variable override (POSTING_COLLECTION_BROWSER__OPEN_ON_HIGHLIGHT), with default false preserving existing behavior.
  4. Unit Tests: Full pilot test suite verifying both default behavior (highlight without open) and enabled behavior (opening on j/k transitions).

Looks solid and ready to merge!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Option to open a request when it is highlighted in the collection browser

2 participants