Skip to content

feat(columns): make the focused column the first column - #1925

Merged
l0gicgate merged 14 commits into
lgse:stack/2070from
Bluesboy:feat/1922-make-focused-column-first
Nov 7, 2026
Merged

l0gicgate merged 14 commits into
lgse:stack/2070from
Bluesboy:feat/1922-make-focused-column-first

Conversation

@Bluesboy

@Bluesboy Bluesboy commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds a make_first_column command for Columns view. Alt+Down in the default map makes the focused column the first one: the columns to its left close, the columns to its right stay open, and focus and the cursor stay on the same item.

  • It is a regular history step: NavigationState::go_to_column(depth) records the current path the way go_parent does and returns the path from depth on, so Back/Alt+Left restores the whole strip.
  • Browser::make_first_column restores that path through the same code as Back/Forward/Parent. The shared part of restore_path moved into restore_path_focused, which takes the column to focus and its preferred cursor; restore_path keeps its behavior (last column, came-from child).
  • Does nothing in the first column, in Icons and List, and in file choosers. It lives in the default_only block: 10xer keeps its parent, current and preview strip.
  • Listed in Settings → Keyboard and in the Columns section of the shortcut reference, with strings in all 13 message catalogs, and described in docs/keyboard-navigation.md.

Two deliberate differences from the proposal in #1922:

  • It always applies to the focused column, not to "the selected folder when the cursor is on a folder". With Mirror columns selection on (the default), the cursor is almost always on a folder, so that rule would promote the next column instead of the one being worked in.
  • Shift+Enter and Ctrl+Enter are already Open in new window / Open in new tab, so the default key is Alt+Down, the counterpart of Alt+Up (parent folder). It is remappable through feat(keys): make keyboard shortcuts remappable per map #1885. No context-menu entry yet; happy to add one if wanted.

Tests: app::navigation::tests::go_to_column_keeps_the_path_from_that_column_and_records_it and app::browser::tests::navigation::making_a_column_first_keeps_later_columns_focus_and_cursor (strip, focus, cursor, no-op in the first column, Back).

Visual evidence

2026-10-28_22-55 2026-10-28_22-56 image

How to test

  1. In Columns view, open folders three or four levels deep and focus a column in the middle.
  2. Press Alt+Down.
  3. Press Alt+Left.
  4. Focus the first column and press Alt+Down.

Expected result: after step 2 the focused column is the first one, the columns to its right are still open, and the cursor is on the same item. Step 3 restores the full strip. Step 4 changes nothing.

Related issue

Closes #1922

Add a `make_first_column` command (Alt+Down in the default map) that, in
Columns view, drops the columns before the focused one and keeps the
columns after it. Focus and the cursor stay on the same item, and the
change is a history step, so Back restores the whole strip. It does
nothing in the first column, in Icons and List, and in 10xer mode, which
keeps its own parent, current and preview strip.

The command is listed in Settings > Keyboard and in the Columns section
of the shortcut reference.

Closes lgse#1922
@wmfeht

wmfeht commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator

Review

Blocking: Hungarian catalog is missing the new string

This branch is based on 73b3258f (#1885), which predates the Hungarian locale (#1918). The new key "Make the focused pane the first pane" is added to 12 catalogs but not to data/locales/messages/hu.json.

The branch merges into main without conflicts, but in the merged tree src/i18n/catalog_tests.rs lists 13 locales including "hu", and catalogs_cover_all_languages_and_preserve_interpolation requires every catalog to have the same keys as en.json. That test will fail on hu.

Fix: merge main and add a Hungarian translation. The description's "strings in all 12 message catalogs" should then say 13.

Minor

  • Catalog key order. The new key is inserted between "Close the current pane or go to the parent folder" and "Close the current window" in every catalog. The catalogs are otherwise mostly alphabetical, so moving it among the M… keys would match the rest of the file. This is cosmetic only; the coverage test doesn't check alphabetical order.
  • Multi-selection in the focused column is dropped. restore_path_focused goes through NavigationState::restore, which clears every column's selection. Only the cursor is kept, through prefer_location_on_load. This matches Back/Forward and what the description promises, but someone who selects several items and then presses Alt+Down may not expect to lose the selection.
  • BrowserView::make_focused_column_first returns true even when nothing happens. It returns true as soon as depth > 0, even if Browser::make_first_column then does nothing (for example, go_to_column returns None for a depth past the last column, or allows_navigation rejects the path). Alt+Down is then consumed silently. This should be rare, since the depth comes from focused_column_depth() or active_depth().

Checked, no issues

  • Back after the operation restores the full strip, and came_from_child returns None there, so the old Back cursor behaviour is kept.
  • The restore_path refactor doesn't change Back/Forward/Parent. The new early return on an empty path can't be reached from history or external-change paths.
  • Placing the cursor on load in column 0 doesn't trigger Mirror columns selection, so the columns to the right aren't truncated.
  • Key routing: Shift+Alt+Down is still handled by EXTEND_DOWN. When the command does nothing, Alt+Down falls through with no effect. default_only keeps it out of the 10xer map.

I reviewed this by reading the code and test-merging against main; I didn't build it or run any tests.

@Bluesboy

Copy link
Copy Markdown
Contributor Author

Thanks for the review and for pushing the fixes (Hungarian string, key order, consuming Alt+Down only when the strip is re-rooted, keeping the selection). I updated the description to say 13 catalogs.

…sed-column-first

# Conflicts:
#	src/app/browser.rs
#	src/app/navigation.rs
#	src/app/navigation/tests.rs
#	src/ui/browser.rs
#	src/ui/shortcut_reference.rs
#	src/ui/window/keyboard/items.rs
@Bluesboy

Bluesboy commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged the latest main into the branch (9fff835) and resolved the conflicts from the #2022 module split. No behavior change, the PR's changes just moved to where the code lives now:

  • make_first_column and the restore_path / restore_path_focused split moved to app/browser/columns.rs, go_to_column to app/navigation/history.rs.
  • make_focused_column_first moved to ui/browser/view_navigation.rs.
  • The key check is now makes_focused_column_first() in items.rs, next to opens_focused_in_new(), with the same focus guards as before.
  • The shortcut reference row is in COLUMNS_NAVIGATION.

One fix on top: the go_to_column test still called state.go_back(), which #1977 replaced with go_back_to(steps), so the previous merge (724284f) did not compile the tests. It now uses go_back_to(1).

The navigation, browser, keyboard and shortcut tests pass locally.

Columns re-roots the strip at the focused column and Back restores it; List leaves the strip alone.
… a column first

The cursor now starts on the second of two selected items, so dropping the reorder that hands the cursor back to its own item fails the test.
… covers

app::browser::tests::navigation::making_a_column_first_keeps_later_columns_focus_and_cursor checks the kept path, the first-column and past-the-end no-ops, and Back to the whole strip.
Both columns reload after the re-root; the cursor lands in column 0 once it lists, which can finish after column 1.
@wmfeht
wmfeht changed the base branch from main to stack/2070 November 6, 2026 04:42
@wmfeht

wmfeht commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Review and cleanup

Stacked on #2070. This PR's base is now stack/2070, a mirror of #2070's head in lgse/strata, so the diff shows only this PR's changes. Merge it after #2070.

CI has not run yet. The CI workflow for 933f1fc9 (run 42164053850) is waiting for maintainer approval of the fork run and has started no jobs. Metadata policy and Type label pass.

Merged stack/2070 at 71aee3f1. No conflicts. The stack's additions next to this PR's code (type_grouping in NavigationState::restore, Browser::follow_selection_on_return) leave go_to_column and the restore_path / restore_path_focused split unchanged.

Review against the description and #1922.

  • Alt+Down makes the focused column the first one, keeps the columns to its right, and keeps focus, the cursor and a multi-selection in place. Confirmed in Browser::make_first_column; covered by app::browser::tests::navigation::making_a_column_first_keeps_later_columns_focus_and_cursor.
  • It is a history step, and Back restores the whole strip. Confirmed (NavigationState::go_to_column records the navigation). Covered by the test above and by the new key-routing test.
  • It does nothing in the first column. Confirmed and covered. It does nothing in Icons, List, 10xer and file choosers. Confirmed in code; List is now covered by the routing test.
  • Settings → Keyboard, the shortcut reference and docs/keyboard-navigation.md are updated. The new key is in all 13 catalogs.
  • The points from the earlier review (Hungarian string, key order, Alt+Down consumed only when the strip is re-rooted, keeping the multi-selection) are all addressed in the current code.

Fixes pushed

  • 6c0504a9 test(columns): route Alt+Down through the keyboard dispatcher. Nothing tested the key path in items.rs / view_navigation.rs. New ui::window::tests::keyboard_dispatch::first_column::alt_down_makes_the_focused_column_first_only_in_columns: Alt+Down in Columns re-roots the strip, Alt+Left restores it, and Alt+Down in List leaves it alone. It fails if the dispatcher call or the view_mode() guard is removed.
  • b415b21c test(columns): put the cursor off the first selected item when making a column first. The cursor was already on the first selected item, so deleting the reorder in make_first_column still passed. The cursor now starts on /a/b/d.
  • 1799adf1 docs(columns): note that Alt+Down keeps a multi-selection and does nothing in choosers.
  • 731d7dca style(browser): drop the duplicated cfg(test) on select_first_on_load.
  • 933f1fc9 test(columns): wait for the new first column's cursor after Alt+Down. Both columns reload after the re-root, and the test checked column 0's cursor after waiting only for column 1.

Tests removed

  • app::navigation::tests::history::go_to_column_keeps_the_path_from_that_column_and_records_it: every assertion it made is repeated by the browser-level test. Coverage owner: app::browser::tests::navigation::making_a_column_first_keeps_later_columns_focus_and_cursor.

Validation

  • cargo check --all-targets --all-features: clean after the merge.
  • After the merge: ./scripts/test-headless.py app::navigation:: (103 passed), app::browser:: (400 passed), i18n:: (12 passed), shortcut_reference (1 passed), keyboard_dispatch (176 passed), settings::keyboard (13 passed), browser_modes:: (16 passed).
  • On the final code: ./scripts/test-headless.py app::browser::tests::navigation (33 passed), app::navigation::tests::history (4 passed), keyboard_dispatch::first_column (1 passed, 3 runs).
  • ./scripts/quality.sh fmt, ./scripts/quality.sh clippy: clean.
  • Not run: ./scripts/qa.sh. No QA scenario covers Alt+Down.

Follow-ups outside this PR

  • feat(columns): make the focused column the first column #1922 also asks for an entry in the folder/column context menu, and there isn't one yet. The body says Closes #1922, so merging would close the issue with that part missing. Either add the entry or change the body to reference the issue without closing it.
  • The file-chooser guard (self.chooser.is_none() in Dispatcher::makes_focused_column_first) has no test.
  • The description's "Tests:" line still names the deleted go_to_column test and doesn't mention first_column::alt_down_makes_the_focused_column_first_only_in_columns.

wmfeht added a commit to FelipeJz/strata that referenced this pull request Nov 6, 2026
Resolve conflicts with the stacked PRs (lgse#2070, lgse#1925, lgse#1924, lgse#1826,
lgse#1802) and re-home the bookmark changes in the files they split:

- keys/conflicts.rs: keep the split step_digits/fixed_top_level_key and
  give the bookmark groups no digit range;
- keys/label.rs: keep both the two-key Digits `then` and the Letters
  range;
- keys/tests.rs: take the split modules and move the Letters cases of
  catalog_bindings_use_the_canonical_key and
  every_listed_binding_has_its_own_row_in_its_maps into tests/catalog.rs;
- shortcut_footer.rs: take the split modules and move the chord panel
  refill (show while rows exist, so the ' menu appears once the saved
  letters load) into shortcut_footer/indicators.rs;
- tenxer_mode.rs: add the bookmark marks and options next to
  FolderAction;
- window/keyboard.rs: take the split key routing, keep the pending
  bookmark cancel before the tab-shortcut check, and move the focus and
  mode-exit cancels into keyboard/footer_bindings.rs;
- keymap.md: list the bookmark chords alongside `; .`;
- keyboard_dispatch.rs: declare both letter_bookmarks and list_motion.
@wmfeht

wmfeht commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Merged the #2070 update (6da9d77) in through the stack at 9d7ad6f. No fixes were needed. CI green.

@l0gicgate
l0gicgate merged commit a3b2f70 into lgse:stack/2070 Nov 7, 2026
18 of 20 checks passed
@Bluesboy
Bluesboy deleted the feat/1922-make-focused-column-first branch November 9, 2026 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(columns): make the focused column the first column

3 participants