Skip to content

Commit c0e70a1

Browse files
committed
simple-im: don't emit newline in pre-edit
1 parent 43171a1 commit c0e70a1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/ifs/wl_seat/text_input/simple_im.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use {
1111
wl_surface::zwp_input_popup_surface_v2::ZwpInputPopupSurfaceV2,
1212
},
1313
keyboard::KeyboardState,
14-
utils::{clonecell::CloneCell, smallmap::SmallMap},
14+
utils::{clonecell::CloneCell, debug_fn::debug_fn, smallmap::SmallMap},
1515
wire::ZwpInputPopupSurfaceV2Id,
1616
},
1717
kbvm::{
@@ -154,7 +154,14 @@ impl UnicodeInput {
154154
let _ = write!(self.text, "U+{:x}", self.cp);
155155
self.cursor = self.text.len() as _;
156156
if let Some(char) = char::from_u32(self.cp) {
157-
let _ = write!(self.text, " = {}", char);
157+
let s = debug_fn(|f| {
158+
if char == '\n' {
159+
f.write_str("\\n")
160+
} else {
161+
f.write_char(char)
162+
}
163+
});
164+
let _ = write!(self.text, " = {}", s);
158165
}
159166
}
160167

0 commit comments

Comments
 (0)