fix(ui): make word wrap work in side-by-side diff view#450
Merged
Conversation
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.
Fixes #441.
Sorry for the delay on this one — work has been busy the past while, so
it took me a bit to get the PR out.
Fix
Introduce a span-level word wrapper (
wrap_spans) and route both views through it, so the same code that renders rows also produces their heights. Side-by-side additionally wraps each column independently and keeps the│divider aligned on continuation rows.Commits
style-preserving word wrapper primitive; no callers yet.
extract a common
paint_cursor_line_highlightthat walksrow_heightsso unified and side-by-side can't drift on wrapped rows.some cleanup to make room for the meta insertion in handle multiple sessions / multiple repositories #5.
replace
Paragraph::wrap+compute_row_heightsdual pass with onewrap_spanscall producing both the visual rows and their heights.the actual fix. Record
SbsRowMeta(raw content, prefix, pad style) per logical line at build time, then wrap each column atcontent_widthwith│-preserving continuation prefixes. Deletes the now-unusedcompute_row_heights.draw the comment-box vertical bar across every wrapped sub-row instead of stopping at the first visual row.
perf. make it faster