Highlighting trailing whitespaces

Added option `hltrailingws` for highlighting trailing whitespaces
at the end of lines. Note that it behaves in a "smart" way.
It doesn't highlight newly added (transient) trailing whitespaces
that naturally occur while typing text. It would be annoying to
see transient highlighting every time we enter a space at the end
of a line while typing.
So a newly added trailing whitespace starts being highlighting
only after the cursor moves to another line. Thus the highlighting
serves its purpose: it draws our attention to annoying sloppy
forgotten trailing whitespaces.
This commit is contained in:
Dmitry Maluka
2020-10-20 22:52:49 +02:00
committed by Dmytro Maluka
parent 64370b70d6
commit 104caf08dd
7 changed files with 119 additions and 1 deletions

View File

@@ -509,6 +509,13 @@ func (h *BufPane) HandleEvent(event tcell.Event) {
InfoBar.ClearGutter()
}
}
cursors := h.Buf.GetCursors()
for _, c := range cursors {
if c.NewTrailingWsY != c.Y {
c.NewTrailingWsY = -1
}
}
}
// Bindings returns the current bindings tree for this buffer.