Skip to content

Commit 2768da1

Browse files
authored
Make editor tab separator height configurable (lapce#3313)
1 parent c6d39ec commit 2768da1

File tree

4 files changed

+42
-4
lines changed

4 files changed

+42
-4
lines changed

defaults/settings.toml

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ icon-size = 0
8888
header-height = 36
8989
status-height = 25
9090
tab-min-width = 100
91+
tab-separator-height = "Content"
9192
scroll-width = 10
9293
drop-shadow-width = 0
9394
palette-width = 500

lapce-app/src/app.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ use crate::{
6969
WindowCommand,
7070
},
7171
config::{
72-
color::LapceColor, icon::LapceIcons, watcher::ConfigWatcher, LapceConfig,
72+
color::LapceColor, icon::LapceIcons, ui::TabSeparatorHeight,
73+
watcher::ConfigWatcher, LapceConfig,
7374
},
7475
db::LapceDb,
7576
debug::RunDebugMode,
@@ -731,14 +732,18 @@ fn editor_tab_header(
731732
.style(move |s| {
732733
s.items_center()
733734
.justify_center()
734-
.height_full()
735735
.border_left(if i.get() == 0 { 1.0 } else { 0.0 })
736736
.border_right(1.0)
737737
.border_color(config.get().color(LapceColor::LAPCE_BORDER))
738738
.padding_horiz(6.)
739739
.gap(6.)
740740
.grid()
741741
.grid_template_columns(vec![auto(), fr(1.), auto()])
742+
.apply_if(
743+
config.get().ui.tab_separator_height
744+
== TabSeparatorHeight::Full,
745+
|s| s.height_full(),
746+
)
742747
})
743748
};
744749

@@ -843,7 +848,7 @@ fn editor_tab_header(
843848
)
844849
.border_color(config.color(LapceColor::LAPCE_BORDER))
845850
})
846-
.style(|s| s.align_items(Some(AlignItems::Center)).height_full()),
851+
.style(|s| s.align_items(Some(AlignItems::Center))),
847852
empty()
848853
.style(move |s| {
849854
s.size_full()
@@ -895,7 +900,7 @@ fn editor_tab_header(
895900
.on_resize(move |rect| {
896901
layout_rect.set(rect);
897902
})
898-
.style(|s| s.height_full())
903+
.style(|s| s.height_full().flex_col().items_center().justify_center())
899904
.debug_name("Tab and Active Indicator")
900905
};
901906

lapce-app/src/config.rs

+8
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,14 @@ impl LapceConfig {
882882
.sorted()
883883
.collect(),
884884
}),
885+
("ui", "tab-separator-height") => Some(DropdownInfo {
886+
active_index: self.ui.tab_separator_height as usize,
887+
items: ui::TabSeparatorHeight::VARIANTS
888+
.iter()
889+
.map(|s| s.to_string())
890+
.sorted()
891+
.collect(),
892+
}),
885893
("terminal", "default-profile") => Some(DropdownInfo {
886894
active_index: self
887895
.terminal

lapce-app/src/config/ui.rs

+24
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ pub struct UIConfig {
3030
#[field_names(desc = "Set the minimum width for editor tab")]
3131
tab_min_width: usize,
3232

33+
#[field_names(
34+
desc = "Set whether the editor tab separator should be full height or the height of the content"
35+
)]
36+
pub tab_separator_height: TabSeparatorHeight,
37+
3338
#[field_names(desc = "Set the width for scroll bar")]
3439
scroll_width: usize,
3540

@@ -79,6 +84,25 @@ pub enum TabCloseButton {
7984
Off,
8085
}
8186

87+
#[derive(
88+
Debug,
89+
Clone,
90+
Copy,
91+
Deserialize,
92+
Serialize,
93+
Default,
94+
PartialEq,
95+
Eq,
96+
PartialOrd,
97+
Ord,
98+
strum_macros::VariantNames,
99+
)]
100+
pub enum TabSeparatorHeight {
101+
#[default]
102+
Content,
103+
Full,
104+
}
105+
82106
impl UIConfig {
83107
pub fn scale(&self) -> f64 {
84108
self.scale.max(0.1).min(4.0)

0 commit comments

Comments
 (0)