Fixed some weirdness in the logic for scrolling through command history

This commit is contained in:
2026-02-19 20:12:51 -05:00
parent 1d4c177c64
commit 959ea9346a
4 changed files with 73 additions and 84 deletions

View File

@@ -359,12 +359,13 @@ impl LineBuf {
}
pub fn set_hint(&mut self, hint: Option<String>) {
if let Some(hint) = hint {
let hint = hint.strip_prefix(&self.buffer).unwrap(); // If this ever panics, I will eat my hat
if !hint.is_empty() {
self.hint = Some(hint.to_string())
} else {
self.hint = None
}
if let Some(hint) = hint.strip_prefix(&self.buffer) {
if !hint.is_empty() {
self.hint = Some(hint.to_string())
} else {
self.hint = None
}
}
} else {
self.hint = None
}