Repository navigation
Fix file-editor arrow-key navigation and add a word-wrap setting (#5227) #5247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+454
−8
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
07ee087
Add failing regression test for file-editor arrow keys (#5227)
austinywang f69308a
Route arrow keys to focused editable text views (#5227)
austinywang 249a325
Add persisted word-wrap setting for the file editor (#5227)
austinywang 854525c
Fix pbxproj UUID collision for FilePreviewWordWrapSettings (#5227)
austinywang d6bc278
Address review: dedupe arrow-routing helper, guard zero-width wrap (#…
austinywang 0e6b7a0
Address review: Swift Testing for new test, restore sorted contract l…
austinywang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
Packages/CmuxSettings/Sources/CmuxSettings/Keys/FileEditorCatalogSection.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import Foundation | ||
|
|
||
| /// Settings under the dotted-id prefix `fileEditor.*`. | ||
| /// | ||
| /// Controls the built-in plain-text file editor (the text preview that the | ||
| /// file explorer and `cmux` file routing open for editable text files). This | ||
| /// is distinct from the rendered markdown viewer, whose settings live in | ||
| /// ``MarkdownCatalogSection``. | ||
| public struct FileEditorCatalogSection: SettingCatalogSection { | ||
| /// Whether long lines soft-wrap at the editor's right edge. | ||
| /// | ||
| /// `false` (the default) preserves the established behavior: lines extend | ||
| /// past the viewport and a horizontal scroller appears. `true` wraps each | ||
| /// line to the visible width and hides the horizontal scroller, the way a | ||
| /// prose editor does. Changing this applies live to open editors. | ||
| public let wordWrap = DefaultsKey<Bool>( | ||
| id: "fileEditor.wordWrap", | ||
| defaultValue: false, | ||
| userDefaultsKey: "fileEditor.wordWrap" | ||
| ) | ||
|
|
||
| /// Creates the file editor settings section with its default keys. | ||
| public init() {} | ||
| } |
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Localize this curated search entry before shipping.
This adds a new user-visible curated result with an English-only title and English-only search terms, so localized builds will surface/search this setting differently from the rest of the PR. Route the title/synonyms through localized resources or derive them from an already localized search/index source instead of hardcoding another English entry here. As per coding guidelines, "Any new or changed user-facing text must be fully localized across all supported locales."
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Intentionally consistent with the existing convention: every entry in CuratedSettingEntry+Default.swift uses English-literal titles/synonyms (the curated table is the search synonym index). The user-facing Settings control itself is localized — AppSection renders
String(localized: "settings.app.fileEditorWordWrap")(en + ja in Localizable.xcstrings), and the legacy search alias has en + ja entries too. Localizing this one curated entry while ~60 siblings stay English would be inconsistent; happy to localize the whole table in a separate pass if desired.— Claude Code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@austinywang, that makes complete sense — the file-level doc comment even states "Strings are English-only until the package ships an xcstrings catalog", and every existing sibling entry follows the same pattern. The rendered settings label and legacy search alias are already localized (en + ja), so the concern doesn't apply here. Acknowledged, and happy to see the whole table localized in a dedicated pass when the package gets its own catalog.✏️ Learnings added
🧠 Learnings used