1
0
Fork 0
forked from wry/wry

Merge pull request #649 from mahkoh/jorth/simple-im-no-newline

simple-im: don't emit newline in pre-edit
This commit is contained in:
mahkoh 2025-10-17 01:17:04 +02:00 committed by GitHub
commit 909f158082
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,7 +11,7 @@ use {
wl_surface::zwp_input_popup_surface_v2::ZwpInputPopupSurfaceV2,
},
keyboard::KeyboardState,
utils::{clonecell::CloneCell, smallmap::SmallMap},
utils::{clonecell::CloneCell, debug_fn::debug_fn, smallmap::SmallMap},
wire::ZwpInputPopupSurfaceV2Id,
},
kbvm::{
@ -154,7 +154,14 @@ impl UnicodeInput {
let _ = write!(self.text, "U+{:x}", self.cp);
self.cursor = self.text.len() as _;
if let Some(char) = char::from_u32(self.cp) {
let _ = write!(self.text, " = {}", char);
let s = debug_fn(|f| {
if char == '\n' {
f.write_str("\\n")
} else {
f.write_char(char)
}
});
let _ = write!(self.text, " = {}", s);
}
}