Skip to content

add termination checker#71

Closed
balajz wants to merge 1 commit into
mainfrom
fix/sql-termination
Closed

add termination checker#71
balajz wants to merge 1 commit into
mainfrom
fix/sql-termination

Conversation

@balajz
Copy link
Copy Markdown
Owner

@balajz balajz commented May 21, 2026

This pull request updates the user input handling logic in the UI model to better determine when SQL statements are complete and ready for execution. The main improvement is the introduction of a new function to check for SQL statement termination, which enhances how the application responds to the Enter key.

Copilot AI review requested due to automatic review settings May 21, 2026 14:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the Bubble Tea UI input handling so the Enter key better distinguishes between “statement complete” (ready to execute) vs “multi-line input” (insert newline), by introducing an explicit SQL termination/completeness check in the model.

Changes:

  • Adds an Enter-key handler in the UI model to trigger execution only when the current input is considered complete.
  • Introduces a helper function (sqlTerminationChecker) that treats empty input, backslash-prefixed meta-commands, and semicolon-terminated SQL as complete.

Comment thread internal/app/ui/model.go
Comment on lines +317 to +326
func sqlTerminationChecker(s string) bool {
trimmed := strings.TrimSpace(s)
if trimmed == "" {
return true
}
if strings.HasPrefix(trimmed, "\\") {
return true
}
return strings.HasSuffix(trimmed, ";")
}
Comment thread internal/app/ui/model.go
Comment on lines +317 to +326
func sqlTerminationChecker(s string) bool {
trimmed := strings.TrimSpace(s)
if trimmed == "" {
return true
}
if strings.HasPrefix(trimmed, "\\") {
return true
}
return strings.HasSuffix(trimmed, ";")
}
@balajz balajz closed this May 21, 2026
@balajz balajz deleted the fix/sql-termination branch May 21, 2026 15:09
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.

2 participants