summaryrefslogtreecommitdiffstats
path: root/widget/src/text_editor.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2025-02-02 17:50:12 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2025-02-02 17:50:12 +0100
commit0c6d4eb23f07e0ab424dc22dd198924b8540192a (patch)
treefa312df0a977b991a0eb2cc05f6515b5ace5310e /widget/src/text_editor.rs
parent7db5256b720c3ecbe7c1cce7a1b47fd03151e03a (diff)
downloadiced-0c6d4eb23f07e0ab424dc22dd198924b8540192a.tar.gz
iced-0c6d4eb23f07e0ab424dc22dd198924b8540192a.tar.bz2
iced-0c6d4eb23f07e0ab424dc22dd198924b8540192a.zip
Run `cargo fmt` and fix lints
Diffstat (limited to 'widget/src/text_editor.rs')
-rw-r--r--widget/src/text_editor.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/widget/src/text_editor.rs b/widget/src/text_editor.rs
index 2931e7f6..529c8b90 100644
--- a/widget/src/text_editor.rs
+++ b/widget/src/text_editor.rs
@@ -338,7 +338,7 @@ where
let text_bounds = bounds.shrink(self.padding);
let translation = text_bounds.position() - Point::ORIGIN;
- if let Some(_) = state.focus.as_ref() {
+ if state.focus.is_some() {
let position = match internal.editor.cursor() {
Cursor::Caret(position) => position,
Cursor::Selection(ranges) => ranges
@@ -872,10 +872,11 @@ where
};
shell.update_caret_info(if state.is_focused() {
- let rect = self
- .caret_rect(tree, renderer, layout)
- .unwrap_or(Rectangle::default());
+ let rect =
+ self.caret_rect(tree, renderer, layout).unwrap_or_default();
+
let bottom_left = Point::new(rect.x, rect.y + rect.height);
+
Some(CaretInfo {
position: bottom_left,
input_method_allowed: true,