feat: add whitespace_mode external
This commit is contained in:
parent
741096cb43
commit
2ca1a742a1
3 changed files with 15 additions and 1 deletions
|
|
@ -114,6 +114,7 @@ pub const WhitespaceMode = enum {
|
||||||
leading,
|
leading,
|
||||||
eol,
|
eol,
|
||||||
tabs,
|
tabs,
|
||||||
|
external,
|
||||||
visible,
|
visible,
|
||||||
full,
|
full,
|
||||||
none,
|
none,
|
||||||
|
|
|
||||||
|
|
@ -1562,6 +1562,18 @@ pub const Editor = struct {
|
||||||
cell.cell.char.grapheme = c;
|
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 => {
|
.visible => {
|
||||||
if (get_whitespace_char(cell_type, next_cell_type)) |c|
|
if (get_whitespace_char(cell_type, next_cell_type)) |c|
|
||||||
cell.cell.char.grapheme = c;
|
cell.cell.char.grapheme = c;
|
||||||
|
|
|
||||||
|
|
@ -1002,7 +1002,8 @@ const cmds = struct {
|
||||||
.indent => .leading,
|
.indent => .leading,
|
||||||
.leading => .eol,
|
.leading => .eol,
|
||||||
.eol => .tabs,
|
.eol => .tabs,
|
||||||
.tabs => .visible,
|
.tabs => .external,
|
||||||
|
.external => .visible,
|
||||||
.visible => .full,
|
.visible => .full,
|
||||||
.full => .none,
|
.full => .none,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue