Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jackpot51 committed Jun 12, 2024
1 parent 8bd54b9 commit 7c02b9c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 25 deletions.
36 changes: 18 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/terminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ impl Terminal {

self.with_buffer_mut(|buffer| {
let mut font_system = font_system().write().unwrap();
buffer.set_size(font_system.raw(), width as f32, height as f32);
buffer.set_size(font_system.raw(), Some(width as f32), Some(height as f32));
});

self.needs_update = true;
Expand Down
21 changes: 15 additions & 6 deletions src/terminal_box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,11 @@ where

let x = p.x - self.padding.left;
let y = p.y - self.padding.top;
if x >= 0.0 && x < buffer_size.0 && y >= 0.0 && y < buffer_size.1 {
if x >= 0.0
&& x < buffer_size.0.unwrap_or(0.0)
&& y >= 0.0
&& y < buffer_size.1.unwrap_or(0.0)
{
return mouse::Interaction::Text;
}
}
Expand Down Expand Up @@ -836,7 +840,11 @@ where
if let Button::Left = button {
let x = p.x - self.padding.left;
let y = p.y - self.padding.top;
if x >= 0.0 && x < buffer_size.0 && y >= 0.0 && y < buffer_size.1 {
if x >= 0.0
&& x < buffer_size.0.unwrap_or(0.0)
&& y >= 0.0
&& y < buffer_size.1.unwrap_or(0.0)
{
let click_kind =
if let Some((click_kind, click_time)) = state.click.take() {
if click_time.elapsed() < self.click_timing {
Expand Down Expand Up @@ -889,8 +897,8 @@ where
&& x < (scrollbar_rect.x + scrollbar_rect.width)
{
if terminal.scrollbar().is_some() {
let scroll_ratio =
terminal.with_buffer(|buffer| y / buffer.size().1);
let scroll_ratio = terminal
.with_buffer(|buffer| y / buffer.size().1.unwrap_or(1.0));
terminal.scroll_to(scroll_ratio);
if let Some(start_scroll) = terminal.scrollbar() {
state.dragging = Some(Dragging::Scrollbar {
Expand Down Expand Up @@ -995,8 +1003,9 @@ where
start_y,
start_scroll,
} => {
let scroll_offset = terminal
.with_buffer(|buffer| ((y - start_y) / buffer.size().1));
let scroll_offset = terminal.with_buffer(|buffer| {
(y - start_y) / buffer.size().1.unwrap_or(1.0)
});
terminal.scroll_to(start_scroll.0 + scroll_offset);
}
}
Expand Down

0 comments on commit 7c02b9c

Please sign in to comment.