fix: Indent levels could bleed over on the left edge

Fixes #3087
Refs #3105
    #	modified:   theme.toml
This commit is contained in:
Blaž Hrastnik 2022-07-20 17:03:19 +09:00
parent 3b1ba7fb12
commit 906259cc41
No known key found for this signature in database
GPG Key ID: 1238B9C4AD889640

View File

@ -421,7 +421,11 @@ pub fn render_text_highlights<H: Iterator<Item = HighlightEvent>>(
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,