[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Only ignore double slashes after comp was initiated
[Thread Prev] | [Thread Next]
[Date Prev] | [Date Next]
- Subject: [PATCH] Only ignore double slashes after comp was initiated
- From: Rory Dudley <rory@xxxxxxx>
- Reply-to: rory@xxxxxxx
- Date: Mon, 16 Dec 2024 22:53:57 -0700
- To: lore@xxxxxxxxxxxx
This patch changes the check for and removal of a second slash by enabling it only after the user as initiated completion (i.e. presed Tab or Shift+Tab). This makes it possible to type two forward slashes (for instance, when typing or pasting in a URL) without having to go back and edit the buffer after the fact. --- src/buffer.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/buffer.rs b/src/buffer.rs index a9d925b..7ed05ba 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -565,7 +565,7 @@ pub fn getline( Key::Else(c) => { let mut buffer = buffer.lock().unwrap(); match buffer.last() { - Some(last) if *last == '/' && c == '/' => { + Some(last) if *comp_pos.lock().unwrap() != 0 && *last == '/' && c == '/' => { buffer.pop(); *pos.lock().unwrap() -= 1; print!("\u{8} \u{8}") @@ -577,7 +577,6 @@ pub fn getline( let trunc_width = UnicodeWidthStr::width(trunc.as_str()); buffer.insert(*pos.lock().unwrap(), c); *pos.lock().unwrap() += 1; - // *pos.lock().unwrap() += UnicodeWidthChar::width(c).unwrap_or(1); if *pos.lock().unwrap() == buffer.len() { print!("{}", c); } else { -- cheers!~ Rory
Archive administrator: postmaster AT dwarvish DOT org