comparison src/keyboard.c @ 23047:fc5f85abc044

(Freset_this_command_lengths): Return nil. (read_char): [All these changes are in the input method code.] Process and clear before_command_restore_flag before the input method. Save and restore ok_to_echo_at_next_pause and current_kboard->echo_after_prompt. Save, copy and empty this_command_keys, if it is not empty. Clear the echo area before the input method. Then in all cases restore this_command_keys, and reenable echoing if it was enabled before.
author Richard M. Stallman <rms@gnu.org>
date Mon, 17 Aug 1998 07:04:41 +0000
parents c7c48ac2e34b
children 26b311ef19c6
comparison
equal deleted inserted replaced
23046:87169117f80c 23047:fc5f85abc044
2361 && ! NILP (Vinput_method_function) 2361 && ! NILP (Vinput_method_function)
2362 && (unsigned) XINT (c) >= ' ' 2362 && (unsigned) XINT (c) >= ' '
2363 && (unsigned) XINT (c) < 127) 2363 && (unsigned) XINT (c) < 127)
2364 { 2364 {
2365 Lisp_Object keys; 2365 Lisp_Object keys;
2366 int key_count = this_command_key_count; 2366 int key_count;
2367 int saved = current_kboard->immediate_echo;
2368 struct gcpro gcpro1; 2367 struct gcpro gcpro1;
2369 2368
2370 keys = Fcopy_sequence (this_command_keys); 2369 /* Save the echo status. */
2370 int saved_immediate_echo = current_kboard->immediate_echo;
2371 char *saved_ok_to_echo = ok_to_echo_at_next_pause;
2372 int saved_echo_after_prompt = current_kboard->echo_after_prompt;
2373
2374 if (before_command_restore_flag)
2375 {
2376 this_command_key_count = before_command_key_count_1;
2377 if (this_command_key_count < this_single_command_key_start)
2378 this_single_command_key_start = this_command_key_count;
2379 echo_truncate (before_command_echo_length_1);
2380 before_command_restore_flag = 0;
2381 }
2382
2383 /* Save the this_command_keys status. */
2384 key_count = this_command_key_count;
2385
2386 if (key_count > 0)
2387 keys = Fcopy_sequence (this_command_keys);
2388 else
2389 keys = Qnil;
2371 GCPRO1 (keys); 2390 GCPRO1 (keys);
2391
2392 /* Clear out this_command_keys. */
2393 this_command_key_count = 0;
2394
2395 /* Now wipe the echo area. */
2396 if (echo_area_glyphs)
2397 safe_run_hooks (Qecho_area_clear_hook);
2398 echo_area_glyphs = 0;
2399 echo_truncate (0);
2400
2401 /* Call the input method. */
2372 tem = call1 (Vinput_method_function, c); 2402 tem = call1 (Vinput_method_function, c);
2403
2404 /* Restore the saved echoing state
2405 and this_command_keys state. */
2406 this_command_key_count = key_count;
2407 if (key_count > 0)
2408 this_command_keys = keys;
2409
2410 cancel_echoing ();
2411 ok_to_echo_at_next_pause = saved_ok_to_echo;
2412 current_kboard->echo_after_prompt = saved_echo_after_prompt;
2413 if (saved_immediate_echo)
2414 echo_now ();
2415
2373 UNGCPRO; 2416 UNGCPRO;
2374 current_kboard->immediate_echo = saved; 2417
2375 /* The input method can return no events. */ 2418 /* The input method can return no events. */
2376 if (! CONSP (tem)) 2419 if (! CONSP (tem))
2377 { 2420 {
2378 /* Bring back the previous message, if any. */ 2421 /* Bring back the previous message, if any. */
2379 if (! NILP (Vinput_method_previous_message)) 2422 if (! NILP (echo_area_message))
2380 message_with_string ("%s", echo_area_message, 0); 2423 message_with_string ("%s", echo_area_message, 0);
2381 this_command_keys = keys;
2382 this_command_key_count = key_count;
2383 cancel_echoing ();
2384 goto retry; 2424 goto retry;
2385 } 2425 }
2386 /* It returned one event or more. */ 2426 /* It returned one event or more. */
2387 c = XCONS (tem)->car; 2427 c = XCONS (tem)->car;
2388 Vunread_post_input_method_events 2428 Vunread_post_input_method_events
8173 () 8213 ()
8174 { 8214 {
8175 before_command_restore_flag = 1; 8215 before_command_restore_flag = 1;
8176 before_command_key_count_1 = before_command_key_count; 8216 before_command_key_count_1 = before_command_key_count;
8177 before_command_echo_length_1 = before_command_echo_length; 8217 before_command_echo_length_1 = before_command_echo_length;
8218 return Qnil;
8178 } 8219 }
8179 8220
8180 DEFUN ("recursion-depth", Frecursion_depth, Srecursion_depth, 0, 0, 0, 8221 DEFUN ("recursion-depth", Frecursion_depth, Srecursion_depth, 0, 0, 0,
8181 "Return the current depth in recursive edits.") 8222 "Return the current depth in recursive edits.")
8182 () 8223 ()