Compare commits
No commits in common. "1c486ccd937cabbe0e1a183c31b5e23f72aa90fb" and "4d375d2d9bf28457b3d446bae08e4a73128519ef" have entirely different histories.
1c486ccd93
...
4d375d2d9b
2 changed files with 14 additions and 9 deletions
|
|
@ -6,8 +6,8 @@
|
||||||
|
|
||||||
.dependencies = .{
|
.dependencies = .{
|
||||||
.syntax = .{
|
.syntax = .{
|
||||||
.url = "git+https://github.com/neurocyte/flow-syntax?ref=master#a2356a459e8a1c30e43da8648d45e4eaec518f2b",
|
.url = "git+https://github.com/neurocyte/flow-syntax?ref=master#9106b13b4c98b145229ad643e7869f29c7b0816b",
|
||||||
.hash = "flow_syntax-0.1.0-X8jOoZQTAQCWj2TJgmEykecTmQFQGqUduPxLVZJM_y88",
|
.hash = "flow_syntax-0.1.0-X8jOoZQTAQCV2bjyceUHrRl_iu41imzTDLGT5R-XwT_9",
|
||||||
},
|
},
|
||||||
.flags = .{
|
.flags = .{
|
||||||
.url = "git+https://github.com/neurocyte/flags?ref=main#984b27948da3e4e40a253f76c85b51ec1a9ada11",
|
.url = "git+https://github.com/neurocyte/flags?ref=main#984b27948da3e4e40a253f76c85b51ec1a9ada11",
|
||||||
|
|
|
||||||
|
|
@ -2710,12 +2710,13 @@ pub const Editor = struct {
|
||||||
pub const cut_internal_vim_meta: Meta = .{ .description = "Cut selection or current line to internal clipboard (vim)" };
|
pub const cut_internal_vim_meta: Meta = .{ .description = "Cut selection or current line to internal clipboard (vim)" };
|
||||||
|
|
||||||
pub fn cut(self: *Self, _: Context) Result {
|
pub fn cut(self: *Self, _: Context) Result {
|
||||||
|
const primary = self.get_primary();
|
||||||
const b = self.buf_for_update() catch return;
|
const b = self.buf_for_update() catch return;
|
||||||
var root = b.root;
|
var root = b.root;
|
||||||
|
if (self.cursels.items.len == 1 and primary.selection == null)
|
||||||
|
try self.select_line_at_cursor(root, primary, .include_eol);
|
||||||
tui.clipboard_start_group();
|
tui.clipboard_start_group();
|
||||||
for (self.cursels.items) |*cursel_| if (cursel_.*) |*cursel| {
|
for (self.cursels.items) |*cursel_| if (cursel_.*) |*cursel| {
|
||||||
if (cursel.selection == null)
|
|
||||||
try self.select_line_at_cursor(root, cursel, .include_eol);
|
|
||||||
const cut_text, root = try self.cut_selection(root, cursel, tui.clipboard_allocator());
|
const cut_text, root = try self.cut_selection(root, cursel, tui.clipboard_allocator());
|
||||||
tui.clipboard_add_chunk(cut_text);
|
tui.clipboard_add_chunk(cut_text);
|
||||||
};
|
};
|
||||||
|
|
@ -2726,13 +2727,17 @@ pub const Editor = struct {
|
||||||
pub const cut_meta: Meta = .{ .description = "Cut selection or current line to clipboard" };
|
pub const cut_meta: Meta = .{ .description = "Cut selection or current line to clipboard" };
|
||||||
|
|
||||||
pub fn copy(self: *Self, _: Context) Result {
|
pub fn copy(self: *Self, _: Context) Result {
|
||||||
|
const primary = self.get_primary();
|
||||||
const root = self.buf_root() catch return;
|
const root = self.buf_root() catch return;
|
||||||
tui.clipboard_start_group();
|
if (self.cursels.items.len == 1)
|
||||||
for (self.cursels.items) |*cursel_| if (cursel_.*) |*cursel| {
|
if (primary.selection) |_| {} else {
|
||||||
const sel = if (cursel.selection) |sel| sel else blk: {
|
const sel = primary.enable_selection(root, self.metrics) catch return;
|
||||||
try self.select_line_at_cursor(root, cursel, .include_eol);
|
try move_cursor_begin(root, &sel.begin, self.metrics);
|
||||||
break :blk cursel.selection orelse continue;
|
try move_cursor_end(root, &sel.end, self.metrics);
|
||||||
|
try move_cursor_right(root, &sel.end, self.metrics);
|
||||||
};
|
};
|
||||||
|
tui.clipboard_start_group();
|
||||||
|
for (self.cursels.items) |*cursel_| if (cursel_.*) |*cursel| if (cursel.selection) |sel| {
|
||||||
tui.clipboard_add_chunk(try copy_selection(root, sel, tui.clipboard_allocator(), self.metrics));
|
tui.clipboard_add_chunk(try copy_selection(root, sel, tui.clipboard_allocator(), self.metrics));
|
||||||
};
|
};
|
||||||
return tui.clipboard_send_to_system();
|
return tui.clipboard_send_to_system();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue