Skip to content

image-wlx 0.1.1: DC's viewer hotkeys work with the image focused - #37

Merged
NikolaiSachok merged 2 commits into
mainfrom
fix/image-wlx-viewer-hotkeys
Oct 26, 2026
Merged

NikolaiSachok merged 2 commits into
mainfrom
fix/image-wlx-viewer-hotkeys

Conversation

@NikolaiSachok

Copy link
Copy Markdown
Owner

With the image focused in the F3 viewer, Double Commander's viewer hotkeys did nothing: N / P and Alt+→ / Alt+← (next / previous file), Q, the view-mode digits. File → Next in the menu still worked. LCL handles these keys through NSApplication's -sendEvent: dispatch, and the image canvas consumed every key press itself.

Fix

  • The canvas keeps only the zoom keys and the scroll keys. Every other key is handed to DC the way Esc already was: focus moves to DC's view and the key is re-posted.
  • The image then takes focus back, unless DC moved it to a control of its own, closed the viewer or opened a dialog. So the arrows pan the next image straight away.
  • Scroll keys are handled by key code rather than -interpretKeyEvents:. A DefaultKeyBinding.dict that maps Home / End to line start / end used to leave them dead.
  • End and Cmd+↓ scrolled to the top: a huge scroll delta overflowed inside NSClipView. They now scroll by the real distance.
  • Shift+Space pages up.
  • 0.1.1: version bump and CHANGELOG entry.
  • AGENTS.md: the Esc rule now covers every key a plugin does not use.

Tests

  • New test/keys_verify.m, also wired into CI. It covers:
    • N, P, Alt+arrows, Q and a digit reach DC exactly once, and N / P lead to ListLoadNext;
    • the image has focus again afterwards;
    • Tab to DC's file panel and a dialog taking the key window both keep focus away from the image;
    • the arrows, Home / End, Cmd+↑ / Cmd+↓ and = stay with the image and land where they should.
  • It fails 26 checks on 0.1.0. All five image-wlx harnesses pass.
  • Verified in real Double Commander: the hotkeys work with the image focused.
  • An independent review found four low-severity issues, all fixed in the second commit.

Follow-up for the web-view plugins: #36.

With the image focused, N / P and Alt+Right / Alt+Left did nothing (File >
Next still worked): the canvas swallowed every key it did not use, and LCL
handles its viewer hotkeys through NSApplication's -sendEvent: dispatch. The
canvas now keeps only the zoom keys and the unmodified scroll keys and hands
every other key to DC the way Esc already was, then takes focus back once DC
has handled it, so the arrows pan the next image.

test/keys_verify.m covers N, P, Alt+arrows, Q and a view-mode digit, and that
the arrows and zoom keys stay with the image; it fails 16 checks on 0.1.0.
Bump to 0.1.1.
Review findings on the hotkey hand-off, plus what the extended harness found:

- Cmd+Up / Cmd+Down scroll to top / bottom again (the hand-off had sent
  them to DC, which has no binding for them); Shift+arrows now go to DC
  instead of being swallowed; Shift+Space pages up.
- End and Cmd+Down landed at the top: the huge scroll delta overflowed in
  NSClipView's constraint arithmetic. Scroll by the real distance instead.
- Scroll keys are handled by key code, not -interpretKeyEvents:, so a
  DefaultKeyBinding.dict that maps Home / End to line start / end no longer
  leaves them dead.
- keys_verify: each key reaches DC exactly once; Tab to DC's file panel and
  a dialog taking the key window both keep focus away from the image;
  Home / End / Cmd+Up / Cmd+Down land on the right edge.
- Comment and charter no longer claim strict ordering between the re-posted
  key and the focus reclaim (a nested run loop in DC runs it during).
@NikolaiSachok
NikolaiSachok merged commit 95b535d into main Oct 26, 2026
2 checks passed
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