summaryrefslogtreecommitdiffstats
path: root/src/buffer.rs
diff options
context:
space:
mode:
authorRory Dudley2024-12-16 22:53:57 -0700
committerRory Dudley2024-12-17 03:15:43 -0700
commit2af8e55e87c172d707a728a9739f800048e1ed0a (patch)
tree5b009e1dc02dd893d022961372c4ca934b3723a4 /src/buffer.rs
parent960b0123ee202aef0cfcd294d56af1713cb91de1 (diff)
downloaddwarvish-2af8e55e87c172d707a728a9739f800048e1ed0a.tar.gz
Only ignore double slashes after comp was initiated
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. Signed-off-by: Rory Dudley <rory@netc.lu>
Diffstat (limited to 'src/buffer.rs')
-rw-r--r--src/buffer.rs3
1 files changed, 1 insertions, 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 {