on master help sign in
fix: Indent levels could bleed over on the left edge

Fixes #3087 Refs #3105 # modified: theme.toml

commit906259cc41cc251dbbe1802e3a5e54a566a7d8d2 authorBlaž Hrastnik <blaz@mxxn.io> dateWed 20 Jul 2022, 17:03 (4 years ago) parent3b1ba7f
1 file changed+5−1
helix-term/src/ui/editor.rs+5−1
helix-term/src/ui/editor.rs+5−1
@@ -421,7 +421,11 @@ impl EditorView {
421421 return;
422422 }
423423
424− for i in 0..(indent_level / tab_width as u16) {
424+ let starting_indent = (offset.col / tab_width) as u16;
425+ // TODO: limit to a max indent level too. It doesn't cause visual artifacts but it would avoid some
426+ // extra loops if the code is deeply nested.
427+
428+ for i in starting_indent..(indent_level / tab_width as u16) {
425429 surface.set_string(
426430 viewport.x + (i * tab_width as u16) - offset.col as u16,
427431 viewport.y + line,