Skip to content

Commit

Permalink
fix scrollbar panic
Browse files Browse the repository at this point in the history
  • Loading branch information
leb-kuchen committed Sep 24, 2024
1 parent 6f64ac3 commit fede133
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/terminal_box.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-only

use alacritty_terminal::{
grid::Dimensions,
index::{Column as TermColumn, Point as TermPoint, Side as TermSide},
selection::{Selection, SelectionType},
term::{cell::Flags, TermMode},
Expand Down Expand Up @@ -235,8 +236,10 @@ where
&& y >= 0.0
&& y < buffer_size.1.unwrap_or(0.0)
{
let col = x / terminal.size().cell_width;
let mut col = x / terminal.size().cell_width;
let row = y / terminal.size().cell_height;
// Fix panic on the left edge of the scroll bar
col = col.min(terminal.size().screen_lines().saturating_sub(1) as f32);
let location = terminal
.viewport_to_point(TermPoint::new(row as usize, TermColumn(col as usize)));
let term = terminal.term.lock();
Expand Down

0 comments on commit fede133

Please sign in to comment.