feat(chart): keyboard navigation for chart panning#96
Open
terrylica wants to merge 1 commit intoflowsurface-rs:mainfrom
Open
feat(chart): keyboard navigation for chart panning#96terrylica wants to merge 1 commit intoflowsurface-rs:mainfrom
terrylica wants to merge 1 commit intoflowsurface-rs:mainfrom
Conversation
Adds keyboard-driven chart panning so users can navigate history
without touching the mouse or trackpad.
Key bindings:
←/→ scroll 10 bars left/right
Shift+←/→ scroll 50 bars (fast)
PageUp/Down scroll one full visible window
Home jump to latest bar (reset pan)
macOS equivalents: Fn+↑ = PageUp, Fn+↓ = PageDown, Fn+← = Home
Navigation works whenever the app window is focused; the cursor does
not need to be inside the chart canvas.
Implementation
--------------
All pan logic lives in a new src/chart/keyboard_nav.rs module.
keyboard_nav_msg() is added as a default method on the Chart trait
(using the already-required state() accessor), so every current and
future chart type automatically gets keyboard navigation with no
per-type boilerplate.
Minimal changes to existing files:
- src/chart.rs mod declaration + default trait method +
delegate _ => arm in canvas_interaction;
cursor_position? guard moved inside Shift arm
(ruler tool needs it, nav keys do not)
- src/screen/dashboard.rs ChartKeyNav message + handler
- src/screen/dashboard/pane.rs apply_keyboard_nav() + Chart import
- src/main.rs extend keyboard::listen() to forward nav keys
app-wide (canvas delivery requires cursor focus)
Tested on: Apple M3 Max, macOS 15.7.5 Sequoia (Build 24G607)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds keyboard-driven chart panning so users can navigate history without touching the mouse or trackpad.
Key bindings:
←/→ scroll 10 bars left/right
Shift+←/→ scroll 50 bars (fast)
PageUp/Down scroll one full visible window
Home jump to latest bar (reset pan)
macOS equivalents: Fn+↑ = PageUp, Fn+↓ = PageDown, Fn+← = Home
Navigation works whenever the app window is focused; the cursor does not need to be inside the chart canvas.
Implementation
All pan logic lives in a new src/chart/keyboard_nav.rs module.
keyboard_nav_msg() is added as a default method on the Chart trait (using the already-required state() accessor), so every current and future chart type automatically gets keyboard navigation with no per-type boilerplate.
Minimal changes to existing files:
delegate _ => arm in canvas_interaction;
cursor_position? guard moved inside Shift arm
(ruler tool needs it, nav keys do not)
app-wide (canvas delivery requires cursor focus)
Tested on: Apple M3 Max, macOS 15.7.5 Sequoia (Build 24G607)