editor tab minum width

This commit is contained in:
Dongdong Zhou 2022-05-24 10:41:09 +01:00
parent 7b0dcda389
commit 06456edf11
4 changed files with 12 additions and 2 deletions

View File

@ -8,6 +8,7 @@ font-family = ""
font-size = 13
header-height = 30
status-height = 25
tab-min-width = 100
activity-width = 50
scroll-width = 10
drop-shadow = true

View File

@ -170,6 +170,9 @@ pub struct UIConfig {
#[field_names(desc = "Set the height for status line")]
status_height: usize,
#[field_names(desc = "Set the minium width for editor tab")]
tab_min_width: usize,
#[field_names(desc = "Set the width for activity bar")]
activity_width: usize,
@ -203,6 +206,10 @@ pub fn status_height(&self) -> usize {
self.status_height.max(font_size)
}
pub fn tab_min_width(&self) -> usize {
self.tab_min_width
}
pub fn activity_width(&self) -> usize {
self.activity_width
}

View File

@ -386,7 +386,8 @@ fn layout(
.build()
.unwrap();
let text_size = text_layout.size();
let width = (text_size.width + height * 2.0).max(100.0);
let width = (text_size.width + height * 2.0)
.max(data.config.ui.tab_min_width() as f64);
let close_size = 24.0;
let inflate = (height - close_size) / 2.0;
let tab_rect = TabRect {

View File

@ -953,7 +953,8 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, env: &Env) {
if ctx.is_hot() {
ctx.fill(
rect,
data.config.get_color_unchecked(LapceTheme::PANEL_HOVERED),
data.config
.get_color_unchecked(LapceTheme::EDITOR_CURRENT_LINE),
);
}