feat(ui): Add config setting for showing tabs (#1755)

* Add config setting for showing tabs

* Added semicolon
This commit is contained in:
Anderson 2024-03-01 09:57:18 -05:00 committed by GitHub
parent 515f78fa4c
commit 9933220dac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 2 deletions

View File

@ -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)

View File

@ -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,
@ -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")?

View File

@ -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)
@ -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