Skip to content

Commit

Permalink
Don't display line numbers if buffer width is 0 and softwrap is on
Browse files Browse the repository at this point in the history
If softwrap is enabled, the line numbers displayed in the ruler depend
on the heights of the displayed softwrapped lines, which depend on the
width of the displayed buffer. If this width is 0 (e.g. after resizing
buffer pane to a very small width), there is no displayed text at all,
so line numbers don't make sense. So don't display line numbers in this
case.
  • Loading branch information
dmaluka committed Dec 3, 2023
1 parent 325f25c commit d09fa4b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/display/bufwindow.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ func (w *BufWindow) drawLineNum(lineNumStyle tcell.Style, softwrapped bool, vloc
}
// Write the actual line number
for i := 0; i < len(lineNum) && vloc.X < w.gutterOffset; i++ {
if softwrapped {
if softwrapped || (w.bufWidth == 0 && w.Buf.Settings["softwrap"] == true) {
screen.SetContent(w.X+vloc.X, w.Y+vloc.Y, ' ', nil, lineNumStyle)
} else {
screen.SetContent(w.X+vloc.X, w.Y+vloc.Y, lineNum[i], nil, lineNumStyle)
Expand Down

0 comments on commit d09fa4b

Please sign in to comment.