-
Notifications
You must be signed in to change notification settings - Fork 0
LAB-1803: Trim styled blanks in vt scrollback #15
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -115,12 +115,24 @@ func (s *Scrollback) CellAt(x, y int) *uv.Cell { | |
| func trimTrailingEmptyCells(line uv.Line) uv.Line { | ||
| lastNonEmpty := -1 | ||
| for i := len(line) - 1; i >= 0; i-- { | ||
| c := &line[i] | ||
| if !c.IsZero() && !c.Equal(&uv.EmptyCell) { | ||
| if !isTrailingScrollbackBlank(&line[i]) { | ||
| lastNonEmpty = i | ||
| break | ||
| } | ||
| } | ||
|
|
||
| return line[:lastNonEmpty+1] | ||
| } | ||
|
|
||
| func isTrailingScrollbackBlank(cell *uv.Cell) bool { | ||
| if cell == nil { | ||
| return true | ||
| } | ||
| if cell.IsZero() || cell.Equal(&uv.EmptyCell) { | ||
| return true | ||
| } | ||
|
Comment on lines
+126
to
+133
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The PR description states "Preserve width-0 continuation cells so wide-character layout state is not discarded," but a zero-value continuation cell ( |
||
| if cell.Width == 0 { | ||
| return false | ||
| } | ||
| return cell.Content == "" || cell.Content == " " | ||
| } | ||
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.
nilcheck here is dead code.isTrailingScrollbackBlankis only ever called with&line[i]insidetrimTrailingEmptyCells, whereiis a valid slice index, so the pointer is always non-nil. The branch can be removed without any behavioural change.