removed mark related code
This commit is contained in:
parent
acded15af8
commit
fcbb377237
4 changed files with 25 additions and 179 deletions
|
@ -27,11 +27,6 @@ pub const Metrics = struct {
|
|||
pub const egc_last_func = *const fn (self: Metrics, egcs: []const u8) []const u8;
|
||||
};
|
||||
|
||||
pub const MarkLocation = struct {
|
||||
row: usize,
|
||||
col: usize,
|
||||
};
|
||||
|
||||
arena: std.heap.ArenaAllocator,
|
||||
allocator: Allocator,
|
||||
external_allocator: Allocator,
|
||||
|
@ -59,8 +54,6 @@ file_type_name: ?[]const u8 = null,
|
|||
file_type_icon: ?[]const u8 = null,
|
||||
file_type_color: ?u24 = null,
|
||||
|
||||
marks: [256]?MarkLocation = .{null} ** 256,
|
||||
|
||||
pub const EolMode = enum { lf, crlf };
|
||||
pub const EolModeTag = @typeInfo(EolMode).@"enum".tag_type;
|
||||
|
||||
|
|
|
@ -107,115 +107,7 @@
|
|||
["6", "add_integer_argument_digit", 6],
|
||||
["7", "add_integer_argument_digit", 7],
|
||||
["8", "add_integer_argument_digit", 8],
|
||||
["9", "add_integer_argument_digit", 9],
|
||||
|
||||
["ma", "set_mark", 97],
|
||||
["mb", "set_mark", 98],
|
||||
["mc", "set_mark", 99],
|
||||
["md", "set_mark", 100],
|
||||
["me", "set_mark", 101],
|
||||
["mf", "set_mark", 102],
|
||||
["mg", "set_mark", 103],
|
||||
["mh", "set_mark", 104],
|
||||
["mi", "set_mark", 105],
|
||||
["mj", "set_mark", 106],
|
||||
["mk", "set_mark", 107],
|
||||
["ml", "set_mark", 108],
|
||||
["mm", "set_mark", 109],
|
||||
["mn", "set_mark", 110],
|
||||
["mo", "set_mark", 111],
|
||||
["mp", "set_mark", 112],
|
||||
["mq", "set_mark", 113],
|
||||
["mr", "set_mark", 114],
|
||||
["ms", "set_mark", 115],
|
||||
["mt", "set_mark", 116],
|
||||
["mu", "set_mark", 117],
|
||||
["mv", "set_mark", 118],
|
||||
["mw", "set_mark", 119],
|
||||
["mx", "set_mark", 120],
|
||||
["my", "set_mark", 121],
|
||||
["mz", "set_mark", 122],
|
||||
|
||||
["'a", "goto_mark", 97],
|
||||
["'b", "goto_mark", 98],
|
||||
["'c", "goto_mark", 99],
|
||||
["'d", "goto_mark", 100],
|
||||
["'e", "goto_mark", 101],
|
||||
["'f", "goto_mark", 102],
|
||||
["'g", "goto_mark", 103],
|
||||
["'h", "goto_mark", 104],
|
||||
["'i", "goto_mark", 105],
|
||||
["'j", "goto_mark", 106],
|
||||
["'k", "goto_mark", 107],
|
||||
["'l", "goto_mark", 108],
|
||||
["'m", "goto_mark", 109],
|
||||
["'n", "goto_mark", 110],
|
||||
["'o", "goto_mark", 111],
|
||||
["'p", "goto_mark", 112],
|
||||
["'q", "goto_mark", 113],
|
||||
["'r", "goto_mark", 114],
|
||||
["'s", "goto_mark", 115],
|
||||
["'t", "goto_mark", 116],
|
||||
["'u", "goto_mark", 117],
|
||||
["'v", "goto_mark", 118],
|
||||
["'w", "goto_mark", 119],
|
||||
["'x", "goto_mark", 120],
|
||||
["'y", "goto_mark", 121],
|
||||
["'z", "goto_mark", 122],
|
||||
|
||||
["mA", "set_global_mark", 65],
|
||||
["mB", "set_global_mark", 66],
|
||||
["mC", "set_global_mark", 67],
|
||||
["mD", "set_global_mark", 68],
|
||||
["mE", "set_global_mark", 69],
|
||||
["mF", "set_global_mark", 70],
|
||||
["mG", "set_global_mark", 71],
|
||||
["mH", "set_global_mark", 72],
|
||||
["mI", "set_global_mark", 73],
|
||||
["mJ", "set_global_mark", 74],
|
||||
["mK", "set_global_mark", 75],
|
||||
["mL", "set_global_mark", 76],
|
||||
["mM", "set_global_mark", 77],
|
||||
["mN", "set_global_mark", 78],
|
||||
["mO", "set_global_mark", 79],
|
||||
["mP", "set_global_mark", 80],
|
||||
["mQ", "set_global_mark", 81],
|
||||
["mR", "set_global_mark", 82],
|
||||
["mS", "set_global_mark", 83],
|
||||
["mT", "set_global_mark", 84],
|
||||
["mU", "set_global_mark", 85],
|
||||
["mV", "set_global_mark", 86],
|
||||
["mW", "set_global_mark", 87],
|
||||
["mX", "set_global_mark", 88],
|
||||
["mY", "set_global_mark", 89],
|
||||
["mZ", "set_global_mark", 90],
|
||||
|
||||
["'A", "goto_global_mark", 65],
|
||||
["'B", "goto_global_mark", 66],
|
||||
["'C", "goto_global_mark", 67],
|
||||
["'D", "goto_global_mark", 68],
|
||||
["'E", "goto_global_mark", 69],
|
||||
["'F", "goto_global_mark", 70],
|
||||
["'G", "goto_global_mark", 71],
|
||||
["'H", "goto_global_mark", 72],
|
||||
["'I", "goto_global_mark", 73],
|
||||
["'J", "goto_global_mark", 74],
|
||||
["'K", "goto_global_mark", 75],
|
||||
["'L", "goto_global_mark", 76],
|
||||
["'M", "goto_global_mark", 77],
|
||||
["'N", "goto_global_mark", 78],
|
||||
["'O", "goto_global_mark", 79],
|
||||
["'P", "goto_global_mark", 80],
|
||||
["'Q", "goto_global_mark", 81],
|
||||
["'R", "goto_global_mark", 82],
|
||||
["'S", "goto_global_mark", 83],
|
||||
["'T", "goto_global_mark", 84],
|
||||
["'U", "goto_global_mark", 85],
|
||||
["'V", "goto_global_mark", 86],
|
||||
["'W", "goto_global_mark", 87],
|
||||
["'X", "goto_global_mark", 88],
|
||||
["'Y", "goto_global_mark", 89],
|
||||
["'Z", "goto_global_mark", 90]
|
||||
["9", "add_integer_argument_digit", 9]
|
||||
]
|
||||
},
|
||||
"visual": {
|
||||
|
@ -242,7 +134,6 @@
|
|||
["B", "select_word_left"],
|
||||
["e", "select_word_right_end_vim"],
|
||||
|
||||
["0", "move_begin"],
|
||||
["^", "smart_move_begin"],
|
||||
["$", "select_end"],
|
||||
[":", "open_command_palette"],
|
||||
|
@ -270,7 +161,18 @@
|
|||
|
||||
["c", ["enter_mode", "insert"], ["cut_forward_internal"]],
|
||||
["C", ["enter_mode", "insert"], ["cut_to_end_vim"]],
|
||||
["D", "cut_to_end_vim"]
|
||||
["D", "cut_to_end_vim"],
|
||||
|
||||
["0", "move_begin_or_add_integer_argument_zero"],
|
||||
["1", "add_integer_argument_digit", 1],
|
||||
["2", "add_integer_argument_digit", 2],
|
||||
["3", "add_integer_argument_digit", 3],
|
||||
["4", "add_integer_argument_digit", 4],
|
||||
["5", "add_integer_argument_digit", 5],
|
||||
["6", "add_integer_argument_digit", 6],
|
||||
["7", "add_integer_argument_digit", 7],
|
||||
["8", "add_integer_argument_digit", 8],
|
||||
["9", "add_integer_argument_digit", 9]
|
||||
]
|
||||
},
|
||||
"visual line": {
|
||||
|
@ -285,7 +187,6 @@
|
|||
["k", "select_up"],
|
||||
["j", "select_down"],
|
||||
|
||||
["0", "move_begin"],
|
||||
["^", "smart_move_begin"],
|
||||
["$", "move_end"],
|
||||
[":", "open_command_palette"],
|
||||
|
@ -307,7 +208,18 @@
|
|||
|
||||
["c", ["enter_mode", "insert"], ["cut_internal_vim"]],
|
||||
["C", ["enter_mode", "insert"], ["cut_to_end_vim"]],
|
||||
["D", "cut_to_end_vim"]
|
||||
["D", "cut_to_end_vim"],
|
||||
|
||||
["0", "move_begin_or_add_integer_argument_zero"],
|
||||
["1", "add_integer_argument_digit", 1],
|
||||
["2", "add_integer_argument_digit", 2],
|
||||
["3", "add_integer_argument_digit", 3],
|
||||
["4", "add_integer_argument_digit", 4],
|
||||
["5", "add_integer_argument_digit", 5],
|
||||
["6", "add_integer_argument_digit", 6],
|
||||
["7", "add_integer_argument_digit", 7],
|
||||
["8", "add_integer_argument_digit", 8],
|
||||
["9", "add_integer_argument_digit", 9]
|
||||
]
|
||||
},
|
||||
"insert": {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue