Skip to content

fix: keep keyboard file commands on the item the user chose - #2025

Closed
wmfeht wants to merge 8 commits into
lgse:mainfrom
wmfeht:fix/1993-release-candidate-p1-fixes
Closed

wmfeht wants to merge 8 commits into
lgse:mainfrom
wmfeht:fix/1993-release-candidate-p1-fixes

Conversation

@wmfeht

@wmfeht wmfeht commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Description

Fixes five P1 bugs from the 1.2.0 release-candidate QA sweep. In four of them a keyboard command could act on the wrong file; in the fifth, the 10xer folder picker searched outside home.

docs/keyboard-navigation.md now covers the rename, range-anchor and Back/Left behaviour. No user-facing strings changed.

Not verified locally:

  • scripts/code-health.sh did not run, because CS_ACCESS_TOKEN was not set. The new functions were kept within the AGENTS.md code-health limits by hand.
  • new-folder-with-selection-groups/columns fails intermittently on this machine, at line 34 (the clicked folder's column does not take focus). It fails as often on main (ede64d92), so it is not caused by this branch.

Visual evidence

N/A. These are keyboard-routing, focus and selection fixes with nothing new to see; the behaviour is described above and in the steps below.

How to test

  1. fix(columns): after Back, F2 and Delete act on the root column's folder instead of the focused row #1993: in Columns, open alpha/sub/inner and select a file. Click a sidebar place, press Alt+Left, then Left twice. Press F2, then Escape, then Delete.
  2. fix(filter): renaming a filter result moves focus to a neighbour, so the next Delete trashes the wrong file #1994: make a folder with a.csv, b.csv, c.json and d.txt, and turn Group by file type off. Press Ctrl+F, type ., and select c.json. Press F2, type 0.md, press Enter, then press Delete. Repeat in Icons and Columns, and with 10xer's r prompt.
  3. fix(selection): Home and End do not move the range anchor, so Shift ranges select the wrong files #1995: open a folder with 200 files. Press Down a few times, then End, then Shift+Home. Next, press Home, then Shift+Down. Then press Home, Down, and Shift+Page Down. Do this in List, Icons and Columns.
  4. fix(preview): Delete and Ctrl+D act on the previewed file while focus is in a rendered document, PDF or table preview #1996: select a .md, .pdf, .docx or .csv file. Press Space, then Right to move focus into the preview. Press Delete, Ctrl+D and F2.
  5. fix(10xer): the folder picker reads ~//x as /x, so go, copy to and move to act outside home #1997: turn 10xer on, outside home. Press g and type ~//x. Separately, select a file, press C and type ~//zzqa, where no zzqa* folder exists in home.

Expected result:

  1. F2 and Delete act on sub, not alpha.
  2. 0.md stays focused and selected, Delete trashes 0.md, and every Columns row shows its own name.
  3. Shift+Home after End selects all 200 files. Shift+Down after Home selects the first two. Shift+Page Down extends from the second file.
  4. Nothing happens to the file, and the folder's file count does not change.
  5. The searches stay below home: go shows only matches under home, and copy to finds no folders, so nothing is copied.

Related issue

Closes #1993
Closes #1994
Closes #1995
Closes #1996
Closes #1997

wmfeht and others added 8 commits November 1, 2026 23:49
Back restores every column with no cursor. Pressing Left into an
ancestor column then left its cursor empty, and F2, Delete, copy, cut
and duplicate fell back to the folder the *parent* column has open, so
they renamed or trashed the root column's folder instead of the focused
row.

- Left gives a parent column without a cursor the folder it has open, as
  descending into that folder would have left it. A parent still loading
  takes it once listed, through its own load target with no fallback, so
  a folder gone or hidden meanwhile leaves no cursor rather than one on
  an unrelated entry. Any cursor placed meanwhile, reveal or failed load
  cancels it; relocation rebases it and a kept listing clears it. The
  lgse#1437 preferred entry and its fallback are unchanged.
- The "folder you entered" fallback for rename, delete and copy/cut
  applies only when the active column is the deepest one.
- focus_parent, focus_child, select and the cursor moves share one
  place_committed_cursor helper (formerly focus_only).

Fixes lgse#1993
Renaming a Ctrl+F filter result left focus and selection on whichever
result took over its row, so the next Delete trashed a neighbour.

When a rename completes, the stale-result prune finds the old path gone
before the search index lists the new one, drops the result, and the
results fall back to the result now in its slot (List, Icons) or to no
selection (Columns). In Columns, rename labels were also looked up
through the directory listing instead of the result rows, so the
optimistic and restored names landed on the wrong row.

Results now record a rename when it starts, from the inline editor
(Enter or Tab) or the 10xer rename prompt. The prune keeps the renamed
result in place under its new path while the view would show it, and
the first update that lists the new path carries the selection, anchor
and focus over to it; Columns also moves its cursor there. A rename to a
path in another folder is recorded as a move: the result is dropped, not
kept as a phantom, and no remaining result takes its selection, as the
listing does. Failed and abandoned renames forget only their own record,
so a newer rename's record survives. Columns rename labels resolve
through the results, the directory reveal leaves result rows alone, and
the Columns listing-focus fallback over results reuses
focus_results_on_cursor, so focus returns to a refused result after its
error dialog.

Fixes lgse#1994
…rrows

Plain Home, End, Page Up and Page Down move the cursor, selection and
anchor in the model, but in List and Icons GTK's own Shift range origin
stayed at the last arrow position, so a following native Shift+Home,
Shift+End or Shift+arrow extended from there. Move that origin to the
model's anchor after these moves, as restores and Ctrl+click already do.

Columns passed Shift+Home and Shift+End to its GTK list, whose origin its
model-driven arrows never set, so they selected only the edge item.
Extend to the first or last item from the model's anchor there, as its
Shift+arrows and Shift+page keys do.

In List and Icons, plain arrows and their h j k l letters moved GTK's
cursor while the model kept its old anchor, so Shift+Page Up/Down and
Shift+click extended from an earlier item. The dispatcher now runs GTK's
arrow binding for both and anchors the model at the cursor when the move
replaced the selection, not when GTK keeps a range at an edge. It also
cancels a pending click-to-rename, which the browser's own key handler no
longer sees once the dispatcher stops the key; an unmoved letter is still
stopped so it is never typed.

Fixes lgse#1995
With keyboard focus inside a rendered document, PDF, table or archive
preview, Delete moved the previewed file to Trash, Shift+Delete asked to
delete it permanently, Ctrl+D duplicated it, F2/Ctrl+R started renaming
it and Ctrl+Alt+N moved it into a new folder. The guards only exempted
text widgets (lgse#670), so any other preview widget let the default-map
file commands act on the selection behind it.

Check whether focus is anywhere inside the preview drawer, whatever
widget it renders, for these commands, as the clipboard keys already
did. The 10xer map is unchanged: its preview keys hand focus back to the
listing before a file command runs.

Fixes lgse#1996
… cost

Answer the window dispatcher's preview-focus check with PreviewDrawer::owns_focus. The slot, overlay, revealer and resize grip that the old check also accepted are never focusable, so the result is unchanged. Describe what the check tests rather than overclaiming, and leave the new scenario's cost out until it is measured.

Refs lgse#1996
The folder picker stripped "~/" and joined the remainder onto home, so a
remainder starting with "/" (as in "~//x") replaced home with the
filesystem root. Go, copy to and move to then searched and acted outside
home. Trim leading slashes from the remainder so repeated slashes after
"~" collapse as in POSIX paths.

Fixes lgse#1997
Also name the jump-key test helper after what it does, so it no longer shares a name with the video-clip helper.

Refs lgse#1993
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment