summaryrefslogtreecommitdiffstats
path: root/widget/src/scrollable.rs
diff options
context:
space:
mode:
authorLibravatar KENZ <KENZ.gelsoft@gmail.com>2025-01-10 07:12:31 +0900
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2025-02-02 17:44:13 +0100
commit7db5256b720c3ecbe7c1cce7a1b47fd03151e03a (patch)
treeccf08e3f76e27d0871185b786ece83f970dddc77 /widget/src/scrollable.rs
parent599d8b560bec8036c5ddda62a7bf0a540bdec396 (diff)
downloadiced-7db5256b720c3ecbe7c1cce7a1b47fd03151e03a.tar.gz
iced-7db5256b720c3ecbe7c1cce7a1b47fd03151e03a.tar.bz2
iced-7db5256b720c3ecbe7c1cce7a1b47fd03151e03a.zip
Draft `input_method` support
Diffstat (limited to 'widget/src/scrollable.rs')
-rw-r--r--widget/src/scrollable.rs19
1 files changed, 17 insertions, 2 deletions
diff --git a/widget/src/scrollable.rs b/widget/src/scrollable.rs
index 312aee29..7df7a0e5 100644
--- a/widget/src/scrollable.rs
+++ b/widget/src/scrollable.rs
@@ -33,8 +33,9 @@ use crate::core::widget::operation::{self, Operation};
use crate::core::widget::tree::{self, Tree};
use crate::core::window;
use crate::core::{
- self, Background, Clipboard, Color, Element, Event, Layout, Length,
- Padding, Pixels, Point, Rectangle, Shell, Size, Theme, Vector, Widget,
+ self, Background, CaretInfo, Clipboard, Color, Element, Event, Layout,
+ Length, Padding, Pixels, Point, Rectangle, Shell, Size, Theme, Vector,
+ Widget,
};
use crate::runtime::task::{self, Task};
use crate::runtime::Action;
@@ -729,6 +730,7 @@ where
let translation =
state.translation(self.direction, bounds, content_bounds);
+ let children_may_have_caret = shell.caret_info().is_none();
self.content.as_widget_mut().update(
&mut tree.children[0],
event.clone(),
@@ -743,6 +745,19 @@ where
..bounds
},
);
+
+ if children_may_have_caret {
+ if let Some(caret_info) = shell.caret_info() {
+ shell.update_caret_info(Some(CaretInfo {
+ position: Point::new(
+ caret_info.position.x - translation.x,
+ caret_info.position.y - translation.y,
+ ),
+ input_method_allowed: caret_info
+ .input_method_allowed,
+ }));
+ }
+ }
};
if matches!(