summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2021-09-15 14:49:13 +0700
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2021-09-15 14:49:13 +0700
commit643500bbdf1a169db1bcdcb8e971334037274d38 (patch)
treec2e4131f9bdc788052b584da05a6ee1ce2e8d71b /core/src
parent93fec8d273ef8305e1c2456abe0c8ecd7a9d9407 (diff)
downloadiced-643500bbdf1a169db1bcdcb8e971334037274d38.tar.gz
iced-643500bbdf1a169db1bcdcb8e971334037274d38.tar.bz2
iced-643500bbdf1a169db1bcdcb8e971334037274d38.zip
Use `Option` to encode empty text case in hit test methods
Diffstat (limited to 'core/src')
-rw-r--r--core/src/text.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/src/text.rs b/core/src/text.rs
index ded22eef..e5d0092e 100644
--- a/core/src/text.rs
+++ b/core/src/text.rs
@@ -14,14 +14,14 @@ pub enum Hit {
impl Hit {
/// Computes the cursor position corresponding to this [`HitTestResult`] .
- pub fn cursor(&self) -> usize {
+ pub fn cursor(self) -> usize {
match self {
- Self::CharOffset(i) => *i,
+ Self::CharOffset(i) => i,
Self::NearestCharOffset(i, delta) => {
if delta.x > f32::EPSILON {
i + 1
} else {
- *i
+ i
}
}
}