diff --git a/src/config.zig b/src/config.zig index 3bd60eb..2e62b42 100644 --- a/src/config.zig +++ b/src/config.zig @@ -48,6 +48,7 @@ pane_right_style: WidgetStyle = .bar_left, centered_view: bool = false, centered_view_width: usize = 145, +centered_view_min_screen_width: usize = 145, lsp_output: enum { quiet, verbose } = .quiet, diff --git a/src/tui/mainview.zig b/src/tui/mainview.zig index d822bde..f395d05 100644 --- a/src/tui/mainview.zig +++ b/src/tui/mainview.zig @@ -195,7 +195,10 @@ pub fn update_panes_layout(self: *Self) !void { const centered_view_width = tui.config().centered_view_width; const screen_width = tui.screen().w; const need_padding = screen_width > centered_view_width; - if (need_padding and tui.config().centered_view and self.views.widgets.items.len == 1) { + const have_vsplits = self.views.widgets.items.len > 1; + const have_min_screen_width = screen_width > tui.config().centered_view_min_screen_width; + const centered_view = need_padding and tui.config().centered_view and !have_vsplits and have_min_screen_width; + if (centered_view) { const padding = (screen_width - centered_view_width) / 2; try self.panes.add(try self.create_padding_pane(padding, .pane_left)); try self.panes.add(self.views_widget);