Skip to content

fix(filters): disable smart substitution in cell editors and filter inputs#1149

Merged
datlechin merged 1 commit into
mainfrom
fix/disable-smart-substitution-in-cell-and-filter-inputs
May 9, 2026
Merged

fix(filters): disable smart substitution in cell editors and filter inputs#1149
datlechin merged 1 commit into
mainfrom
fix/disable-smart-substitution-in-cell-and-filter-inputs

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

Six SwiftUI TextField sites and one AppKit NSTextField subclass now disable the system field-editor's smart-substitution behaviour:

  • SingleLineEditorView, MultiLineEditorView, BlobHexEditorView (right-sidebar cell editors)
  • FilterRowView second-value TextField
  • FilterPanelView preset name alert TextField
  • CreateTableView table-name TextField
  • FilterValueTextField (AppKit, used by the primary filter operand)

The SwiftUI sites use .autocorrectionDisabled(true). The AppKit field is now backed by a private SubstitutionDisabledTextField: NSTextField that overrides becomeFirstResponder() and disables all four flags on the live field editor (isAutomaticQuoteSubstitutionEnabled, isAutomaticDashSubstitutionEnabled, isAutomaticTextReplacementEnabled, isAutomaticSpellingCorrectionEnabled) once super has installed the editor.

Why this matters

This is HIG audit findings 5.1 + 5.2. macOS's default field editor turns straight quotes into curly quotes and -- into an em-dash. For database cell values, filter operands, identifiers, and hex bytes, that's silent data corruption: a typed WHERE name LIKE "Bob's" arrives at the database with curly quotes and stops matching. The four files that already disable substitutions (JSONSyntaxTextView, HexEditorContentView, ConnectionAdvancedView, AIRulesPaneView) were the model.

The AppKit subclass is the Apple-recommended primitive: configure substitutions on the field editor after super installs it, encapsulated with the type so it travels with every use of FilterValueTextField.

Test plan

  • Type "hello" in a cell editor and confirm the quotes stay straight.
  • Type -- in a filter value and confirm it stays as two hyphens, not an em-dash.
  • Type a value in FilterValueTextField, confirm no substitution.
  • Verify the primary filter operand's autocomplete dropdown still works (no regression in the suggestion key monitor / popover).
  • swiftlint --strict clean on changed files.

@datlechin datlechin merged commit 5f9253a into main May 9, 2026
2 checks passed
@datlechin datlechin deleted the fix/disable-smart-substitution-in-cell-and-filter-inputs branch May 9, 2026 16:36
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.

1 participant