summaryrefslogtreecommitdiffstats
path: root/src/tree
diff options
context:
space:
mode:
authorCanop <cano.petrole@gmail.com>2020-11-13 13:26:23 +0100
committerCanop <cano.petrole@gmail.com>2020-11-13 13:26:23 +0100
commit2fce268388ea71d8b4ed98facde6ce6c6b1d6a09 (patch)
treea8408e9d5ddfe308a32525b6cbf35c59ed6cf67b /src/tree
parent15c74c836b6b6e2a06d71358cca39bdb758148b0 (diff)
`:line_up` and `:line_down` accept an optional count as argument
This allows verbs like this: [[verbs]] key = "ctrl-u" invocation = "up4" execution = ":line_up 4" leave_broot = false Fix #301
Diffstat (limited to 'src/tree')
-rw-r--r--src/tree/tree.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/tree/tree.rs b/src/tree/tree.rs
index 465e9cf..8ac8a79 100644
--- a/src/tree/tree.rs
+++ b/src/tree/tree.rs
@@ -145,7 +145,7 @@ impl Tree {
///
/// For example the following one if dy is 1.
pub fn move_selection(&mut self, dy: i32, page_height: i32) {
- // only work for +1 or -1
+ // FIXME may not work well if dy is too big
let l = self.lines.len();
loop {
self.selection = (self.selection + ((l as i32) + dy) as usize) % l;
@@ -158,7 +158,6 @@ impl Tree {
let sel = self.selection as i32;
if l > page_height {
if dy < 0 {
- // -1
if sel == l - 1 {
// cycling
self.scroll = l - page_height;
@@ -166,7 +165,6 @@ impl Tree {
self.scroll = (self.scroll + 2 * dy).max(0);
}
} else {
- // +1
if sel == 0 {
// cycling brought us back to top
self.scroll = 0;