@@ -402,7 +402,7 @@ impl<'a> TextRenderer<'a> {
402 is_in_indent_area: &mut bool,
402 is_in_indent_area: &mut bool,
403 position: Position,
403 position: Position,
405− let cut_off_start = self.col_offset.saturating_sub(position.col as usize);
405+ let cut_off_start = self.col_offset.saturating_sub(position.col);
406 let is_whitespace = grapheme.is_whitespace();
406 let is_whitespace = grapheme.is_whitespace();
408 // TODO is it correct to apply the whitspace style to all unicode white spaces?
408 // TODO is it correct to apply the whitspace style to all unicode white spaces?
@@ -413,7 +413,7 @@ impl<'a> TextRenderer<'a> {
413 let width = grapheme.width();
413 let width = grapheme.width();
414 let grapheme = match grapheme {
414 let grapheme = match grapheme {
415 Grapheme::Tab { width } => {
415 Grapheme::Tab { width } => {
416− let grapheme_tab_width = char_to_byte_idx(&self.tab, width as usize);
416+ let grapheme_tab_width = char_to_byte_idx(&self.tab, width);
417 &self.tab[..grapheme_tab_width]
417 &self.tab[..grapheme_tab_width]
419 // TODO special rendering for other whitespaces?
419 // TODO special rendering for other whitespaces?
@@ -423,8 +423,8 @@ impl<'a> TextRenderer<'a> {
423 Grapheme::Newline => &self.newline,
423 Grapheme::Newline => &self.newline,
426− let in_bounds = self.col_offset <= (position.col as usize)
426+ let in_bounds = self.col_offset <= position.col
427− && (position.col as usize) < self.viewport.width as usize + self.col_offset;
427+ && position.col < self.viewport.width as usize + self.col_offset;
429 if in_bounds {
429 if in_bounds {
430 self.surface.set_string(
430 self.surface.set_string(
@@ -433,10 +433,10 @@ impl<'a> TextRenderer<'a> {
433 grapheme,
433 grapheme,
436− } else if cut_off_start != 0 && cut_off_start < width as usize {
436+ } else if cut_off_start != 0 && cut_off_start < width {
437 // partially on screen
437 // partially on screen
438 let rect = Rect::new(
438 let rect = Rect::new(
439− self.viewport.x as u16,
439+ self.viewport.x,
440 self.viewport.y + position.row as u16,
440 self.viewport.y + position.row as u16,
441 (width - cut_off_start) as u16,
441 (width - cut_off_start) as u16,