Repository navigation
fix(ui): run the SQL pane's query once per Ctrl+Enter, not for each key repeat - #848
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
SQL shortcut repeat handling crates/ui-egui/src/sqlpane.rs |
A helper detects non-repeated Command+Enter events. The editor uses it to decide when to run a query. Tests cover repeated and non-repeated events, Enter without Command, and Command+Shift+Enter. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related issues
- [Feature]: Run the Script pane with Ctrl+Enter (⌘+Enter on macOS) #773 — The PR applies the non-repeat shortcut rule already used in the Script pane.
Possibly related PRs
- opengeos/RustGIS#783 — This PR adds the Script pane shortcut behavior that the SQL pane change follows.
Suggested reviewers: giswqs
Merge Risk: 
Minimal · up to 2f42c
-
The requested shortcut behavior is implemented without introducing a current merge-blocking risk.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Title check
-
Explanation
The title names the change and its cause: the SQL pane's query runs once per Ctrl+Enter press instead of on each key repeat. The changeset matches this. The sqlpane.rs summary shows Ctrl/Cmd+Enter now runs only on a non-repeated Enter press with logical Command modifiers, and the new test covers held-key repeats. The title is in the conventional commit form and is a single sentence under 80 characters. It names a specific change, so it is not vague.
Full details: Description check
-
Explanation
The description follows the repository template. It has Summary, Testing, and Related issue sections. The Summary explains the root cause (key_pressed counts key-repeat events, and go only skipped them while a query ran), the fix (run_pressed checks for an Enter press with COMMAND and repeat false), and why sqlbox was left unchanged. The Testing section lists cargo xtask ci, a new named test with the cases it covers, and manual desktop steps. The Related issue section links Closes
#845. The description is complete.
Full details: Linked Issues check
-
Explanation
The changes satisfy the coding requirements in [
#845].sqlpane::run_pressedaccepts only a pressedEnterevent withrepeat: falseand logical Command modifiers. The SQL pane keeps the focus check and the existing running-query guard. The new test covers initial presses, repeats, presses among repeats, Enter without Command, and Shift. The Labeling pane already prevents repeat applies:sqlbox::editorrequireschanged && reads.is_ok(), andlabelpane::sqlapplies the result in the same frame. A repeat after the first apply therefore finds no changed clause.
Full details: Out of Scope Changes check
-
Explanation
The whole diff is within [
#845]. The newrun_pressedhelper changes the SQL pane shortcut behavior. The integration change uses that helper. The unit test verifies the required key-event cases. No unrelated production behavior or unrelated files changed.
-
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
A rabbit taps the Enter key,
One press runs the query free.
Repeats now wait and do not go,
Shift may join, the lines still flow.
The SQL pane rests in row.
Comment @coderabbitai help to get the list of available commands.
Code reviewThis PR makes the SQL pane run its query once per Ctrl+Enter press instead of once for each key repeat (#845). I found no bugs. I read the diff only and did not build the code or run the tests. Bugs
Security
Performance
Quality
AGENTS.md
Change sizeCompared: the whole PR against main (merge base ebbe8a5 to PR head 2f42c6b)
|
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the |
Code reviewI reviewed the one-file change to Bugs
Security
Performance
Quality
AGENTS.md
Change sizeCompared: the whole PR against main (merge base ebbe8a5 to PR head 2f42c6b)
|
Summary
Holding Ctrl/⌘+Enter in the SQL pane ran the query again and again:
key_pressed(Enter)counts key-repeat events, andgoonly skipped them while a query was running, so a repeat arriving after the preview finished ran it again.The run key is now read by
run_pressed: an Enter press with Ctrl/⌘ (matches_logically(COMMAND)) andrepeat: false, the rule the Script pane uses since #773. egui setsrepeatitself for every press after the first while a key is held. The key is still not consumed, as before.The Labeling pane's SQL box (
sqlbox) is left as is: it takes the repeats too, but Apply only acts on a changed clause and the pane runs it in the same frame, so the repeats find nothing to apply (see the correction on #845).Testing
cargo xtask cipasses.sqlpane::tests::a_held_ctrl_enter_runs_once: a press runs, a repeat doesn't, a press among repeats does, Enter alone doesn't, Shift is ignored.SELECT 42for 2 s runs it once; releasing and pressing again runs it again; Enter alone breaks the line; Ctrl/⌘+Enter with the editor unfocused runs nothing; the Run button still works.Related issue
Closes #845
Summary by CodeRabbit