summaryrefslogtreecommitdiffstats
path: root/core/src/shell.rs
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/shell.rs')
-rw-r--r--core/src/shell.rs25
1 files changed, 24 insertions, 1 deletions
diff --git a/core/src/shell.rs b/core/src/shell.rs
index 12ebbaa8..d2c1b9ec 100644
--- a/core/src/shell.rs
+++ b/core/src/shell.rs
@@ -1,6 +1,15 @@
-use crate::event;
use crate::time::Instant;
use crate::window;
+use crate::{event, Point};
+
+/// TODO
+#[derive(Clone, Copy, Debug)]
+pub struct CaretInfo {
+ /// TODO
+ pub position: Point,
+ /// TODO
+ pub input_method_allowed: bool,
+}
/// A connection to the state of a shell.
///
@@ -15,6 +24,7 @@ pub struct Shell<'a, Message> {
redraw_request: Option<window::RedrawRequest>,
is_layout_invalid: bool,
are_widgets_invalid: bool,
+ caret_info: Option<CaretInfo>,
}
impl<'a, Message> Shell<'a, Message> {
@@ -26,6 +36,7 @@ impl<'a, Message> Shell<'a, Message> {
redraw_request: None,
is_layout_invalid: false,
are_widgets_invalid: false,
+ caret_info: None,
}
}
@@ -80,6 +91,16 @@ impl<'a, Message> Shell<'a, Message> {
self.redraw_request
}
+ /// TODO
+ pub fn update_caret_info(&mut self, caret_info: Option<CaretInfo>) {
+ self.caret_info = caret_info.or(self.caret_info);
+ }
+
+ /// TODO
+ pub fn caret_info(&self) -> Option<CaretInfo> {
+ self.caret_info
+ }
+
/// Returns whether the current layout is invalid or not.
pub fn is_layout_invalid(&self) -> bool {
self.is_layout_invalid
@@ -130,6 +151,8 @@ impl<'a, Message> Shell<'a, Message> {
);
}
+ self.update_caret_info(other.caret_info());
+
self.is_layout_invalid =
self.is_layout_invalid || other.is_layout_invalid;