ime preedit
This commit is contained in:
2
iris
2
iris
Submodule iris updated: 7e257fd042...4981bd739a
@@ -39,6 +39,7 @@ pub struct Client {
|
|||||||
data: ClientData,
|
data: ClientData,
|
||||||
handle: AppHandle,
|
handle: AppHandle,
|
||||||
error: Option<WidgetId<WidgetPtr>>,
|
error: Option<WidgetId<WidgetPtr>>,
|
||||||
|
ime: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Client {
|
impl Client {
|
||||||
@@ -58,6 +59,7 @@ impl Client {
|
|||||||
username: "<unknown>".to_string(),
|
username: "<unknown>".to_string(),
|
||||||
clipboard: Clipboard::new().unwrap(),
|
clipboard: Clipboard::new().unwrap(),
|
||||||
error: None,
|
error: None,
|
||||||
|
ime: 0,
|
||||||
};
|
};
|
||||||
ui::init(&mut s);
|
ui::init(&mut s);
|
||||||
s
|
s
|
||||||
@@ -145,16 +147,22 @@ impl Client {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WindowEvent::Ime(ime) => match ime {
|
WindowEvent::Ime(ime) => {
|
||||||
Ime::Enabled | Ime::Disabled => (),
|
if let Some(sel) = &self.focus {
|
||||||
Ime::Preedit(_, _) => (),
|
let mut text = self.ui.text(sel);
|
||||||
Ime::Commit(content) => {
|
match ime {
|
||||||
if let Some(sel) = &self.focus {
|
Ime::Enabled | Ime::Disabled => (),
|
||||||
let mut text = self.ui.text(sel);
|
Ime::Preedit(content, _pos) => {
|
||||||
text.insert(&content);
|
// TODO: highlight once that's real
|
||||||
|
text.replace(self.ime, &content);
|
||||||
|
self.ime = content.chars().count();
|
||||||
|
}
|
||||||
|
Ime::Commit(content) => {
|
||||||
|
text.insert(&content);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
if self.ui.needs_redraw() {
|
if self.ui.needs_redraw() {
|
||||||
|
|||||||
Reference in New Issue
Block a user