From c0e70a1d6d7b7a76b6633cf5506843a88491c332 Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Fri, 17 Oct 2025 01:09:26 +0200 Subject: [PATCH] simple-im: don't emit newline in pre-edit --- src/ifs/wl_seat/text_input/simple_im.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ifs/wl_seat/text_input/simple_im.rs b/src/ifs/wl_seat/text_input/simple_im.rs index 54307e01..6a3a905b 100644 --- a/src/ifs/wl_seat/text_input/simple_im.rs +++ b/src/ifs/wl_seat/text_input/simple_im.rs @@ -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); } }