fix: indent line rendering when scrolled right
This commit is contained in:
parent
0f3a64c481
commit
76f23b0824
1 changed files with 5 additions and 3 deletions
|
|
@ -1483,6 +1483,7 @@ pub const Editor = struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_whitespace_map(self: *Self, theme: *const Widget.Theme, cell_map: CellMap) !void {
|
fn render_whitespace_map(self: *Self, theme: *const Widget.Theme, cell_map: CellMap) !void {
|
||||||
|
const col_offset = self.view.col;
|
||||||
const char = whitespace.char;
|
const char = whitespace.char;
|
||||||
const frame = tracy.initZone(@src(), .{ .name = "editor whitespace map" });
|
const frame = tracy.initZone(@src(), .{ .name = "editor whitespace map" });
|
||||||
defer frame.deinit();
|
defer frame.deinit();
|
||||||
|
|
@ -1525,12 +1526,13 @@ pub const Editor = struct {
|
||||||
_ = self.plane.at_cursor_cell(&cell) catch return;
|
_ = self.plane.at_cursor_cell(&cell) catch return;
|
||||||
switch (self.render_whitespace) {
|
switch (self.render_whitespace) {
|
||||||
.indent => {
|
.indent => {
|
||||||
if (leading and x % self.indent_size == 0)
|
const col = x + col_offset;
|
||||||
|
const is_indent_col = col % self.indent_size == 0;
|
||||||
|
if (leading and is_indent_col)
|
||||||
cell.cell.char.grapheme = char.indent;
|
cell.cell.char.grapheme = char.indent;
|
||||||
if (is_blank and x < prev_indent and x % self.indent_size == 0)
|
if (is_blank and col < prev_indent and is_indent_col)
|
||||||
cell.cell.char.grapheme = char.indent;
|
cell.cell.char.grapheme = char.indent;
|
||||||
},
|
},
|
||||||
|
|
||||||
.leading => {
|
.leading => {
|
||||||
if (leading) {
|
if (leading) {
|
||||||
if (get_whitespace_char(cell_type, next_cell_type)) |c|
|
if (get_whitespace_char(cell_type, next_cell_type)) |c|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue