Skip to content

Commit

Permalink
Make split/close all buttons configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmoulton committed Jun 12, 2024
1 parent 0376f42 commit 120c8a4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions defaults/settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,4 @@ tab-close-button = "Right"
open-editors-visible = true
tab-bar-visible = true
tab-forward-back-visible = true
tab-split-closeall-visible = true
15 changes: 7 additions & 8 deletions lapce-app/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -957,16 +957,14 @@ fn editor_tab_header(
.on_resize(move |rect| {
size.set(rect.size());
})
.debug_name("Next/Previoius Tab Buttons")
.style(move |s| {
s.items_center()
.apply_if(!config.get().ui.tab_forward_back_visible, |s| {
s.hide()
})
}),
.style(|s| s.items_center())
.debug_name("Next/Previoius Tab Buttons"),
)
})
.style(|s| s.flex_shrink(0.)),
.style(move |s| {
s.apply_if(!config.get().ui.tab_forward_back_visible, |s| s.hide())
.flex_shrink(0.)
}),
container(
scroll({
dyn_stack(items, key, view_fn)
Expand Down Expand Up @@ -1074,6 +1072,7 @@ fn editor_tab_header(
.apply_if(scroll_offset.x1 < content_size.width, |s| {
s.margin_left(0.)
})
.apply_if(!config.get().ui.tab_split_closeall_visible, |s| s.hide())
}),
))
.style(move |s| {
Expand Down
3 changes: 3 additions & 0 deletions lapce-app/src/config/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ pub struct UIConfig {

#[field_names(desc = "Display the Forward/Back buttons in the tab bar")]
pub tab_forward_back_visible: bool,

#[field_names(desc = "Display the Split/Close All buttons in the tab bar")]
pub tab_split_closeall_visible: bool,
}

#[derive(
Expand Down

0 comments on commit 120c8a4

Please sign in to comment.