From: Po Lu Date: Tue, 22 Feb 2022 02:38:53 +0000 (+0800) Subject: Don't generate multibyte keystroke events if there is no actual text X-Git-Tag: emacs-29.0.90~2167 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f654080513b757f37d829521a50aa62bd5904767;p=emacs.git Don't generate multibyte keystroke events if there is no actual text * src/xterm.c (handle_one_xevent): Don't generate MULTIBYTE_CHAR_KEYSTROKE_EVENTs if nbytes is zero. --- diff --git a/src/xterm.c b/src/xterm.c index ca74f6cbd9f..6efefd0301d 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -10127,11 +10127,14 @@ handle_one_xevent (struct x_display_info *dpyinfo, STORE_KEYSYM_FOR_DEBUG (copy_bufptr[i]); } - inev.ie.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT; - inev.ie.arg = make_unibyte_string ((char *) copy_bufptr, nbytes); + if (nbytes) + { + inev.ie.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT; + inev.ie.arg = make_unibyte_string ((char *) copy_bufptr, nbytes); - Fput_text_property (make_fixnum (0), make_fixnum (nbytes), - Qcoding, coding, inev.ie.arg); + Fput_text_property (make_fixnum (0), make_fixnum (nbytes), + Qcoding, coding, inev.ie.arg); + } if (keysym == NoSymbol) break; @@ -11842,11 +11845,14 @@ handle_one_xevent (struct x_display_info *dpyinfo, STORE_KEYSYM_FOR_DEBUG (copy_bufptr[i]); } - inev.ie.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT; - inev.ie.arg = make_unibyte_string (copy_bufptr, nbytes); + if (nbytes) + { + inev.ie.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT; + inev.ie.arg = make_unibyte_string (copy_bufptr, nbytes); - Fput_text_property (make_fixnum (0), make_fixnum (nbytes), - Qcoding, coding, inev.ie.arg); + Fput_text_property (make_fixnum (0), make_fixnum (nbytes), + Qcoding, coding, inev.ie.arg); + } goto xi_done_keysym; }