@@ -428,7 +428,7 @@ impl EditorView {
428 let characters = &whitespace.characters;
428 let characters = &whitespace.characters;
430 let mut spans = Vec::new();
430 let mut spans = Vec::new();
431− let mut visual_x = 0u16;
431+ let mut visual_x = 0usize;
432 let mut line = 0u16;
432 let mut line = 0u16;
433 let tab_width = doc.tab_width();
433 let tab_width = doc.tab_width();
434 let tab = if whitespace.render.tab() == WhitespaceRenderValue::All {
434 let tab = if whitespace.render.tab() == WhitespaceRenderValue::All {
@@ -465,14 +465,13 @@ impl EditorView {
468− let starting_indent =
469− (offset.col / tab_width) as u16 + config.indent_guides.skip_levels;
468+ let starting_indent = (offset.col / tab_width) + config.indent_guides.skip_levels;
470 // TODO: limit to a max indent level too. It doesn't cause visual artifacts but it would avoid some
469 // TODO: limit to a max indent level too. It doesn't cause visual artifacts but it would avoid some
471 // extra loops if the code is deeply nested.
470 // extra loops if the code is deeply nested.
473− for i in starting_indent..(indent_level / tab_width as u16) {
472+ for i in starting_indent..(indent_level / tab_width) {
474 surface.set_string(
473 surface.set_string(
475− viewport.x + (i * tab_width as u16) - offset.col as u16,
474+ (viewport.x as usize + (i * tab_width) - offset.col) as u16,
476 viewport.y + line,
475 viewport.y + line,
477 &indent_guide_char,
476 &indent_guide_char,
478 indent_guide_style,
477 indent_guide_style,
@@ -518,14 +517,14 @@ impl EditorView {
518 use helix_core::graphemes::{grapheme_width, RopeGraphemes};
517 use helix_core::graphemes::{grapheme_width, RopeGraphemes};
520 for grapheme in RopeGraphemes::new(text) {
519 for grapheme in RopeGraphemes::new(text) {
521− let out_of_bounds = visual_x < offset.col as u16
520+ let out_of_bounds = offset.col > (visual_x as usize)
522− || visual_x >= viewport.width + offset.col as u16;
521+ || (visual_x as usize) >= viewport.width as usize + offset.col;
524 if LineEnding::from_rope_slice(&grapheme).is_some() {
523 if LineEnding::from_rope_slice(&grapheme).is_some() {
525 if !out_of_bounds {
524 if !out_of_bounds {
526 // we still want to render an empty cell with the style
525 // we still want to render an empty cell with the style
527 surface.set_string(
526 surface.set_string(
528− viewport.x + visual_x - offset.col as u16,
527+ (viewport.x as usize + visual_x - offset.col) as u16,
529 viewport.y + line,
528 viewport.y + line,
530 &newline,
529 &newline,
531 style.patch(whitespace_style),
530 style.patch(whitespace_style),
@@ -573,7 +572,7 @@ impl EditorView {
573 if !out_of_bounds {
572 if !out_of_bounds {
574 // if we're offscreen just keep going until we hit a new line
573 // if we're offscreen just keep going until we hit a new line
575 surface.set_string(
574 surface.set_string(
576− viewport.x + visual_x - offset.col as u16,
575+ (viewport.x as usize + visual_x - offset.col) as u16,
577 viewport.y + line,
576 viewport.y + line,
578 display_grapheme,
577 display_grapheme,
579 if is_whitespace {
578 if is_whitespace {
@@ -606,7 +605,7 @@ impl EditorView {
606 last_line_indent_level = visual_x;
605 last_line_indent_level = visual_x;
609− visual_x = visual_x.saturating_add(width as u16);
608+ visual_x = visual_x.saturating_add(width);