summaryrefslogtreecommitdiffstats
path: root/native/src/text.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-02-10 20:03:33 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-02-24 13:37:32 +0100
commit26e902f7d84290f8163a25c37488d29db4fc0708 (patch)
tree2ef873ef3b827449cdfd07a74c52665a172d58ad /native/src/text.rs
parent51844c5d0c7f7c9b65c56330862b69f0baa0e3c1 (diff)
downloadiced-26e902f7d84290f8163a25c37488d29db4fc0708.tar.gz
iced-26e902f7d84290f8163a25c37488d29db4fc0708.tar.bz2
iced-26e902f7d84290f8163a25c37488d29db4fc0708.zip
Compute grapheme index in `find_cursor_position` for `TextInput`
Diffstat (limited to 'native/src/text.rs')
-rw-r--r--native/src/text.rs13
1 files changed, 1 insertions, 12 deletions
diff --git a/native/src/text.rs b/native/src/text.rs
index 1bbd36cc..4c72abc3 100644
--- a/native/src/text.rs
+++ b/native/src/text.rs
@@ -1,6 +1,6 @@
//! Draw and interact with text.
use crate::alignment;
-use crate::{Color, Point, Rectangle, Size, Vector};
+use crate::{Color, Point, Rectangle, Size};
use std::borrow::Cow;
@@ -34,10 +34,6 @@ pub struct Text<'a, Font> {
pub enum Hit {
/// The point was within the bounds of the returned character index.
CharOffset(usize),
- /// The provided point was not within the bounds of a glyph. The index
- /// of the character with the closest centeroid position is returned,
- /// as well as its delta.
- NearestCharOffset(usize, Vector),
}
impl Hit {
@@ -45,13 +41,6 @@ impl Hit {
pub fn cursor(self) -> usize {
match self {
Self::CharOffset(i) => i,
- Self::NearestCharOffset(i, delta) => {
- if delta.x > f32::EPSILON {
- i + 1
- } else {
- i
- }
- }
}
}
}