removed mark related code

This commit is contained in:
Robert Burnett 2025-05-13 06:48:38 -05:00 committed by CJ van den Berg
parent acded15af8
commit fcbb377237
4 changed files with 25 additions and 179 deletions

View file

@ -5138,58 +5138,6 @@ pub const Editor = struct {
std.mem.sort(Diagnostic, self.diagnostics.items, {}, less_fn);
}
pub fn goto_global_mark(self: *Self, ctx: Context) Result {
try self.send_editor_jump_source();
var mark_id: u8 = 0;
if (!try ctx.args.match(.{tp.extract(&mark_id)}))
return error.InvalidGotoLineArgument;
const location = tui.get_global_marks()[mark_id] orelse return error.UndefinedGlobalMark;
_ = location;
//TODO: figure out how to goto location in another file
}
pub const goto_global_mark_meta: Meta = .{ .arguments = &.{.integer} };
pub fn set_global_mark(self: *Self, ctx: Context) Result {
var mark_id: u8 = 0;
if (!try ctx.args.match(.{tp.extract(&mark_id)}))
return error.InvalidGotoLineArgument;
const primary = self.get_primary();
const buf = self.buffer orelse return error.Stop;
var location: tui.GlobalMarkLocation = .{ .row = primary.cursor.row, .col = primary.cursor.col };
std.mem.copyForwards(u8, &location.filepath, buf.file_path);
tui.get_global_marks()[mark_id] = location;
}
pub const set_global_mark_meta: Meta = .{ .arguments = &.{.integer} };
pub fn goto_mark(self: *Self, ctx: Context) Result {
try self.send_editor_jump_source();
var mark_id: u8 = 0;
if (!try ctx.args.match(.{tp.extract(&mark_id)}))
return error.InvalidGotoLineArgument;
const buf = self.buffer orelse return error.Stop;
const location = buf.marks[mark_id] orelse return error.UndefinedMark;
const root = self.buf_root() catch return;
self.cancel_all_selections();
const primary = self.get_primary();
try primary.cursor.move_to(root, location.row, location.col, self.metrics);
self.clamp();
try self.send_editor_jump_destination();
}
pub const goto_mark_meta: Meta = .{ .arguments = &.{.integer} };
pub fn set_mark(self: *Self, ctx: Context) Result {
var mark_id: u8 = 0;
if (!try ctx.args.match(.{tp.extract(&mark_id)}))
return error.InvalidGotoLineArgument;
const primary = self.get_primary();
const location: Buffer.MarkLocation = .{ .row = primary.cursor.row, .col = primary.cursor.col };
var buf = self.buffer orelse return error.Stop;
buf.marks[mark_id] = location;
}
pub const set_mark_meta: Meta = .{ .arguments = &.{.integer} };
pub fn goto_line(self: *Self, ctx: Context) Result {
try self.send_editor_jump_source();
var line: usize = 0;

View file

@ -20,12 +20,6 @@ const MainView = @import("mainview.zig");
const Allocator = std.mem.Allocator;
pub const GlobalMarkLocation = struct {
row: usize,
col: usize,
filepath: [512]u8 = .{0} ** 512,
};
allocator: Allocator,
rdr_: renderer,
config_: @import("config"),
@ -68,7 +62,6 @@ fontfaces_: std.ArrayListUnmanaged([]const u8) = .{},
enable_mouse_idle_timer: bool = false,
query_cache_: *syntax.QueryCache,
frames_rendered_: usize = 0,
global_marks: [256]?GlobalMarkLocation = .{null} ** 256,
const keepalive = std.time.us_per_day * 365; // one year
const idle_frames = 0;