fix: don't use with_selection_const in primary_drag
with_selection_const destroys the selection on movement errors. closes #406
This commit is contained in:
parent
1685b3204c
commit
1be41aff8b
1 changed files with 5 additions and 5 deletions
|
|
@ -2662,21 +2662,21 @@ pub const Editor = struct {
|
||||||
.word => {
|
.word => {
|
||||||
if (sel.is_reversed()) {
|
if (sel.is_reversed()) {
|
||||||
sel.begin = initial.end;
|
sel.begin = initial.end;
|
||||||
with_selection_const(root, move_cursor_word_begin, primary, self.metrics) catch {};
|
move_cursor_word_begin(root, &sel.end, self.metrics) catch {};
|
||||||
} else {
|
} else {
|
||||||
sel.begin = initial.begin;
|
sel.begin = initial.begin;
|
||||||
with_selection_const(root, move_cursor_word_end, primary, self.metrics) catch {};
|
move_cursor_word_end(root, &sel.end, self.metrics) catch {};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
.line => {
|
.line => {
|
||||||
if (sel.is_reversed()) {
|
if (sel.is_reversed()) {
|
||||||
sel.begin = initial.end;
|
sel.begin = initial.end;
|
||||||
with_selection_const(root, move_cursor_begin, primary, self.metrics) catch {};
|
move_cursor_begin(root, &sel.end, self.metrics) catch {};
|
||||||
} else {
|
} else {
|
||||||
sel.begin = initial.begin;
|
sel.begin = initial.begin;
|
||||||
blk: {
|
blk: {
|
||||||
with_selection_const(root, move_cursor_end, primary, self.metrics) catch break :blk;
|
move_cursor_end(root, &sel.end, self.metrics) catch break :blk;
|
||||||
with_selection_const(root, move_cursor_right, primary, self.metrics) catch {};
|
move_cursor_right(root, &sel.end, self.metrics) catch {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue