Skip to content

Edit as JSON is hard to use: no undo, smart quotes, no find or indentation #684

Closed

Description

@M4n0x

Problem

More → Edit as JSON… for a widget, and Edit as JSON… for a profile, open a SwiftUI TextEditor (BarInspector.jsonSheet and ProfileJSONSheet in ProfilesView.swift on main). Editing JSON there is hard:

  • ⌘Z doesn't undo the typing. StableBar has no visible main menu, so ⌘Z and ⇧⌘Z belong to the Undo and Redo buttons in the Settings footer (fix: keep the Settings form the same height while saving or showing errors #165, kept by fix: let ⌘V, ⌘C, ⌘X and ⌘A work in Settings text fields #261). In the sheet, ⌘Z does nothing to the text.
  • Typing " can insert “ or ”, depending on the macOS text settings. The JSON then fails with Unexpected character 'â' around line 3, column 13.: the column counts UTF-8 bytes, and the character shown is the first byte of the curly quote printed as Latin-1.
  • Return and Tab ignore the file's two-space indentation. Return starts the next line at column 1.
  • There's no find.
  • The two sheets differ. The widget sheet is 480×300 with 11.5 pt text and the Settings field colors. The profile sheet is 560×280 with body-size text and the system text background. Neither can be resized.

Proposal

Use one shared JSON sheet for widgets and profiles, built on an NSTextView set up for JSON:

  • ⌘Z and ⇧⌘Z undo and redo inside the editor. Elsewhere in Settings they still run the footer's Undo and Redo.
  • Smart quotes, smart dashes, text replacement, autocorrect and spell-check are off.
  • Return keeps the line's indentation and adds two spaces after { or [. Tab inserts two spaces.
  • ⌘F opens the find bar, with replace, and ⌘G / ⇧⌘G find the next and previous match. Escape closes the find bar without closing the sheet.
  • A syntax error names its line and the real character, such as Line 3: Unexpected character '“'., and selects that line.
  • The sheet can be resized and looks the same in both places.

The configuration format doesn't change, and there is no new dependency. Multiple cursors, syntax colors and line numbers can come later.

Possible today

No. Users have to type straight quotes carefully, or edit the configuration file in another editor.

Related

Triaged by Claude Code (Claude Opus 5.5).

Activity

  1. added
    enhancement
    on Nov 16, 2026
  2. stablebar-releases commented on Nov 16, 2026

    @stablebar-releases

    🎉 This issue has been resolved in version 0.16.0 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementreleased

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions