fix(status-bar): add persistent {read_only} [RO] indicator (#2309)#2331
Open
sinelaw wants to merge 1 commit into
Open
fix(status-bar): add persistent {read_only} [RO] indicator (#2309)#2331sinelaw wants to merge 1 commit into
sinelaw wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 — seedefault_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: newStatusBarElement::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 whenctx.read_onlyis set.plugins/config-schema.json: regenerated (matches CI'sgenerate_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
auto_read_only,status_bar_config, andaudit_modee2e suites pass.cargo fmt/cargo clippyclean; schema check matches CI.… [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