Skip to content

fix(status-bar): add persistent {read_only} [RO] indicator (#2309)#2331

Open
sinelaw wants to merge 1 commit into
masterfrom
claude/upbeat-maxwell-is09r2
Open

fix(status-bar): add persistent {read_only} [RO] indicator (#2309)#2331
sinelaw wants to merge 1 commit into
masterfrom
claude/upbeat-maxwell-is09r2

Conversation

@sinelaw

@sinelaw sinelaw commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #2309.

Read-only buffers are documented to show a [RO] status-bar indicator (docs/features/editing.md, the 0.2.18 blog post), but no such indicator was ever rendered. Read-only state was communicated only through transient one-shot messages (Editing disabled in this buffer, Read-only mode enabled), so a user opening a read-only file got no standing cue — they discovered the buffer was read-only only by typing and having the edit silently rejected.

Root cause

The [RO] text was emitted only as part of the {filename} status-bar element. The default status-bar layout, however, intentionally omits {filename} (the active file is already shown in the tab bar — see default_status_bar_left's comment). So in the default config the indicator's only host element wasn't present, and [RO] never appeared anywhere — exactly as the issue reports. The underlying read-only behavior (auto read-only on library paths, binary files, Toggle Read-Only Mode) was correct; only the indicator was missing.

Fix

Add a dedicated {read_only} status-bar element that renders a steady [RO] segment whenever the active buffer is read-only, independent of {filename}. It renders nothing when the buffer is editable — mirroring the {warnings} / {update} segments. It is placed at the head of the default right cluster so the documented indicator appears out of the box, grouped with the other file-state segments (line ending / encoding / language).

The element is also exposed in the settings UI dual-list (Read-Only) and the config schema, so users can reposition or remove it like any other segment. {filename} continues to carry [RO] for users who add that element to their layout.

Changes

  • config.rs: new StatusBarElement::ReadOnly ({read_only}) variant — parsing, serialization, JSON-schema dual-list option, and inclusion in the default right layout.
  • view/ui/status_bar.rs: render [RO] for the new element when ctx.read_only is set.
  • plugins/config-schema.json: regenerated (matches CI's generate_schema).
  • tests/e2e/auto_read_only.rs: e2e regression tests — [RO] shown for a read-only (library) buffer, absent for an editable one (observing only rendered output, per CONTRIBUTING).

Testing

  • New e2e tests fail without the fix (confirmed by temporarily removing the element from the default layout) and pass with it.
  • Full auto_read_only, status_bar_config, and audit_mode e2e suites pass.
  • cargo fmt / cargo clippy clean; schema check matches CI.
  • Manual validation (tmux): opening a library file renders … [RO] LF ASCII JavaScript … as a steady segment; running Toggle Read-Only Mode removes the [RO] segment, confirming it tracks live read-only state.

https://claude.ai/code/session_01Xptdt92shjjon5YYJQK1M7


Generated by Claude Code

Read-only buffers advertised a `[RO]` status-bar indicator in the docs
(docs/features/editing.md, the 0.2.18 blog post), but it was only ever
emitted as part of the `{filename}` element — and the default status-bar
layout intentionally omits `{filename}` (the file is already shown in the
tab bar). As a result a user opening a read-only file (auto read-only on
library paths, binary files, or Toggle Read-Only Mode) got no standing
cue: read-only state surfaced only through transient one-shot messages
("Editing disabled in this buffer").

Add a dedicated `{read_only}` status-bar element that renders a steady
`[RO]` segment whenever the active buffer is read-only, independent of
`{filename}`, and place it at the head of the default right cluster so the
documented indicator appears out of the box. The element renders nothing
when the buffer is editable, mirroring the {warnings}/{update} segments.

E2E tests assert the indicator appears for a read-only (library) buffer
and is absent for an editable one, observing only rendered output.

https://claude.ai/code/session_01Xptdt92shjjon5YYJQK1M7
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.

Read-only buffers show no [RO] status-bar indicator (documented but never rendered)

2 participants