Compare commits

...

2 commits

Author SHA1 Message Date
xoxorwr
a93b905bdd Add auto_open_panel_for_diagnostics 2026-02-21 17:32:26 +01:00
Ingo Lohmar
3f0578a909 fix: scroll_view_center_cycle no-op in "dead" area, fix bottom scroll offset
Testing for precise rows leads to a "dead" area if cursor row is in topmost
half-screen of a file.  Less strict comparison makes the command useful in
that area as well.
2026-02-21 17:26:38 +01:00
3 changed files with 7 additions and 3 deletions

View file

@ -59,6 +59,7 @@ show_bottom_bar_grip: bool = true,
show_scrollbars: bool = true,
show_fileicons: bool = true,
show_local_diagnostics_in_panel: bool = false,
auto_open_panel_for_diagnostics: bool = true,
scrollbar_auto_hide: bool = true,
scroll_step_vertical: usize = 3,
scroll_step_horizontal: usize = 5,

View file

@ -3057,9 +3057,9 @@ pub const Editor = struct {
pub fn scroll_view_center_cycle(self: *Self, _: Context) Result {
const scroll_cursor_min_border_distance = Buffer.View.scroll_cursor_min_border_distance;
const cursor_row = self.get_primary().cursor.row;
return if (cursor_row == self.view.row + scroll_cursor_min_border_distance)
return if (cursor_row <= self.view.row + scroll_cursor_min_border_distance)
self.scroll_view_bottom(.{})
else if (cursor_row == self.view.row + self.view.rows / 2)
else if (cursor_row <= self.view.row + self.view.rows / 2)
self.scroll_view_top(.{})
else
self.scroll_view_offset(self.view.rows / 2);
@ -3074,7 +3074,7 @@ pub const Editor = struct {
pub fn scroll_view_bottom(self: *Self, _: Context) Result {
const scroll_cursor_min_border_distance = Buffer.View.scroll_cursor_min_border_distance;
return self.scroll_view_offset(if (self.view.rows > scroll_cursor_min_border_distance) self.view.rows -| scroll_cursor_min_border_distance + 1 else 0);
return self.scroll_view_offset(self.view.rows -| (scroll_cursor_min_border_distance + 1));
}
pub const scroll_view_bottom_meta: Meta = .{};

View file

@ -1089,6 +1089,9 @@ const cmds = struct {
if (!tui.config().show_local_diagnostics_in_panel)
return;
}
if (!self.is_panel_view_showing(filelist_view) and !tui.config().auto_open_panel_for_diagnostics) {
return;
}
try self.add_find_in_files_result(
.diagnostics,
file_path,