Skip to content

Set a shortcut mode from where the focus is, so two panels of one mode don't undo each other - #335

Merged
LogicalError merged 1 commit into
mainfrom
tachyonui/command-mode-per-focus
Nov 22, 2026
Merged

LogicalError merged 1 commit into
mainfrom
tachyonui/command-mode-per-focus

Conversation

@LogicalError

Copy link
Copy Markdown
Owner

A NodeView or VirtualTable with a commandMode set the app's one command mode while it was built:

  • its own mode while it had the focus
  • Default when it didn't, and the mode was its own

Two of them with one mode, such as two NodeView or two Hierarchy panels, undid each other whenever both were built in the same frame. That happens after any edit in either panel, since onChanged rebuilds the other.

What was wrong

  • The focused one built first: the unfocused one then reset the mode to Default, so F, Delete and Ctrl+G stopped working in the focused panel.
  • The focused one built second: the mode flipped twice a frame, which cancelled any chord in progress.

What changes

  • ClaimCommandMode(owner, mode): a control records its mode as it's built, and doesn't set anything itself.
  • One decision a frame: before input is handled, the mode is set from the claim the focus is in.
  • Back to Default once the focus is in no claim, unless the app has set a mode of its own since.
  • Pruning: claims no longer built drop out once the focus isn't in them, such as a closed panel's.
  • NodeView and VirtualTable claim their modes instead of setting them. An app's own control can do the same.
  • Docs: the tables guide covers two tables of one mode and ClaimCommandMode, and the changelog has an entry.

Tests

  • New: two node views of one mode. With the focus in the left one, built first, the mode is theirs. It still is with the focus moved to the right one, built second. Before the fix, the first check failed with the mode at Default.

Validation

  • Full Debug build: no errors or warnings.
  • gui_core_tests, gui_vulkan_tests, gui_gpu_tests, gui_d3d12_tests and gui_sdlgpu_tests all pass on Windows.
  • A showcase --bench run reports no errors.

…e don't undo each other

A NodeView or VirtualTable set the app's one command mode while it was
built: its own when it had the focus, else Default when the mode was its
own. Two of them with one mode (two NodeView or two Hierarchy panels)
undid each other when both were built in one frame, as after an edit in
either: the focused one's shortcuts (F, Delete, Ctrl+G) stopped working,
or the mode flipped twice a frame and cancelled a chord.

- ClaimCommandMode(owner, mode): a control records its mode as it's
  built. The mode is set once a frame, before input is handled, from the
  claim the focus is within; Default once it's in none, unless the app
  set a mode of its own since. Claims no longer built drop out once the
  focus isn't in them.
- NodeView and VirtualTable claim their modes instead of setting them.
- Docs: two tables of one mode, and ClaimCommandMode, in the tables
  guide.
- Tests: two node views of one mode keep the focused one's mode, whichever
  is built first.
@LogicalError
LogicalError merged commit ac9906c into main Nov 22, 2026
8 checks passed
@LogicalError
LogicalError deleted the tachyonui/command-mode-per-focus branch November 22, 2026 14:11
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.

1 participant