feat: add restore_last_cursor_position_exclusions config option
Defaults to just COMMIT_EDITMSG
This commit is contained in:
parent
cf7fc6af54
commit
51753cc87a
2 changed files with 9 additions and 0 deletions
|
|
@ -34,6 +34,7 @@ idle_actions: []const IdleAction = &default_actions,
|
||||||
idle_commands: ?[]const []const u8 = null, // a list of simple commands
|
idle_commands: ?[]const []const u8 = null, // a list of simple commands
|
||||||
enable_format_on_save: bool = false,
|
enable_format_on_save: bool = false,
|
||||||
restore_last_cursor_position: bool = true,
|
restore_last_cursor_position: bool = true,
|
||||||
|
restore_last_cursor_position_exclusions: []const []const u8 = &.{"COMMIT_EDITMSG"},
|
||||||
follow_cursor_on_buffer_switch: bool = false, //scroll cursor into view on buffer switch
|
follow_cursor_on_buffer_switch: bool = false, //scroll cursor into view on buffer switch
|
||||||
default_cursor: CursorShape = .default,
|
default_cursor: CursorShape = .default,
|
||||||
modes_can_change_cursor: bool = true,
|
modes_can_change_cursor: bool = true,
|
||||||
|
|
|
||||||
|
|
@ -559,7 +559,15 @@ const cmds = struct {
|
||||||
const view = self.get_view_for_file(f);
|
const view = self.get_view_for_file(f);
|
||||||
const have_editor_metadata = if (self.buffer_manager.get_buffer_for_file(f)) |_| true else false;
|
const have_editor_metadata = if (self.buffer_manager.get_buffer_for_file(f)) |_| true else false;
|
||||||
|
|
||||||
|
const basename = std.fs.path.basename(f);
|
||||||
|
var is_excluded = false;
|
||||||
|
for (tui.config().restore_last_cursor_position_exclusions) |exclusion| if (std.mem.eql(u8, basename, exclusion)) {
|
||||||
|
is_excluded = true;
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
|
||||||
if (tui.config().restore_last_cursor_position and
|
if (tui.config().restore_last_cursor_position and
|
||||||
|
!is_excluded and
|
||||||
view == null and
|
view == null and
|
||||||
!have_editor_metadata and
|
!have_editor_metadata and
|
||||||
line == null and
|
line == null and
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue