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,
|
||||
handle: AppHandle,
|
||||
error: Option<WidgetId<WidgetPtr>>,
|
||||
ime: usize,
|
||||
}
|
||||
|
||||
impl Client {
|
||||
@@ -58,6 +59,7 @@ impl Client {
|
||||
username: "<unknown>".to_string(),
|
||||
clipboard: Clipboard::new().unwrap(),
|
||||
error: None,
|
||||
ime: 0,
|
||||
};
|
||||
ui::init(&mut s);
|
||||
s
|
||||
@@ -145,16 +147,22 @@ impl Client {
|
||||
}
|
||||
}
|
||||
}
|
||||
WindowEvent::Ime(ime) => match ime {
|
||||
Ime::Enabled | Ime::Disabled => (),
|
||||
Ime::Preedit(_, _) => (),
|
||||
Ime::Commit(content) => {
|
||||
WindowEvent::Ime(ime) => {
|
||||
if let Some(sel) = &self.focus {
|
||||
let mut text = self.ui.text(sel);
|
||||
match ime {
|
||||
Ime::Enabled | Ime::Disabled => (),
|
||||
Ime::Preedit(content, _pos) => {
|
||||
// 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() {
|
||||
|
||||
Reference in New Issue
Block a user