summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author哇呜哇呜呀咦耶 <pingao777@gmail.com>2022-11-02 21:35:23 +0800
committerGitHub <noreply@github.com>2022-11-02 14:35:23 +0100
commitf334415d57c8f7cbca63ad0ecd2c263cbdd8ff2a (patch)
tree0b2d23a0cfa354c0917e4acc6f5031a95d174c53
parent8f293f584fcaefb6728e5293aa5762c4b62a5608 (diff)
fix(search): allow terminating char to clear search term (#1853)
* allow terminating char to clear search term * format code
-rw-r--r--zellij-server/src/tab/mod.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/zellij-server/src/tab/mod.rs b/zellij-server/src/tab/mod.rs
index 16d954ed6..9f29fca59 100644
--- a/zellij-server/src/tab/mod.rs
+++ b/zellij-server/src/tab/mod.rs
@@ -2650,8 +2650,10 @@ impl Tab {
pub fn update_search_term(&mut self, buf: Vec<u8>, client_id: ClientId) -> Result<()> {
if let Some(active_pane) = self.get_active_pane_or_floating_pane_mut(client_id) {
- // It only allows printable unicode, delete and backspace keys.
- let is_updatable = buf.iter().all(|u| matches!(u, 0x20..=0x7E | 0x08 | 0x7F));
+ // It only allows terminating char(\0), printable unicode, delete and backspace keys.
+ let is_updatable = buf
+ .iter()
+ .all(|u| matches!(u, 0x00 | 0x20..=0x7E | 0x08 | 0x7F));
if is_updatable {
let s = str::from_utf8(&buf).with_context(|| {
format!("failed to update search term to '{buf:?}' for client {client_id}")