aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralex-ds13 <145657253+alex-ds13@users.noreply.github.com>2025-11-25 16:11:31 +0000
committerPolesznyák Márk <contact@pml68.dev>2025-12-29 23:23:41 +0100
commit1a55783b3770049cb630e0c28ef4b772e193f219 (patch)
tree544a0d7415a49dffd5a28b3d23c28988f7fec5dc
parentfix: take visual bounds into consideration when text is centered (diff)
downloadiced_selection-1a55783b3770049cb630e0c28ef4b772e193f219.tar.gz
fix: outbounds selecting when inside a scrollable
- If we were dragging a selection and move the mouse out of bounds of the text widget and an the same time it went out of bounds of a parent scrollable, the cursor would be levitated so we weren't getting it's cursor position. Now we land the cursor before checking the position.
-rw-r--r--src/text.rs2
-rw-r--r--src/text/rich.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/text.rs b/src/text.rs
index 648238f..ac51395 100644
--- a/src/text.rs
+++ b/src/text.rs
@@ -444,7 +444,7 @@ where
}
Event::Mouse(mouse::Event::CursorMoved { .. })
| Event::Touch(touch::Event::FingerMoved { .. }) => {
- if let Some(position) = cursor.position()
+ if let Some(position) = cursor.land().position()
&& let Some(dragging) = state.dragging
{
let (line, index) = state
diff --git a/src/text/rich.rs b/src/text/rich.rs
index 30a9e81..9f53387 100644
--- a/src/text/rich.rs
+++ b/src/text/rich.rs
@@ -661,7 +661,7 @@ where
}
Event::Mouse(mouse::Event::CursorMoved { .. })
| Event::Touch(touch::Event::FingerMoved { .. }) => {
- if let Some(position) = cursor.position()
+ if let Some(position) = cursor.land().position()
&& let Some(dragging) = state.dragging
{
let (line, index) = state