feat: add whitespace_mode external

This commit is contained in:
CJ van den Berg 2025-11-26 16:39:48 +01:00
parent 741096cb43
commit 2ca1a742a1
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
3 changed files with 15 additions and 1 deletions

View file

@ -114,6 +114,7 @@ pub const WhitespaceMode = enum {
leading,
eol,
tabs,
external,
visible,
full,
none,

View file

@ -1562,6 +1562,18 @@ pub const Editor = struct {
cell.cell.char.grapheme = c;
}
},
.external => {
if (leading) {
if (get_whitespace_char(cell_type, next_cell_type)) |c|
cell.cell.char.grapheme = c;
}
if (cell_type == .eol)
cell.cell.char.grapheme = char.eol;
if (cell_type == .tab or cell_type == .extension) {
if (get_whitespace_char(cell_type, next_cell_type)) |c|
cell.cell.char.grapheme = c;
}
},
.visible => {
if (get_whitespace_char(cell_type, next_cell_type)) |c|
cell.cell.char.grapheme = c;

View file

@ -1002,7 +1002,8 @@ const cmds = struct {
.indent => .leading,
.leading => .eol,
.eol => .tabs,
.tabs => .visible,
.tabs => .external,
.external => .visible,
.visible => .full,
.full => .none,
};