termwiz-pane: handle IME committed text in prompt overlays (#7556)
This commit is contained in:
1 parent
b16aa977e3
commit
1af8f19b56
3 files changed
+12
-1
No files matched your search
@@ -241,6 +241,10 @@ pub trait Pane: Downcast + Send + Sync {
|
||||
Progress::None
|
||||
}
|
||||
fn send_paste(&self, text: &str) -> anyhow::Result<()>;
|
||||
fn send_composed_text(&self, text: &str) -> anyhow::Result<()> {
|
||||
self.writer().write_all(text.as_bytes())?;
|
||||
Ok(())
|
||||
}
|
||||
fn reader(&self) -> anyhow::Result<Option<Box<dyn std::io::Read + Send>>>;
|
||||
fn writer(&self) -> MappedMutexGuard<'_, dyn std::io::Write>;
|
||||
fn resize(&self, size: TerminalSize) -> anyhow::Result<()>;
|
||||
|
||||
@@ -188,6 +188,11 @@ impl Pane for TermWizTerminalPane {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn send_composed_text(&self, text: &str) -> anyhow::Result<()> {
|
||||
// The writer is not linked to a real pty, so we send the composed text like a paste
|
||||
self.send_paste(text)
|
||||
}
|
||||
|
||||
fn reader(&self) -> anyhow::Result<Option<Box<dyn std::io::Read + Send>>> {
|
||||
Ok(Some(Box::new(self.render_rx.try_clone()?)))
|
||||
}
|
||||
|
||||
@@ -735,7 +735,9 @@ impl super::TermWindow {
|
||||
if self.config.debug_key_events {
|
||||
log::info!("send to pane string={:?}", s);
|
||||
}
|
||||
pane.writer().write_all(s.as_bytes()).ok();
|
||||
if let Err(err) = pane.send_composed_text(&s) {
|
||||
log::error!("failed to send composed text to pane: {err:#}");
|
||||
}
|
||||
self.maybe_scroll_to_bottom_for_input(&pane);
|
||||
context.invalidate();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user