@@ -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,