feat: add restore_last_cursor_position config option (default true)

This commit is contained in:
CJ van den Berg 2025-04-28 11:02:54 +02:00
parent 392cb2c764
commit 993add1a43
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 6 additions and 1 deletions

View file

@ -17,6 +17,7 @@ inline_diagnostics: bool = true,
animation_min_lag: usize = 0, //milliseconds
animation_max_lag: usize = 150, //milliseconds
enable_format_on_save: bool = false,
restore_last_cursor_position: bool = true,
default_cursor: []const u8 = "default",
indent_size: usize = 4,

View file

@ -384,7 +384,11 @@ const cmds = struct {
const same_file = if (self.get_active_file_path()) |fp| std.mem.eql(u8, fp, f) else false;
const have_editor_metadata = if (self.buffer_manager.get_buffer_for_file(f)) |_| true else false;
if (!same_file and !have_editor_metadata and line == null) {
if (tui.config().restore_last_cursor_position and
!same_file and
!have_editor_metadata and
line == null)
{
const ctx_: struct {
allocator: std.mem.Allocator,
from: tp.pid,