Skip to content

Control: Go To and Select over the control channel scroll the active cell into view - #970

Merged
aiongg merged 1 commit into
storytold:mainfrom
marcoarnulfo:fix/goto-scrolls-into-view
Oct 22, 2026
Merged

aiongg merged 1 commit into
storytold:mainfrom
marcoarnulfo:fix/goto-scrolls-into-view

Conversation

@marcoarnulfo

Copy link
Copy Markdown
Contributor

Fixes #966.

The Go To dialog, the Name Box and the arrow keys all set grid.ensure_visible after moving the selection, which is what makes the grid scroll (the same flag #763 extended for the moving end). engine.execute in control.rs runs the command and stops there, so over the control channel, and through the MCP select tool that calls selection.set on it, the selection moves and the view stays where it was. Now the control channel sets the flag after edit.goTo, edit.goToSpecial, selection.set and selection.move succeed, both for engine.execute and for a command named as the method. I kept it to the commands that navigate rather than "any command that moves the active cell", so things like sheet.activate keep the sheet's saved scroll; happy to switch if you'd rather have the broader rule. docs/control-protocol.md mentions it.

Validation:

  • selection_scroll.rs: two new tests drive control::handle in egui_kittest: edit.goTo to Z300 must leave Z300 on screen (and going back to A1 must bring A1 back), and selection.set to BZ150:CA160 must show BZ150. Both fail on main (the active cell moves, the cell is not visible) and pass here; dropping edit.goTo from the list makes the Go To test fail again.
  • cargo test -p gridcraft-ui-egui --test selection_scroll, cargo clippy -p gridcraft-ui-egui --all-targets -- -D warnings, cargo fmt --all -- --check
  • (macOS, Apple silicon)

@aiongg
aiongg merged commit 4a8765a into storytold:main Oct 22, 2026
1 check 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.

[Bug] Go To moves the selection but not the view

2 participants