fix: preserve cursor column and target in delete_line
This is the expected behaviour (for me at least) and makes delete_line significantly more useful than plain `cut` with no selection. closes #342
This commit is contained in:
parent
e42f3ff3a5
commit
4087e0a3f9
1 changed files with 5 additions and 0 deletions
|
|
@ -3019,8 +3019,13 @@ pub const Editor = struct {
|
||||||
const b = try self.buf_for_update();
|
const b = try self.buf_for_update();
|
||||||
var root = b.root;
|
var root = b.root;
|
||||||
for (self.cursels.items) |*cursel_| if (cursel_.*) |*cursel| {
|
for (self.cursels.items) |*cursel_| if (cursel_.*) |*cursel| {
|
||||||
|
const col = cursel.cursor.col;
|
||||||
|
const target = cursel.cursor.target;
|
||||||
try self.select_line_at_cursor(root, cursel, .include_eol);
|
try self.select_line_at_cursor(root, cursel, .include_eol);
|
||||||
root = try self.delete_selection(root, cursel, b.allocator);
|
root = try self.delete_selection(root, cursel, b.allocator);
|
||||||
|
cursel.cursor.col = col;
|
||||||
|
cursel.cursor.target = target;
|
||||||
|
cursel.cursor.clamp_to_buffer(root, self.metrics);
|
||||||
};
|
};
|
||||||
try self.update_buf(root);
|
try self.update_buf(root);
|
||||||
self.clamp();
|
self.clamp();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue