Skip to content

Commit a2af82e

Browse files
authored
chore(deps): bump beamterm to 0.17.0 (#166)
1 parent 2030bc3 commit a2af82e

3 files changed

Lines changed: 11 additions & 45 deletions

File tree

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ ratatui = { version = "0.30", default-features = false, features = ["all-widgets
4444
console_error_panic_hook = "0.1.7"
4545
thiserror = "2.0.18"
4646
bitvec = { version = "1.0.1", default-features = false, features = ["alloc", "std"] }
47-
beamterm-renderer = "0.16.0"
47+
beamterm-renderer = "0.17.0"
4848
unicode-width = "0.2.2"
4949

5050
[dev-dependencies]

src/backend/webgl2.rs

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ impl WebGl2Backend {
373373
(None, None)
374374
};
375375

376-
let mut backend = Self {
376+
Ok(Self {
377377
beamterm,
378378
cursor_position: None,
379379
options,
@@ -384,12 +384,7 @@ impl WebGl2Backend {
384384
hyperlink_state,
385385
_user_mouse_handler: None,
386386
_user_key_handler: None,
387-
};
388-
389-
// Convert handler metrics from physical pixels to CSS pixels
390-
backend.update_mouse_handler_metrics();
391-
392-
Ok(backend)
387+
})
393388
}
394389

395390
/// Returns the options objects used to create this backend.
@@ -422,8 +417,6 @@ impl WebGl2Backend {
422417
// Reset hyperlink cursor state when canvas is resized
423418
self.cursor_over_hyperlink = false;
424419

425-
self.update_mouse_handler_metrics();
426-
427420
Ok(())
428421
}
429422

@@ -444,32 +437,9 @@ impl WebGl2Backend {
444437
pub fn set_size(&mut self, width: u32, height: u32) -> Result<(), Error> {
445438
self.beamterm.resize(width as i32, height as i32)?;
446439
self.cursor_over_hyperlink = false;
447-
self.update_mouse_handler_metrics();
448440
Ok(())
449441
}
450442

451-
/// Updates metrics on externally-managed mouse handlers after resize or DPR changes.
452-
///
453-
/// Beamterm's `Terminal::resize()` only updates its own internal mouse handler.
454-
/// The user and hyperlink handlers created by ratzilla need their metrics updated
455-
/// separately.
456-
fn update_mouse_handler_metrics(&mut self) {
457-
let (cols, rows) = self.beamterm.terminal_size();
458-
let (phys_w, phys_h) = self.beamterm.cell_size();
459-
let dpr = window()
460-
.map(|w| w.device_pixel_ratio() as f32)
461-
.unwrap_or(1.0);
462-
let cell_width = phys_w as f32 / dpr;
463-
let cell_height = phys_h as f32 / dpr;
464-
465-
if let Some(handler) = &mut self._user_mouse_handler {
466-
handler.update_metrics(cols, rows, cell_width, cell_height);
467-
}
468-
if let Some(handler) = &mut self._hyperlink_mouse_handler {
469-
handler.update_metrics(cols, rows, cell_width, cell_height);
470-
}
471-
}
472-
473443
/// Checks if the canvas size matches the display size and resizes it if necessary.
474444
fn check_canvas_resize(&mut self) -> Result<(), Error> {
475445
// Compare CSS display size against beamterm's stored logical size.
@@ -924,10 +894,6 @@ impl WebEventHandler for WebGl2Backend {
924894

925895
self._user_mouse_handler = Some(mouse_handler);
926896

927-
// TerminalMouseHandler is constructed with physical pixel metrics;
928-
// convert to CSS pixels so coordinate translation is correct on HiDPI.
929-
self.update_mouse_handler_metrics();
930-
931897
Ok(())
932898
}
933899

0 commit comments

Comments
 (0)