on master help sign in
Fix tab highlight when tab is partially visible (#3313)
c00b8f7A-Walrus
helix-term/src/ui/editor.rs+19
@@ -529,6 +529,8 @@ impl EditorView {
529 (grapheme.as_ref(), width)
529 (grapheme.as_ref(), width)
530 };
530 };
531
531
532+ let cut_off_start = offset.col.saturating_sub(visual_x as usize);
533+
532 if !out_of_bounds {
534 if !out_of_bounds {
533 // if we're offscreen just keep going until we hit a new line
535 // if we're offscreen just keep going until we hit a new line
534 surface.set_string(
536 surface.set_string(
@@ -541,7 +543,24 @@ impl EditorView {
541 style
543 style
542 },
544 },
543 );
545 );
546+ } else if cut_off_start != 0 && cut_off_start < width {
547+ // partially on screen
548+ let rect = Rect::new(
549+ viewport.x as u16,
550+ viewport.y + line,
551+ (width - cut_off_start) as u16,
552+ 1,
553+ );
554+ surface.set_style(
555+ rect,
556+ if is_whitespace {
557+ style.patch(whitespace_style)
558+ } else {
559+ style
560+ },
561+ );
544 }
562 }
563+
545 if is_in_indent_area && !(grapheme == " " || grapheme == "\t") {
564 if is_in_indent_area && !(grapheme == " " || grapheme == "\t") {
546 draw_indent_guides(visual_x, line, surface);
565 draw_indent_guides(visual_x, line, surface);
547 is_in_indent_area = false;
566 is_in_indent_area = false;