aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r--helix-term/src/ui/document.rs12
-rw-r--r--helix-term/src/ui/editor.rs9
-rw-r--r--helix-term/src/ui/fuzzy_match.rs2
3 files changed, 9 insertions, 14 deletions
diff --git a/helix-term/src/ui/document.rs b/helix-term/src/ui/document.rs
index ddbb2cf3..ed4b1de9 100644
--- a/helix-term/src/ui/document.rs
+++ b/helix-term/src/ui/document.rs
@@ -402,7 +402,7 @@ impl<'a> TextRenderer<'a> {
is_in_indent_area: &mut bool,
position: Position,
) {
- let cut_off_start = self.col_offset.saturating_sub(position.col as usize);
+ let cut_off_start = self.col_offset.saturating_sub(position.col);
let is_whitespace = grapheme.is_whitespace();
// TODO is it correct to apply the whitspace style to all unicode white spaces?
@@ -413,7 +413,7 @@ impl<'a> TextRenderer<'a> {
let width = grapheme.width();
let grapheme = match grapheme {
Grapheme::Tab { width } => {
- let grapheme_tab_width = char_to_byte_idx(&self.tab, width as usize);
+ let grapheme_tab_width = char_to_byte_idx(&self.tab, width);
&self.tab[..grapheme_tab_width]
}
// TODO special rendering for other whitespaces?
@@ -423,8 +423,8 @@ impl<'a> TextRenderer<'a> {
Grapheme::Newline => &self.newline,
};
- let in_bounds = self.col_offset <= (position.col as usize)
- && (position.col as usize) < self.viewport.width as usize + self.col_offset;
+ let in_bounds = self.col_offset <= position.col
+ && position.col < self.viewport.width as usize + self.col_offset;
if in_bounds {
self.surface.set_string(
@@ -433,10 +433,10 @@ impl<'a> TextRenderer<'a> {
grapheme,
style,
);
- } else if cut_off_start != 0 && cut_off_start < width as usize {
+ } else if cut_off_start != 0 && cut_off_start < width {
// partially on screen
let rect = Rect::new(
- self.viewport.x as u16,
+ self.viewport.x,
self.viewport.y + position.row as u16,
(width - cut_off_start) as u16,
1,
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index 493f8d50..59f371bd 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -206,7 +206,7 @@ impl EditorView {
highlights,
theme,
&mut line_decorations,
- &mut *translated_positions,
+ &mut translated_positions,
);
Self::render_rulers(editor, doc, view, inner, surface, theme);
@@ -723,12 +723,7 @@ impl EditorView {
let viewport = view.area;
let line_decoration = move |renderer: &mut TextRenderer, pos: LinePos| {
- let area = Rect::new(
- viewport.x,
- viewport.y + pos.visual_line as u16,
- viewport.width,
- 1,
- );
+ let area = Rect::new(viewport.x, viewport.y + pos.visual_line, viewport.width, 1);
if primary_line == pos.doc_line {
renderer.surface.set_style(area, primary_style);
} else if secondary_lines.binary_search(&pos.doc_line).is_ok() {
diff --git a/helix-term/src/ui/fuzzy_match.rs b/helix-term/src/ui/fuzzy_match.rs
index e6a3f03a..b406702f 100644
--- a/helix-term/src/ui/fuzzy_match.rs
+++ b/helix-term/src/ui/fuzzy_match.rs
@@ -25,7 +25,7 @@ impl QueryAtom {
_ => QueryAtomKind::Fuzzy,
};
- if atom.starts_with(&['^', '\'']) {
+ if atom.starts_with(['^', '\'']) {
atom.remove(0);
}