Skip to content

Commit

Permalink
feat(ui): Add config setting for showing tabs (#1755)
Browse files Browse the repository at this point in the history
* Add config setting for showing tabs

* Added semicolon
  • Loading branch information
digital-cuttlefish committed Mar 1, 2024
1 parent 515f78f commit 9933220
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions atuin-client/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@
## amount of commands in your history.
# show_help = true

## Configure whether or not to show tabs for search and inspect
# show_tabs = true

## Defaults to true. This matches history against a set of default regex, and will not save it if we get a match. Defaults include
## 1. AWS key id
## 2. Github pat (old and new)
Expand Down
2 changes: 2 additions & 0 deletions atuin-client/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ pub struct Settings {
pub show_preview: bool,
pub max_preview_height: u16,
pub show_help: bool,
pub show_tabs: bool,
pub exit_mode: ExitMode,
pub keymap_mode: KeymapMode,
pub keymap_mode_shell: KeymapMode,
Expand Down Expand Up @@ -593,6 +594,7 @@ impl Settings {
.set_default("show_preview", false)?
.set_default("max_preview_height", 4)?
.set_default("show_help", true)?
.set_default("show_tabs", true)?
.set_default("invert", false)?
.set_default("exit_mode", "return-original")?
.set_default("word_jump_mode", "emacs")?
Expand Down
5 changes: 3 additions & 2 deletions atuin/src/command/client/search/interactive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ impl State {
1
};
let show_help = settings.show_help && (!compact || f.size().height > 1);
let show_tabs = settings.show_tabs;
let chunks = Layout::default()
.direction(Direction::Vertical)
.margin(0)
Expand All @@ -532,13 +533,13 @@ impl State {
Constraint::Length(1 + border_size), // input
Constraint::Min(1), // results list
Constraint::Length(preview_height), // preview
Constraint::Length(1), // tabs
Constraint::Length(if show_tabs { 1 } else { 0 }), // tabs
Constraint::Length(if show_help { 1 } else { 0 }), // header (sic)
]
} else {
[
Constraint::Length(if show_help { 1 } else { 0 }), // header
Constraint::Length(1), // tabs
Constraint::Length(if show_tabs { 1 } else { 0 }), // tabs
Constraint::Min(1), // results list
Constraint::Length(1 + border_size), // input
Constraint::Length(preview_height), // preview
Expand Down

0 comments on commit 9933220

Please sign in to comment.