Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix overflow #318

Merged
merged 1 commit into from
Jun 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions helix-term/src/ui/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl EditorView {
})],
};
let mut spans = Vec::new();
let mut visual_x = 0;
let mut visual_x = 0u16;
let mut line = 0u16;
let tab_width = doc.tab_width();

Expand Down Expand Up @@ -185,7 +185,7 @@ impl EditorView {
break 'outer;
}
} else if grapheme == "\t" {
visual_x += (tab_width as u16);
visual_x = visual_x.saturating_add(tab_width as u16);
} else {
let out_of_bounds = visual_x < view.first_col as u16
|| visual_x >= viewport.width + view.first_col as u16;
Expand All @@ -197,7 +197,7 @@ impl EditorView {

if out_of_bounds {
// if we're offscreen just keep going until we hit a new line
visual_x += width;
visual_x = visual_x.saturating_add(width);
continue;
}

Expand Down