Skip to content

Commit

Permalink
Fix a bug in the code that clears to the end of the line
Browse files Browse the repository at this point in the history
This code assumed that the length of the current line is the same as the current
x write position, which isn't necessarily true if we are overwriting existing
lines.

This hasn't been a problem before
jesseduffield/lazygit#3687 because we would only use the
erase-to-eol feature in cases where the length of the lines either didn't
change, or where we called v.clear before. As of that PR though, we can run into
it in lazygit for example when pressing "+" to expand the commits view and then
going back.
  • Loading branch information
stefanhaller committed Aug 17, 2024
1 parent 07fed71 commit b2fe13b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion view.go
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ func (v *View) parseInput(ch rune, x int, _ int) (bool, []cell) {
// fill rest of line
v.ei.instructionRead()
cx := 0
for _, cell := range v.lines[v.wy] {
for _, cell := range v.lines[v.wy][0:v.wx] {
cx += runewidth.RuneWidth(cell.chr)
}
repeatCount = v.InnerWidth() - cx
Expand Down

0 comments on commit b2fe13b

Please sign in to comment.