From 49e06d0cdabb47b91940fcfe200ee58fc164352e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 29 Feb 2024 14:04:03 +0530 Subject: [PATCH] ... --- src/pyj/select.pyj | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pyj/select.pyj b/src/pyj/select.pyj index 55278ffc54..7ed3d9275a 100644 --- a/src/pyj/select.pyj +++ b/src/pyj/select.pyj @@ -237,8 +237,9 @@ def move_end_of_selection(pos, start): new_range.setStart(r.startContainer, r.startOffset) new_range.setEnd(p.offsetNode, p.offset) other_boundary_changed = r.startContainer is not new_range.startContainer or r.startOffset is not new_range.startOffset - if not new_range.collapsed or not other_boundary_changed: + if new_range.collapsed and other_boundary_changed: # we ignore the case when the new range is collapsed and the other end # of the selection is also moved as this is a chromium bug. See https://bugs.launchpad.net/bugs/2054934 - sel.removeAllRanges() - sel.addRange(new_range) + return + sel.removeAllRanges() + sel.addRange(new_range)