mirror of
https://github.com/orhun/systeroid
synced 2024-10-06 23:59:10 +00:00
refactor(tui): use more intuitive direction for section scroll
This commit is contained in:
parent
9c2383ad9d
commit
99c2394345
|
@ -267,8 +267,8 @@ impl<'a> App<'a> {
|
|||
}
|
||||
Command::Scroll(ScrollArea::Section, direction, _) => {
|
||||
match direction {
|
||||
Direction::Up => self.section_list.previous(),
|
||||
_ => self.section_list.next(),
|
||||
Direction::Right => self.section_list.next(),
|
||||
_ => self.section_list.previous(),
|
||||
}
|
||||
self.search();
|
||||
if self.parameter_list.items.is_empty() {
|
||||
|
|
|
@ -86,8 +86,8 @@ impl Command {
|
|||
Key::Char('b') => Command::Scroll(ScrollArea::List, Direction::Bottom, 0),
|
||||
Key::Left => Command::Scroll(ScrollArea::Documentation, Direction::Up, 1),
|
||||
Key::Right => Command::Scroll(ScrollArea::Documentation, Direction::Down, 1),
|
||||
Key::Char('`') => Command::Scroll(ScrollArea::Section, Direction::Up, 1),
|
||||
Key::Char('\t') => Command::Scroll(ScrollArea::Section, Direction::Down, 1),
|
||||
Key::Char('`') => Command::Scroll(ScrollArea::Section, Direction::Left, 1),
|
||||
Key::Char('\t') => Command::Scroll(ScrollArea::Section, Direction::Right, 1),
|
||||
Key::Char(':') => Command::UpdateInput(' '),
|
||||
Key::Char('/') => Command::Search,
|
||||
Key::Char('\n') => Command::Select,
|
||||
|
@ -164,8 +164,8 @@ mod tests {
|
|||
Key::Char('b') => Command::Scroll(ScrollArea::List, Direction::Bottom, 0),
|
||||
Key::Left => Command::Scroll(ScrollArea::Documentation, Direction::Up, 1),
|
||||
Key::Right => Command::Scroll(ScrollArea::Documentation, Direction::Down, 1),
|
||||
Key::Char('`') => Command::Scroll(ScrollArea::Section, Direction::Up, 1),
|
||||
Key::Char('\t') => Command::Scroll(ScrollArea::Section, Direction::Down, 1),
|
||||
Key::Char('`') => Command::Scroll(ScrollArea::Section, Direction::Left, 1),
|
||||
Key::Char('\t') => Command::Scroll(ScrollArea::Section, Direction::Right, 1),
|
||||
Key::Char(':') => Command::UpdateInput(' '),
|
||||
Key::Char('/') => Command::Search,
|
||||
Key::Char('\n') => Command::Select,
|
||||
|
|
|
@ -203,8 +203,8 @@ fn test_render_tui() -> Result<()> {
|
|||
|
||||
thread::sleep(Duration::from_millis(2000));
|
||||
app.tick();
|
||||
app.run_command(Command::Scroll(ScrollArea::Section, Direction::Up, 1))?;
|
||||
app.run_command(Command::Scroll(ScrollArea::Section, Direction::Up, 1))?;
|
||||
app.run_command(Command::Scroll(ScrollArea::Section, Direction::Left, 1))?;
|
||||
app.run_command(Command::Scroll(ScrollArea::Section, Direction::Left, 1))?;
|
||||
terminal.draw(|frame| render(frame, &mut app))?;
|
||||
assert_buffer(
|
||||
Buffer::with_lines(vec![
|
||||
|
@ -221,8 +221,8 @@ fn test_render_tui() -> Result<()> {
|
|||
]),
|
||||
terminal.backend(),
|
||||
)?;
|
||||
app.run_command(Command::Scroll(ScrollArea::Section, Direction::Down, 1))?;
|
||||
app.run_command(Command::Scroll(ScrollArea::Section, Direction::Down, 1))?;
|
||||
app.run_command(Command::Scroll(ScrollArea::Section, Direction::Right, 1))?;
|
||||
app.run_command(Command::Scroll(ScrollArea::Section, Direction::Right, 1))?;
|
||||
|
||||
app.input = Some(String::new());
|
||||
app.run_command(Command::Search)?;
|
||||
|
|
Loading…
Reference in a new issue