Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions crates/forktty-ui-gtk/src/gtk_app/terminal_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,11 @@ pub(super) fn translate_gtk_key(
return Some(TerminalInput::Bytes(text.as_bytes().to_vec()));
}
}
if let Some(ch) = key.to_unicode() {
GhosttyKeySpec {
key: GhosttyKey::Char(ch),
ctrl,
alt,
}
} else {
return None;
let ch = key.to_unicode()?;
GhosttyKeySpec {
key: GhosttyKey::Char(ch),
ctrl,
alt,
}
}
};
Expand Down
11 changes: 9 additions & 2 deletions crates/forktty-ui-gtk/src/gtk_app/terminal_search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,17 @@ fn for_each_char_match_start(
return;
}
let mut index = 0;
let first_needle = needle[0];
while index + needle.len() <= haystack.len() {
let matched = haystack[index..index + needle.len()]
// Fast path: avoid slice slicing and zipping iterator overhead for the vast
// majority of positions where the first character doesn't even match.
if !chars_eq_ignore_case(haystack[index], first_needle) {
index += 1;
continue;
}
let matched = haystack[index + 1..index + needle.len()]
.iter()
.zip(needle)
.zip(&needle[1..])
.all(|(a, b)| chars_eq_ignore_case(*a, *b));
if matched {
if !visit(index) {
Expand Down
1 change: 1 addition & 0 deletions crates/forktty-ui-gtk/src/socket_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ use help::{
use hooks::event::*;
#[cfg(test)]
use hooks::handle_hooks;
#[cfg(feature = "gtk-ghostty")]
pub(crate) use hooks::hook_setup_reminder_message;
#[cfg(test)]
use hooks::install::*;
Expand Down
Loading