Skip to content

feat(ios): run the statement at the cursor in the query editor - #3681

Merged
datlechin merged 2 commits into
mainfrom
feat/ios-run-statement-at-cursor
Oct 20, 2026
Merged

datlechin merged 2 commits into
mainfrom
feat/ios-run-statement-at-cursor

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

  • Run in the iOS query editor sends the statement at the cursor, or the selection when there is one. Same rule as the Mac: the scanner's statement with its ;, never comment-only text.
  • A faint band marks the statement Run will send. A selection hides it.
  • Run is a pull-down button. Touch and hold shows Run Statement (Run Selection with a selection) and Run All Statements. Run All Statements is also in the More menu.
  • Hardware keyboard: Cmd+Return runs at the cursor, Cmd+Shift+Return runs all, Cmd+. stops. A key-command run keeps the keyboard up.
  • Cursor outside any statement: Run keeps the last result and shows "The cursor is not in a statement."
  • Safe Mode, Confirm Writes, History and the Live Activity get the text that runs, not the whole editor.
  • SQL Server runs the statement at the cursor, as the Mac does, not the whole GO batch.
  • Redis: a command ends at a ; or a line break outside quotes. On main, GET a and GET b on two lines ran as GET a GET b, and Safe Mode read only the first verb.
  • Redis: a command with an unclosed quote fails instead of storing a cut value.
  • Run no longer resigns the editor inside a SwiftUI view update. On main, Run tapped with the keyboard up looped at 100% CPU (AttributeGraph cycle) on the iOS 27 simulator with UI automation attached.
  • QueryScriptTests.redisIsOneCommand pinned the old Redis behavior and is replaced by redisSplitsIntoCommands.

Test plan

  • New, fail on main: QueryRunTargetTests, RedisCommandSplitterTests, SQLEditorHandleTests, QueryScriptTests.redisSplitsIntoCommands and redisTrimKeepsAnEscapedBlank, SQLWriteClassifierTests.redisWriteInALaterCommand, RedisCommandParsingTests.unclosedQuoteGivesNil, escapedLineBreakMatchesSplitter and escapedTrailingBlankReachesTheDriver. QueryEditorViewModelTests still pass.
  • iPhone 18 Pro simulator, Chinook sample, SELECT 1 AS a; / SELECT 2 AS b; / SELECT 3 AS c;, cursor on line 2: main runs all three and shows c = 3, this branch runs line 2 and shows b = 2.
  • Touch and hold on Run with SELECT selected shows Run Selection and runs the selection. Cursor after the last statement: the result stays and the note shows.
  • Not driven: the hardware keyboard shortcuts (the simulator driver sends no key chords).
Light Dark
Before Before, light Before, dark
After After, light After, dark
Run menu Run menu, light Run menu, dark

Not in this PR

  • The Mac reads Redis lines without ; as one command, the same defect fixed here for iOS (databases/redis.mdx example).
  • The iOS Redis parser drifts from the Mac's RedisArgumentCodec escapes: a lone trailing backslash (DEL victim\) is dropped on iOS and kept on the Mac.
  • A template insert or a History tap replaces the editor text without asking. History entries now hold the text that ran, which makes the History case likelier. .onDisappear drops the pending query save.
  • No Query menu in the iPadOS menu bar.

Fixes #3632

Redis text now splits into commands at ; and line breaks for Run, Run All and Safe Mode.
@datlechin
datlechin enabled auto-merge (squash) October 20, 2026 02:26
@datlechin
datlechin merged commit c179ccf into main Oct 20, 2026
8 checks passed
@datlechin
datlechin deleted the feat/ios-run-statement-at-cursor branch October 20, 2026 03:18
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.

Run the statement at the cursor in the iOS query editor

1 participant