Add line wrapping option - #5
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a line wrapping toggle feature for the source code viewer in the macOS app. The feature allows users to enable/disable line wrapping for code display through a menu item in the View menu, with the setting persisted in UserDefaults.
Key changes:
- Added a toggleable "Line Wrapping" menu item in the View menu with validation based on display mode
- Implemented line wrapping control through JavaScript by dynamically setting the
whiteSpaceCSS property - Added preference storage for the line wrapping state using a new
AppPreferences.Viewer.lineWrappingproperty
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| Main.xcstrings | Added localized strings for "Line Wrapping" menu item in English, Simplified Chinese, and Traditional Chinese |
| DataViewer.swift | Added setLineWrapping method to propagate line wrapping changes to the code view based on display mode |
| MainVC.swift | Implemented menu item validation and toggle action handler for line wrapping with responder chain integration |
| AppPreferences.swift | Added Viewer.lineWrapping preference property using the @Storage property wrapper for persistence |
| AppDelegate.swift | Implemented NSMenuDelegate to dynamically update menu item state based on current display mode |
| index.html | Added JavaScript functions loadCode and setLineWrapping to control CSS whiteSpace property, plus static overflow-wrap CSS rule |
| CodeView.swift | Added lineWrapping parameter to initializer and setLineWrapping method to invoke JavaScript function |
| Main.storyboard | Added "Line Wrapping" menu item with icon, separator, action binding, and menu delegate connection |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cyanzhong
force-pushed
the
line-wrapping
branch
from
December 26, 2025 06:48
7fd2caf to
f3b17bf
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
No description provided.