fix: correct a couple of integer overflow errors
This commit is contained in:
parent
ed8a1276da
commit
476baf768e
3 changed files with 5 additions and 5 deletions
|
@ -1026,9 +1026,9 @@ pub const Editor = struct {
|
|||
for (sel.begin.row..sel.end.row + 1) |row| {
|
||||
const begin_col = if (row == sel.begin.row) sel.begin.col else 0;
|
||||
const end_col = if (row == sel.end.row) sel.end.col else ctx.self.view.col + ctx.self.view.cols;
|
||||
const y = row - ctx.self.view.row;
|
||||
const x = begin_col - ctx.self.view.col;
|
||||
const end_x = end_col - ctx.self.view.col;
|
||||
const y = @max(ctx.self.view.row, row) - ctx.self.view.row;
|
||||
const x = @max(ctx.self.view.col, begin_col) - ctx.self.view.col;
|
||||
const end_x = @max(ctx.self.view.col, end_col) - ctx.self.view.col;
|
||||
if (x >= end_x) return;
|
||||
for (x..end_x) |x_|
|
||||
try ctx.render_cell(y, x_, style);
|
||||
|
|
|
@ -174,7 +174,7 @@ fn handle_menu_action(menu: **Menu.State(*Self), button: *Button.State(*Menu.Sta
|
|||
entry.end_line + 1,
|
||||
entry.end_pos + 2,
|
||||
entry.begin_line,
|
||||
entry.begin_pos + 1,
|
||||
if (entry.begin_pos == 0) 0 else entry.begin_pos + 1,
|
||||
entry.end_line,
|
||||
entry.end_pos + 1,
|
||||
},
|
||||
|
|
|
@ -110,7 +110,7 @@ fn add_find_in_files_result(self: *Self, path: []const u8, begin_line: usize, be
|
|||
self.find_in_files_done = false;
|
||||
fl.reset();
|
||||
}
|
||||
fl.add_item(.{ .path = path, .begin_line = begin_line - 1, .begin_pos = begin_pos - 1, .end_line = end_line - 1, .end_pos = end_pos - 1, .lines = lines }) catch |e| return tp.exit_error(e, @errorReturnTrace());
|
||||
fl.add_item(.{ .path = path, .begin_line = @max(1, begin_line) - 1, .begin_pos = @max(1, begin_pos) - 1, .end_line = @max(1, end_line) - 1, .end_pos = @max(1, end_pos) - 1, .lines = lines }) catch |e| return tp.exit_error(e, @errorReturnTrace());
|
||||
}
|
||||
|
||||
pub fn update(self: *Self) void {
|
||||
|
|
Loading…
Add table
Reference in a new issue