ListEditor: better NavResult in dn(): avoid jumping when calling dn on lowest level
This commit is contained in:
parent
fdd5e925b1
commit
73eec59f58
2 changed files with 12 additions and 5 deletions
|
@ -130,7 +130,7 @@ where ItemEditor: TerminalTreeEditor + ?Sized + Send + Sync + 'static,
|
||||||
mode: new_cur.leaf_mode,
|
mode: new_cur.leaf_mode,
|
||||||
idx: None
|
idx: None
|
||||||
});
|
});
|
||||||
TreeNavResult::Exit
|
TreeNavResult::Continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,12 +328,12 @@ where ItemEditor: TerminalTreeEditor + ?Sized + Send + Sync + 'static,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
TreeNavResult::Continue
|
||||||
}
|
}
|
||||||
ListCursorMode::Modify => {
|
ListCursorMode::Modify => {
|
||||||
self.get_item().unwrap().write().unwrap().dn();
|
self.get_item().unwrap().write().unwrap().dn()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TreeNavResult::Continue
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pxev(&mut self) -> TreeNavResult {
|
fn pxev(&mut self) -> TreeNavResult {
|
||||||
|
|
|
@ -210,10 +210,13 @@ write::
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TerminalEvent::Input(Event::Key(Key::Up)) => { te.up(); }
|
TerminalEvent::Input(Event::Key(Key::Up)) => { te.up(); }
|
||||||
TerminalEvent::Input(Event::Key(Key::Down)) => { te.dn(); te.goto_home(); }
|
TerminalEvent::Input(Event::Key(Key::Down)) => {
|
||||||
|
if te.dn() == TreeNavResult::Continue {
|
||||||
|
te.goto_home();
|
||||||
|
}
|
||||||
|
}
|
||||||
TerminalEvent::Input(Event::Key(Key::Home)) => {
|
TerminalEvent::Input(Event::Key(Key::Home)) => {
|
||||||
if te.goto_home() == TreeNavResult::Exit {
|
if te.goto_home() == TreeNavResult::Exit {
|
||||||
|
|
||||||
te.goto_home();
|
te.goto_home();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -334,6 +337,10 @@ write::
|
||||||
status_chars.push(TerminalAtom::new(c, TerminalStyle::fg_color((200, 200, 20))));
|
status_chars.push(TerminalAtom::new(c, TerminalStyle::fg_color((200, 200, 20))));
|
||||||
}
|
}
|
||||||
status_chars.push(TerminalAtom::new(':', TerminalStyle::fg_color((120, 80, 80)).add(TerminalStyle::bold(true))));
|
status_chars.push(TerminalAtom::new(':', TerminalStyle::fg_color((120, 80, 80)).add(TerminalStyle::bold(true))));
|
||||||
|
} else {
|
||||||
|
for c in "Press <DN> to enter".chars() {
|
||||||
|
status_chars.push(TerminalAtom::new(c, TerminalStyle::fg_color((200, 200, 20))));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue