on master help sign in
Only draw indent guides within bounds
1de02a1A-Walrus
helix-term/src/ui/editor.rs+6−8
@@ -467,16 +467,14 @@ impl EditorView {
467
467
468 let starting_indent =
468 let starting_indent =
469 (offset.col / tab_width) + config.indent_guides.skip_levels as usize;
469 (offset.col / tab_width) + config.indent_guides.skip_levels as usize;
470− // TODO: limit to a max indent level too. It doesn't cause visual artifacts but it would avoid some
471− // extra loops if the code is deeply nested.
472
470
473 for i in starting_indent..(indent_level / tab_width) {
471 for i in starting_indent..(indent_level / tab_width) {
474− surface.set_string(
475− (viewport.x as usize + (i * tab_width) - offset.col) as u16,
472+ let x = (viewport.x as usize + (i * tab_width) - offset.col) as u16;
476− viewport.y + line,
473+ let y = viewport.y + line;
477− &indent_guide_char,
474+ if !surface.in_bounds(x, y) {
475+ break;
476+ }
478− indent_guide_style,
477+ surface.set_string(x, y, &indent_guide_char, indent_guide_style);
479− );
480 }
478 }
481 };
479 };
482
480