]> code.delx.au - gnu-emacs/blobdiff - src/keyboard.c
Clarify doc strings of functions that search for properties
[gnu-emacs] / src / keyboard.c
index e1c5691324d767797742fb9746f2f6629f66e92e..bd79f901970249f555a4cd371625e269df018459 100644 (file)
@@ -2192,7 +2192,7 @@ read_event_from_main_queue (struct timespec *end_time,
   save_getcjmp (save_jump);
   restore_getcjmp (local_getcjmp);
   if (!end_time)
-       timer_start_idle ();
+    timer_start_idle ();
   c = kbd_buffer_get_event (&kb, used_mouse_menu, end_time);
   restore_getcjmp (save_jump);
 
@@ -5360,9 +5360,9 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
          dy = yret = wy;
        }
 
-      /* For clicks in the text area, fringes, or margins, call
-        buffer_posn_from_coords to extract TEXTPOS, the buffer
-        position nearest to the click.  */
+      /* For clicks in the text area, fringes, margins, or vertical
+        scroll bar, call buffer_posn_from_coords to extract TEXTPOS,
+        the buffer position nearest to the click.  */
       if (!textpos)
        {
          Lisp_Object string2, object2 = Qnil;
@@ -5370,11 +5370,14 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
          int dx2, dy2;
          int width2, height2;
          /* The pixel X coordinate passed to buffer_posn_from_coords
-            is the X coordinate relative to the text area for
-            text-area and right-margin clicks, zero otherwise.  */
+            is the X coordinate relative to the text area for clicks
+            in text-area, right-margin/fringe and right-side vertical
+            scroll bar, zero otherwise.  */
          int x2
            = (part == ON_TEXT) ? xret
-           : (part == ON_RIGHT_FRINGE || part == ON_RIGHT_MARGIN)
+           : (part == ON_RIGHT_FRINGE || part == ON_RIGHT_MARGIN
+              || (part == ON_VERTICAL_SCROLL_BAR
+                  && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)))
            ? (XINT (x) - window_box_left (w, TEXT_AREA))
            : 0;
          int y2 = wy;
@@ -9588,6 +9591,18 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
 
       /* Record what part of this_command_keys is the current key sequence.  */
       this_single_command_key_start = this_command_key_count - t;
+      /* When 'input-method-function' called above causes events to be
+        put on 'unread-post-input-method-events', and as result
+        'reread' is set to 'true', the value of 't' can become larger
+        than 'this_command_key_count', because 'add_command_key' is
+        not called to update 'this_command_key_count'.  If this
+        happens, 'this_single_command_key_start' will become negative
+        above, and any call to 'this-single-command-keys' will return
+        a garbled vector.  See bug #20223 for one such situation.
+        Here we force 'this_single_command_key_start' to never become
+        negative, to avoid that.  */
+      if (this_single_command_key_start < 0)
+       this_single_command_key_start = 0;
 
       /* Look for this sequence in input-decode-map.
         Scan from indec.end until we find a bound suffix.  */
@@ -11477,6 +11492,7 @@ for that character after that prefix key.  */);
               doc: /* Form to evaluate when Emacs starts up.
 Useful to set before you dump a modified Emacs.  */);
   Vtop_level = Qnil;
+  XSYMBOL (Qtop_level)->declared_special = false;
 
   DEFVAR_KBOARD ("keyboard-translate-table", Vkeyboard_translate_table,
                  doc: /* Translate table for local keyboard input, or nil.