aboutsummaryrefslogtreecommitdiff
path: root/src/app/input
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-07-17 03:26:33 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-07-17 03:26:33 +0300
commit8d2af4e046c2a95dfc54aafd6f88da12389d76e8 (patch)
tree5643a1ec2f04b150d465817f2896ada4f2fbc46b /src/app/input
parent6f9ac7c108e22510e1b27e3242477fac660fa4cb (diff)
perf: adopt libghostty integration improvements
refs #276
Diffstat (limited to 'src/app/input')
-rw-r--r--src/app/input/copy_mode.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/app/input/copy_mode.rs b/src/app/input/copy_mode.rs
index f6c322ea..e6c0d074 100644
--- a/src/app/input/copy_mode.rs
+++ b/src/app/input/copy_mode.rs
@@ -1,5 +1,4 @@
use crossterm::event::{KeyCode, KeyEventKind, KeyModifiers};
-use unicode_width::UnicodeWidthChar;
use crate::{
app::{
@@ -941,7 +940,7 @@ fn last_character_col(text: &str) -> Option<u16> {
let mut col = 0u16;
let mut last_col = None;
for ch in text.chars() {
- let width = UnicodeWidthChar::width(ch).unwrap_or(1) as u16;
+ let width = u16::from(crate::ghostty::unicode_codepoint_width(ch as u32));
if width > 0 {
last_col = Some(col);
col = col.saturating_add(width);
@@ -951,7 +950,7 @@ fn last_character_col(text: &str) -> Option<u16> {
}
fn char_cell_width(ch: char) -> u16 {
- UnicodeWidthChar::width(ch).unwrap_or(1).max(1) as u16
+ u16::from(crate::ghostty::unicode_codepoint_width(ch as u32)).max(1)
}
fn copy_mode_page_lines(height: u16, half_page: bool) -> usize {
@@ -1703,6 +1702,11 @@ mod tests {
submit_copy_search(&mut app, '?', "000000");
assert!(copy_mode_offset_from_bottom(&app, pane_id) > 0);
+ let copy_mode = app.state.copy_mode.as_ref().expect("copy mode");
+ assert_eq!(
+ copy_mode_viewport_top_row(&app, pane_id) + usize::from(copy_mode.cursor_row),
+ 0
+ );
let runtime = app
.state
.runtime_for_pane_in_workspace(&app.terminal_runtimes, 0, pane_id)