gpui: Don't start a wrapped line with closing punctuation or a slash - #62743
Merged
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
alii
force-pushed
the
gpui-wrap-punctuation
branch
from
August 17, 2026 17:02
0c391ec to
260c194
Compare
Veykril
enabled auto-merge
August 26, 2026 08:00
isomoon
pushed a commit
to isomoon/zed
that referenced
this pull request
Aug 28, 2026
Upstream zed-industries#62743 fixed closing-punctuation wrapping inside is_word_char, which covers both the LineWrapper and line_layout's shaped-text path -- the two fork patches that guarded the break rule on the previous char are dropped as superseded. They also cost path/URL wrapping: guarding on prev_ch suppressed the '/' break opportunity upstream deliberately keeps, moving the boundaries of 'aaa/bbbbbb/cccccc/dddddd' from 3/10/17 to mid-segment 7/14/21. These tests pin all three behaviours against upstream's implementation.
playdohface
pushed a commit
to playdohface/zed
that referenced
this pull request
Aug 29, 2026
…ed-industries#62743) # Objective `LineWrapper` treats every punctuation character as a break opportunity, so a wrap can land right before `!`, `?`, `/`, `)`, `]`, `}`, a closing quote or an ellipsis. Text such as `please fix this plz!`, `8.0/8.0`, `cli/install`, `(see)` or `“quoted”` then wraps with the closing mark orphaned at the start of the next line. ## Solution Add the "UAX 14 LB13 rule" to `LineWrapper::is_word_char`, which is to not break before `! ? / ) ] } " ” » …` ## Testing Added unit tests and manually tested myself with a long paragraph in a gpui app. ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content adheres to Zed's UI standards - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable (one extra `matches!` per character in the wrap loop) --- Release Notes: - Fixed text wrapping so closing punctuation and slashes never begin a wrapped line. Co-authored-by: Lukas Wirth <lukas@zed.dev>
m-altaifi
pushed a commit
to m-altaifi/zed
that referenced
this pull request
Sep 2, 2026
…ed-industries#62743) # Objective `LineWrapper` treats every punctuation character as a break opportunity, so a wrap can land right before `!`, `?`, `/`, `)`, `]`, `}`, a closing quote or an ellipsis. Text such as `please fix this plz!`, `8.0/8.0`, `cli/install`, `(see)` or `“quoted”` then wraps with the closing mark orphaned at the start of the next line. ## Solution Add the "UAX 14 LB13 rule" to `LineWrapper::is_word_char`, which is to not break before `! ? / ) ] } " ” » …` ## Testing Added unit tests and manually tested myself with a long paragraph in a gpui app. ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content adheres to Zed's UI standards - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable (one extra `matches!` per character in the wrap loop) --- Release Notes: - Fixed text wrapping so closing punctuation and slashes never begin a wrapped line. Co-authored-by: Lukas Wirth <lukas@zed.dev>
yunxinx
added a commit
to yunxinx/zed
that referenced
this pull request
Sep 2, 2026
- line_break 不再维护独立的 is_legacy_word_character,改为复用 LineWrapper::is_word_char,消除两份词表与 dead_code - 上游 zed-industries#62743 的 ASCII 收尾标点(! ) ] } ")不在行首规则随之进入 UAX zed-industries#14 断行策略 - 补充收尾标点、开引号与路径分隔符的断行回归测试
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.
Objective
LineWrappertreats every punctuation character as a break opportunity, so a wrap can land right before!,?,/,),],}, a closing quote or an ellipsis. Text such asplease fix this plz!,8.0/8.0,cli/install,(see)or“quoted”then wraps with the closing mark orphaned at the start of the next line.Solution
Add the "UAX 14 LB13 rule" to
LineWrapper::is_word_char, which is to not break before! ? / ) ] } " ” » …Testing
Added unit tests and manually tested myself with a long paragraph in a gpui app.
Self-Review Checklist:
matches!per character in the wrap loop)Release Notes: