summaryrefslogtreecommitdiffstats
path: root/native/src/widget
diff options
context:
space:
mode:
authorLibravatar cmot17 <25753364+cmot17@users.noreply.github.com>2021-10-24 08:57:14 -0400
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2021-10-25 16:45:38 +0700
commitb098f06a299f196c846affa2453f903ebe93c856 (patch)
tree4a505bc8e808c2053749f78fb9b409b69f21d3e1 /native/src/widget
parent20177e423cd2bdc08f8060b31c379a6f764e3df6 (diff)
downloadiced-b098f06a299f196c846affa2453f903ebe93c856.tar.gz
iced-b098f06a299f196c846affa2453f903ebe93c856.tar.bz2
iced-b098f06a299f196c846affa2453f903ebe93c856.zip
Fix issue with text selection in text_input widget
Diffstat (limited to 'native/src/widget')
-rw-r--r--native/src/widget/text_input.rs44
1 files changed, 21 insertions, 23 deletions
diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs
index 84d171be..d4d197d3 100644
--- a/native/src/widget/text_input.rs
+++ b/native/src/widget/text_input.rs
@@ -335,29 +335,27 @@ where
let text_layout = layout.children().next().unwrap();
let target = position.x - text_layout.bounds().x;
- if target > 0.0 {
- let value = if self.is_secure {
- self.value.secure()
- } else {
- self.value.clone()
- };
-
- let position = renderer
- .find_cursor_position(
- text_layout.bounds(),
- self.font,
- self.size,
- &value,
- &self.state,
- target,
- )
- .unwrap_or(0);
-
- self.state.cursor.select_range(
- self.state.cursor.start(&value),
- position,
- );
- }
+ let value = if self.is_secure {
+ self.value.secure()
+ } else {
+ self.value.clone()
+ };
+
+ let position = renderer
+ .find_cursor_position(
+ text_layout.bounds(),
+ self.font,
+ self.size,
+ &value,
+ &self.state,
+ target,
+ )
+ .unwrap_or(0);
+
+ self.state.cursor.select_range(
+ self.state.cursor.start(&value),
+ position,
+ );
return event::Status::Captured;
}