summaryrefslogtreecommitdiffstats
path: root/src/command
diff options
context:
space:
mode:
authorCanop <cano.petrole@gmail.com>2021-08-03 20:49:25 +0200
committerCanop <cano.petrole@gmail.com>2021-08-04 13:25:29 +0200
commitc68e7f3bd12ad14214e074d90c1640d8b2536801 (patch)
tree797741ea2fae240960a9aa03ce3dadb79cb29856 /src/command
parent3123abc98b2f2e8e52da3ecce96c690341e75c11 (diff)
improve scrolling behaviors
Especially move the selection when you're at one end and you try to scroll the blocked way. Fix #419
Diffstat (limited to 'src/command')
-rw-r--r--src/command/completion.rs2
-rw-r--r--src/command/scroll.rs6
2 files changed, 7 insertions, 1 deletions
diff --git a/src/command/completion.rs b/src/command/completion.rs
index 0e7090d..3964a92 100644
--- a/src/command/completion.rs
+++ b/src/command/completion.rs
@@ -46,7 +46,7 @@ impl Completions {
}
let mut iter = completions.iter();
let mut common: &str = match iter.next() {
- Some(s) => &s,
+ Some(s) => s,
_ => { return Self::None; }
};
for c in iter {
diff --git a/src/command/scroll.rs b/src/command/scroll.rs
index 73928bf..5734c25 100644
--- a/src/command/scroll.rs
+++ b/src/command/scroll.rs
@@ -12,6 +12,12 @@ impl ScrollCommand {
Self::Pages(n) => n * page_height as i32,
}
}
+ pub fn is_up(self) -> bool {
+ match self {
+ Self::Lines(n) => n < 0,
+ Self::Pages(n) => n < 0,
+ }
+ }
/// compute the new scroll value
pub fn apply(
self,