emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master f654080513: Don't generate multibyte keystroke events if there is


From: Po Lu
Subject: master f654080513: Don't generate multibyte keystroke events if there is no actual text
Date: Mon, 21 Feb 2022 21:40:40 -0500 (EST)

branch: master
commit f654080513b757f37d829521a50aa62bd5904767
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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.
---
 src/xterm.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index ca74f6cbd9..6efefd0301 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;
                }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]