mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-02-04 06:23:45 +00:00
fix extend direction in Selection
This commit is contained in:
@@ -270,7 +270,7 @@
|
|||||||
testing.expectEqual(true, sel.isCollapsed);
|
testing.expectEqual(true, sel.isCollapsed);
|
||||||
testing.expectEqual(10, sel.anchorOffset);
|
testing.expectEqual(10, sel.anchorOffset);
|
||||||
testing.expectEqual(10, sel.focusOffset);
|
testing.expectEqual(10, sel.focusOffset);
|
||||||
testing.expectEqual("forward", sel.direction);
|
testing.expectEqual("none", sel.direction);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -208,11 +208,16 @@ pub fn extend(self: *Selection, node: *Node, _offset: ?u32) !void {
|
|||||||
try range.setEnd(old_anchor, old_anchor_offset);
|
try range.setEnd(old_anchor, old_anchor_offset);
|
||||||
self._direction = .backward;
|
self._direction = .backward;
|
||||||
},
|
},
|
||||||
else => {
|
.after => {
|
||||||
try range.setStart(old_anchor, old_anchor_offset);
|
try range.setStart(old_anchor, old_anchor_offset);
|
||||||
try range.setEnd(node, offset);
|
try range.setEnd(node, offset);
|
||||||
self._direction = .forward;
|
self._direction = .forward;
|
||||||
},
|
},
|
||||||
|
.equal => {
|
||||||
|
try range.setStart(old_anchor, old_anchor_offset);
|
||||||
|
try range.setEnd(old_anchor, old_anchor_offset);
|
||||||
|
self._direction = .none;
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user