diff --git a/Cargo.lock b/Cargo.lock index 36b250f..40cdcdd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1114,7 +1114,7 @@ dependencies = [ [[package]] name = "cosmic-config" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic.git#892d9003adf5e0f68791457b693ae98ea8468b81" +source = "git+https://github.com/pop-os/libcosmic.git#f1aad68b712650b3c697834e1043f3dcc943c9e7" dependencies = [ "atomicwrites", "cosmic-config-derive", @@ -1133,7 +1133,7 @@ dependencies = [ [[package]] name = "cosmic-config-derive" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic.git#892d9003adf5e0f68791457b693ae98ea8468b81" +source = "git+https://github.com/pop-os/libcosmic.git#f1aad68b712650b3c697834e1043f3dcc943c9e7" dependencies = [ "quote", "syn 1.0.109", @@ -1142,7 +1142,7 @@ dependencies = [ [[package]] name = "cosmic-files" version = "0.1.0" -source = "git+https://github.com/pop-os/cosmic-files.git#ddd99525c56cf37e91e966d068110a3947fe9f8f" +source = "git+https://github.com/pop-os/cosmic-files.git#6572faec5c7646cf7a6d87f0b86e66ec8d97630d" dependencies = [ "chrono", "dirs", @@ -1208,7 +1208,7 @@ dependencies = [ [[package]] name = "cosmic-text" version = "0.11.2" -source = "git+https://github.com/pop-os/cosmic-text.git#cd1cd0a337d7bfd7d2586b28a4102827517bbf60" +source = "git+https://github.com/pop-os/cosmic-text.git#69d5aec7fc995a1748682af1cd3cc25847c05c95" dependencies = [ "bitflags 2.5.0", "fontdb", @@ -1230,7 +1230,7 @@ dependencies = [ [[package]] name = "cosmic-theme" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic.git#892d9003adf5e0f68791457b693ae98ea8468b81" +source = "git+https://github.com/pop-os/libcosmic.git#f1aad68b712650b3c697834e1043f3dcc943c9e7" dependencies = [ "almost", "cosmic-config", @@ -2492,7 +2492,7 @@ dependencies = [ [[package]] name = "iced" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic.git#892d9003adf5e0f68791457b693ae98ea8468b81" +source = "git+https://github.com/pop-os/libcosmic.git#f1aad68b712650b3c697834e1043f3dcc943c9e7" dependencies = [ "dnd", "iced_accessibility", @@ -2510,7 +2510,7 @@ dependencies = [ [[package]] name = "iced_accessibility" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic.git#892d9003adf5e0f68791457b693ae98ea8468b81" +source = "git+https://github.com/pop-os/libcosmic.git#f1aad68b712650b3c697834e1043f3dcc943c9e7" dependencies = [ "accesskit", "accesskit_winit", @@ -2519,7 +2519,7 @@ dependencies = [ [[package]] name = "iced_core" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic.git#892d9003adf5e0f68791457b693ae98ea8468b81" +source = "git+https://github.com/pop-os/libcosmic.git#f1aad68b712650b3c697834e1043f3dcc943c9e7" dependencies = [ "bitflags 2.5.0", "dnd", @@ -2539,7 +2539,7 @@ dependencies = [ [[package]] name = "iced_futures" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic.git#892d9003adf5e0f68791457b693ae98ea8468b81" +source = "git+https://github.com/pop-os/libcosmic.git#f1aad68b712650b3c697834e1043f3dcc943c9e7" dependencies = [ "futures", "iced_core", @@ -2552,7 +2552,7 @@ dependencies = [ [[package]] name = "iced_graphics" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic.git#892d9003adf5e0f68791457b693ae98ea8468b81" +source = "git+https://github.com/pop-os/libcosmic.git#f1aad68b712650b3c697834e1043f3dcc943c9e7" dependencies = [ "bitflags 2.5.0", "bytemuck", @@ -2576,7 +2576,7 @@ dependencies = [ [[package]] name = "iced_renderer" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic.git#892d9003adf5e0f68791457b693ae98ea8468b81" +source = "git+https://github.com/pop-os/libcosmic.git#f1aad68b712650b3c697834e1043f3dcc943c9e7" dependencies = [ "iced_graphics", "iced_tiny_skia", @@ -2588,7 +2588,7 @@ dependencies = [ [[package]] name = "iced_runtime" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic.git#892d9003adf5e0f68791457b693ae98ea8468b81" +source = "git+https://github.com/pop-os/libcosmic.git#f1aad68b712650b3c697834e1043f3dcc943c9e7" dependencies = [ "dnd", "iced_core", @@ -2600,7 +2600,7 @@ dependencies = [ [[package]] name = "iced_style" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic.git#892d9003adf5e0f68791457b693ae98ea8468b81" +source = "git+https://github.com/pop-os/libcosmic.git#f1aad68b712650b3c697834e1043f3dcc943c9e7" dependencies = [ "iced_core", "once_cell", @@ -2610,7 +2610,7 @@ dependencies = [ [[package]] name = "iced_tiny_skia" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic.git#892d9003adf5e0f68791457b693ae98ea8468b81" +source = "git+https://github.com/pop-os/libcosmic.git#f1aad68b712650b3c697834e1043f3dcc943c9e7" dependencies = [ "bytemuck", "cosmic-text", @@ -2627,7 +2627,7 @@ dependencies = [ [[package]] name = "iced_wgpu" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic.git#892d9003adf5e0f68791457b693ae98ea8468b81" +source = "git+https://github.com/pop-os/libcosmic.git#f1aad68b712650b3c697834e1043f3dcc943c9e7" dependencies = [ "bitflags 2.5.0", "bytemuck", @@ -2653,7 +2653,7 @@ dependencies = [ [[package]] name = "iced_widget" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic.git#892d9003adf5e0f68791457b693ae98ea8468b81" +source = "git+https://github.com/pop-os/libcosmic.git#f1aad68b712650b3c697834e1043f3dcc943c9e7" dependencies = [ "dnd", "iced_renderer", @@ -2669,7 +2669,7 @@ dependencies = [ [[package]] name = "iced_winit" version = "0.12.0" -source = "git+https://github.com/pop-os/libcosmic.git#892d9003adf5e0f68791457b693ae98ea8468b81" +source = "git+https://github.com/pop-os/libcosmic.git#f1aad68b712650b3c697834e1043f3dcc943c9e7" dependencies = [ "dnd", "iced_graphics", @@ -3147,7 +3147,7 @@ source = "git+https://gitlab.redox-os.org/redox-os/liblibc.git?branch=redox-epol [[package]] name = "libcosmic" version = "0.1.0" -source = "git+https://github.com/pop-os/libcosmic.git#892d9003adf5e0f68791457b693ae98ea8468b81" +source = "git+https://github.com/pop-os/libcosmic.git#f1aad68b712650b3c697834e1043f3dcc943c9e7" dependencies = [ "apply", "ashpd", diff --git a/src/terminal.rs b/src/terminal.rs index 09a3033..9e45792 100644 --- a/src/terminal.rs +++ b/src/terminal.rs @@ -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; diff --git a/src/terminal_box.rs b/src/terminal_box.rs index d68e79f..1f2194f 100644 --- a/src/terminal_box.rs +++ b/src/terminal_box.rs @@ -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; } } @@ -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 { @@ -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 { @@ -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); } }