summaryrefslogtreecommitdiff
path: root/helix-term/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r--helix-term/src/ui/editor.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index 849f0b0b..6ed9799b 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -421,7 +421,11 @@ impl EditorView {
return;
}
- for i in 0..(indent_level / tab_width as u16) {
+ let starting_indent = (offset.col / tab_width) as u16;
+ // TODO: limit to a max indent level too. It doesn't cause visual artifacts but it would avoid some
+ // extra loops if the code is deeply nested.
+
+ for i in starting_indent..(indent_level / tab_width as u16) {
surface.set_string(
viewport.x + (i * tab_width as u16) - offset.col as u16,
viewport.y + line,