/[emacs]/emacs/src/keyboard.c
ViewVC logotype

Diff of /emacs/src/keyboard.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.644 by pj, Tue Dec 18 06:25:27 2001 UTC revision 1.645 by kfstorm, Tue Dec 25 23:38:23 2001 UTC
# Line 2982  static void Line 2982  static void
2982  record_char (c)  record_char (c)
2983       Lisp_Object c;       Lisp_Object c;
2984  {  {
2985    /* Don't record `help-echo' in recent_keys unless it shows some help    int recorded = 0;
2986       message, and a different help than the previoiusly recorded  
2987       event.  */    if (CONSP (c) && (EQ (XCAR (c), Qhelp_echo) || EQ (XCAR (c), Qmouse_movement)))
   if (CONSP (c) && EQ (XCAR (c), Qhelp_echo))  
2988      {      {
2989        Lisp_Object help;        /* To avoid filling recent_keys with help-echo and mouse-movement
2990             events, we filter out repeated help-echo events, only store the
2991             first and last in a series of mouse-movement events, and don't
2992             store repeated help-echo events which are only separated by
2993             mouse-movement events.  */
2994    
2995        help = Fcar (Fcdr (XCDR (c)));        Lisp_Object ev1, ev2, ev3;
2996        if (STRINGP (help))        int ix1, ix2, ix3;
2997          
2998          if ((ix1 = recent_keys_index - 1) < 0)
2999            ix1 = NUM_RECENT_KEYS - 1;
3000          ev1 = AREF (recent_keys, ix1);
3001          
3002          if ((ix2 = ix1 - 1) < 0)
3003            ix2 = NUM_RECENT_KEYS - 1;
3004          ev2 = AREF (recent_keys, ix2);
3005          
3006          if ((ix3 = ix2 - 1) < 0)
3007            ix3 = NUM_RECENT_KEYS - 1;
3008          ev3 = AREF (recent_keys, ix3);
3009        
3010          if (EQ (XCAR (c), Qhelp_echo))
3011            {
3012              /* Don't record `help-echo' in recent_keys unless it shows some help
3013                 message, and a different help than the previoiusly recorded
3014                 event.  */
3015              Lisp_Object help, last_help;
3016    
3017              help = Fcar_safe (Fcdr_safe (XCDR (c)));
3018              if (!STRINGP (help))
3019                recorded = 1;
3020              else if (CONSP (ev1) && EQ (XCAR (ev1), Qhelp_echo)
3021                       && (last_help = Fcar_safe (Fcdr_safe (XCDR (ev1))), EQ (last_help, help)))
3022                recorded = 1;
3023              else if (CONSP (ev1) && EQ (XCAR (ev1), Qmouse_movement)
3024                       && CONSP (ev2) && EQ (XCAR (ev2), Qhelp_echo)
3025                       && (last_help = Fcar_safe (Fcdr_safe (XCDR (ev2))), EQ (last_help, help)))
3026                recorded = -1;
3027              else if (CONSP (ev1) && EQ (XCAR (ev1), Qmouse_movement)
3028                       && CONSP (ev2) && EQ (XCAR (ev2), Qmouse_movement)
3029                       && CONSP (ev3) && EQ (XCAR (ev3), Qhelp_echo)
3030                       && (last_help = Fcar_safe (Fcdr_safe (XCDR (ev3))), EQ (last_help, help)))
3031                recorded = -2;
3032            }
3033          else if (EQ (XCAR (c), Qmouse_movement))
3034          {          {
3035            int last_idx;            /* Only record one pair of `mouse-movement' on a window in recent_keys.
3036            Lisp_Object last_c, last_help;               So additional mouse movement events replace the last element.  */
3037                        Lisp_Object last_window, window;
3038            last_idx = recent_keys_index - 1;  
3039            if (last_idx < 0)            window = Fcar_safe (Fcar_safe (XCDR (c)));
3040              last_idx = NUM_RECENT_KEYS - 1;            if (CONSP (ev1) && EQ (XCAR (ev1), Qmouse_movement)
3041            last_c = AREF (recent_keys, last_idx);                && (last_window = Fcar_safe (Fcar_safe (XCDR (ev1))), EQ (last_window, window))
3042                            && CONSP (ev2) && EQ (XCAR (ev2), Qmouse_movement)
3043            if (!CONSP (last_c)                && (last_window = Fcar_safe (Fcar_safe (XCDR (ev2))), EQ (last_window, window)))
               || !EQ (XCAR (last_c), Qhelp_echo)  
               || (last_help = Fcar (Fcdr (XCDR (last_c))),  
                   !EQ (last_help, help)))  
3044              {              {
3045                total_keys++;                ASET (recent_keys, ix1, c);
3046                ASET (recent_keys, recent_keys_index, c);                recorded = 1;
               if (++recent_keys_index >= NUM_RECENT_KEYS)  
                 recent_keys_index = 0;  
3047              }              }
3048          }          }
3049      }      }
3050    else    else
3051        store_kbd_macro_char (c);
3052    
3053      if (!recorded)
3054      {      {
3055        total_keys++;        total_keys++;
3056        ASET (recent_keys, recent_keys_index, c);        ASET (recent_keys, recent_keys_index, c);
3057        if (++recent_keys_index >= NUM_RECENT_KEYS)        if (++recent_keys_index >= NUM_RECENT_KEYS)
3058          recent_keys_index = 0;          recent_keys_index = 0;
3059      }      }
3060      else if (recorded < 0)
3061        {
3062          /* We need to remove one or two events from recent_keys.
3063             To do this, we simply put nil at those events and move the
3064             recent_keys_index backwards over those events.  Usually,
3065             users will never see those nil events, as they will be
3066             overwritten by the command keys entered to see recent_keys
3067             (e.g. C-h l).  */
3068    
3069          while (recorded++ < 0 && total_keys > 0)
3070            {
3071              if (total_keys < NUM_RECENT_KEYS)
3072                total_keys--;
3073              if (--recent_keys_index < 0)
3074                recent_keys_index = NUM_RECENT_KEYS - 1;
3075              ASET (recent_keys, recent_keys_index, Qnil);
3076            }
3077        }
3078    
3079      num_nonmacro_input_events++;
3080                
3081    /* Write c to the dribble file.  If c is a lispy event, write    /* Write c to the dribble file.  If c is a lispy event, write
3082       the event's symbol to the dribble file, in <brackets>.  Bleaugh.       the event's symbol to the dribble file, in <brackets>.  Bleaugh.
# Line 3051  record_char (c) Line 3109  record_char (c)
3109    
3110        fflush (dribble);        fflush (dribble);
3111      }      }
   
   if (!CONSP (c) || !EQ (Qhelp_echo, XCAR (c)))  
     store_kbd_macro_char (c);  
   
   num_nonmacro_input_events++;  
3112  }  }
3113    
3114  Lisp_Object  Lisp_Object

Legend:
Removed from v.1.644  
changed lines
  Added in v.1.645

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26