refactor: prefer Selection.is_reversed to Cursor.right_of

This commit is contained in:
CJ van den Berg 2025-12-28 20:55:14 +01:00
parent 182011059d
commit 7f88381eb0
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -2652,7 +2652,7 @@ pub const Editor = struct {
switch (self.selection_mode) {
.char => {},
.word => {
if (sel.begin.right_of(sel.end)) {
if (sel.is_reversed()) {
sel.begin = initial.end;
with_selection_const(root, move_cursor_word_begin, primary, self.metrics) catch {};
} else {
@ -2661,7 +2661,7 @@ pub const Editor = struct {
}
},
.line => {
if (sel.begin.right_of(sel.end)) {
if (sel.is_reversed()) {
sel.begin = initial.end;
with_selection_const(root, move_cursor_begin, primary, self.metrics) catch {};
} else {