Skip to content

Commit

Permalink
tab for nav
Browse files Browse the repository at this point in the history
  • Loading branch information
adgaultier committed Jan 10, 2025
1 parent f2a29b0 commit 1a2d633
Showing 1 changed file with 33 additions and 36 deletions.
69 changes: 33 additions & 36 deletions tamanoir-tui/src/section/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl Sections {

fn render_footer_help(&self, frame: &mut Frame, block: Rect) {
let message = {
let mut base_message = vec![Span::from("󰘶 +  ").bold(), Span::from(" Nav")];
let mut base_message = vec![Span::from(" ").bold(), Span::from(" Nav")];
if self.shell_percentage_split.is_some() {
base_message.extend([
Span::from(" | "),
Expand Down Expand Up @@ -166,58 +166,55 @@ impl Sections {
_ => {}
}
}
} else if key_event.modifiers.contains(KeyModifiers::SHIFT) {
} else {
match key_event.code {
KeyCode::Char('j') | KeyCode::Down => match self.focused_section {
KeyCode::Tab => match self.focused_section {
FocusedSection::Sessions => self.focused_section = FocusedSection::KeyLogger,
FocusedSection::KeyLogger => {
if let Some(_) = self.shell_percentage_split {
self.focused_section = FocusedSection::Shell
} else {
self.focused_section = FocusedSection::Sessions
}
}
FocusedSection::Shell => self.focused_section = FocusedSection::Sessions,
_ => {}
},
KeyCode::Char('k') | KeyCode::Up => match self.focused_section {
FocusedSection::Shell => {
KeyCode::BackTab => match self.focused_section {
FocusedSection::KeyLogger => self.focused_section = FocusedSection::Sessions,
FocusedSection::Shell => self.focused_section = FocusedSection::KeyLogger,
FocusedSection::Sessions => {
if let Some(_) = self.shell_percentage_split {
self.focused_section = FocusedSection::Shell
} else {
self.focused_section = FocusedSection::KeyLogger
}
}
_ => {}
},
KeyCode::Char('h') | KeyCode::Left => match self.focused_section {
FocusedSection::KeyLogger | FocusedSection::Shell => {
self.focused_section = FocusedSection::Sessions
}
_ => {}
},
KeyCode::Char('l') | KeyCode::Right => match self.focused_section {
FocusedSection::Sessions => self.focused_section = FocusedSection::KeyLogger,
_ => {}
},
_ => {}
}
} else {
match self.focused_section {
FocusedSection::Sessions => match key_event.code {
KeyCode::Enter => {}
KeyCode::Char('j') | KeyCode::Down => self.session_section.next_row(),
KeyCode::Char('k') | KeyCode::Up => self.session_section.previous_row(),
KeyCode::Char('s') => {
self.shell_percentage_split = if let Some(_) = self.shell_percentage_split {
None
} else {
Some(20)
};
_ => match self.focused_section {
FocusedSection::Sessions => match key_event.code {
KeyCode::Enter => {}
KeyCode::Char('j') | KeyCode::Down => self.session_section.next_row(),
KeyCode::Char('k') | KeyCode::Up => self.session_section.previous_row(),
KeyCode::Char('s') => {
self.shell_percentage_split =
if let Some(_) = self.shell_percentage_split {
None
} else {
Some(20)
};
}
_ => {}
},
FocusedSection::Shell => {
self.shell_section
.handle_keys(key_event, shell_client)
.await?;
}

_ => {}
},
FocusedSection::Shell => {
self.shell_section
.handle_keys(key_event, shell_client)
.await?;
}

_ => {}
}
}

Expand Down

0 comments on commit 1a2d633

Please sign in to comment.