feat(whitespace): add leading, eol, tabs modes and highlight leading/trailing errors

This changes whitespace rendering to use a map of the visible viewport.
The view map makes it easy and fast to implement various whitespace
highlighting and rendering features.
This commit is contained in:
CJ van den Berg 2025-01-02 18:22:32 +01:00
parent 233e881f95
commit 919d5ee9bb
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 251 additions and 80 deletions

View file

@ -685,7 +685,15 @@ const cmds = struct {
self.config.whitespace_mode = if (std.mem.eql(u8, self.config.whitespace_mode, "none"))
"indent"
else if (std.mem.eql(u8, self.config.whitespace_mode, "indent"))
"leading"
else if (std.mem.eql(u8, self.config.whitespace_mode, "leading"))
"eol"
else if (std.mem.eql(u8, self.config.whitespace_mode, "eol"))
"tabs"
else if (std.mem.eql(u8, self.config.whitespace_mode, "tabs"))
"visible"
else if (std.mem.eql(u8, self.config.whitespace_mode, "visible"))
"full"
else
"none";
try self.save_config();