Compare commits
3 commits
8f9b2d15f7
...
4389eccdce
Author | SHA1 | Date | |
---|---|---|---|
4389eccdce | |||
67f1ab1697 | |||
0bd01afe53 |
3 changed files with 38 additions and 3 deletions
|
@ -22,8 +22,8 @@
|
||||||
.hash = "1220839522cd1d8b19c62488127f763a202c69b0ad629666280724902c23f10bd29f",
|
.hash = "1220839522cd1d8b19c62488127f763a202c69b0ad629666280724902c23f10bd29f",
|
||||||
},
|
},
|
||||||
.themes = .{
|
.themes = .{
|
||||||
.url = "https://github.com/neurocyte/flow-themes/releases/download/master-618a7801d3383049adfe18cc09f5f5086c66995f/flow-themes.tar.gz",
|
.url = "https://github.com/neurocyte/flow-themes/releases/download/master-59bf204551bcb238faddd06779063570e7e6d431/flow-themes.tar.gz",
|
||||||
.hash = "1220019ed92f48fb94d4ae82bba17b11d0ba06f17ed31cd66613b3c048b1d2382095",
|
.hash = "12209a213a392ea80ea5c7dde125e7161bb0278ac4b99db9df2b7af783710bcb09f7",
|
||||||
},
|
},
|
||||||
.fuzzig = .{
|
.fuzzig = .{
|
||||||
.url = "https://github.com/fjebaker/fuzzig/archive/44c04733c7c0fee3db83672aaaaf4ed03e943156.tar.gz",
|
.url = "https://github.com/fjebaker/fuzzig/archive/44c04733c7c0fee3db83672aaaaf4ed03e943156.tar.gz",
|
||||||
|
|
|
@ -161,6 +161,16 @@
|
||||||
["tab", "indent"],
|
["tab", "indent"],
|
||||||
["ctrl+space", "enter_mode", "select"],
|
["ctrl+space", "enter_mode", "select"],
|
||||||
|
|
||||||
|
["\"", "smart_insert_pair", "\"", "\""],
|
||||||
|
["'", "smart_insert_pair", "'", "'"],
|
||||||
|
["(", "smart_insert_pair", "(", ")"],
|
||||||
|
["[", "smart_insert_pair", "[", "]"],
|
||||||
|
["{", "smart_insert_pair", "{", "}"],
|
||||||
|
["‘", "smart_insert_pair", "‘", "’"],
|
||||||
|
["“", "smart_insert_pair", "“", "”"],
|
||||||
|
["‚", "smart_insert_pair", "‚", "‘"],
|
||||||
|
["«", "smart_insert_pair", "«", "»"],
|
||||||
|
|
||||||
["left_control", "enable_jump_mode"],
|
["left_control", "enable_jump_mode"],
|
||||||
["right_control", "enable_jump_mode"],
|
["right_control", "enable_jump_mode"],
|
||||||
["left_alt", "enable_fast_scroll"],
|
["left_alt", "enable_fast_scroll"],
|
||||||
|
|
|
@ -616,7 +616,7 @@ pub const Editor = struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.buffer) |buffer| if (buffer.get_meta()) |meta| {
|
if (self.buffer) |buffer| if (buffer.get_meta()) |meta| {
|
||||||
const frame_ = tracy.initZone(@src(), .{ .name = "extract_state" });
|
const frame_ = tracy.initZone(@src(), .{ .name = extract_state });
|
||||||
defer frame_.deinit();
|
defer frame_.deinit();
|
||||||
try self.extract_state(meta, .none);
|
try self.extract_state(meta, .none);
|
||||||
};
|
};
|
||||||
|
@ -4060,6 +4060,31 @@ pub const Editor = struct {
|
||||||
}
|
}
|
||||||
pub const smart_buffer_append_meta: Meta = .{ .arguments = &.{.string} };
|
pub const smart_buffer_append_meta: Meta = .{ .arguments = &.{.string} };
|
||||||
|
|
||||||
|
pub fn smart_insert_pair(self: *Self, ctx: Context) Result {
|
||||||
|
var chars_left: []const u8 = undefined;
|
||||||
|
var chars_right: []const u8 = undefined;
|
||||||
|
if (!try ctx.args.match(.{ tp.extract(&chars_left), tp.extract(&chars_right) }))
|
||||||
|
return error.InvalidSmartInsertPairArguments;
|
||||||
|
const b = try self.buf_for_update();
|
||||||
|
var root = b.root;
|
||||||
|
for (self.cursels.items) |*cursel_| if (cursel_.*) |*cursel| {
|
||||||
|
if (cursel.selection) |*sel| {
|
||||||
|
var begin: CurSel = .{ .cursor = sel.begin };
|
||||||
|
root = try self.insert(root, &begin, chars_left, b.allocator);
|
||||||
|
var end: CurSel = .{ .cursor = sel.end };
|
||||||
|
root = try self.insert(root, &end, chars_right, b.allocator);
|
||||||
|
sel.end.move_left(root, self.metrics) catch {};
|
||||||
|
} else {
|
||||||
|
root = try self.insert(root, cursel, chars_left, b.allocator);
|
||||||
|
root = try self.insert(root, cursel, chars_right, b.allocator);
|
||||||
|
}
|
||||||
|
cursel.cursor.move_left(root, self.metrics) catch {};
|
||||||
|
};
|
||||||
|
try self.update_buf(root);
|
||||||
|
self.clamp();
|
||||||
|
}
|
||||||
|
pub const smart_insert_pair_meta = .{ .arguments = &.{.string} };
|
||||||
|
|
||||||
pub fn enable_fast_scroll(self: *Self, _: Context) Result {
|
pub fn enable_fast_scroll(self: *Self, _: Context) Result {
|
||||||
self.fast_scroll = true;
|
self.fast_scroll = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue