diff src/event-stream.c @ 757:516c347c4479

[xemacs-hg @ 2002-02-22 17:13:59 by michaels] 2002-02-13 Ben Wing <ben@xemacs.org> * event-stream.c (reset_key_echo): * event-stream.c (reset_this_command_keys): * event-stream.c (execute_command_event): If console is dead as a result of C-x 5 0, then post-command stuff needs to be careful and do only non-console-specific stuff.
author michaels
date Fri, 22 Feb 2002 17:14:00 +0000
parents b1f74adcc1ff
children 943eaba38521
line wrap: on
line diff
--- a/src/event-stream.c	Fri Feb 22 17:12:27 2002 +0000
+++ b/src/event-stream.c	Fri Feb 22 17:14:00 2002 +0000
@@ -704,7 +704,8 @@
   /* This function can GC */
   struct frame *f = selected_frame ();
 
-  command_builder->echo_buf_index = -1;
+  if (command_builder)
+    command_builder->echo_buf_index = -1;
 
   if (remove_echo_area_echo)
     clear_echo_area (f, Qcommand, 0);
@@ -3491,16 +3492,24 @@
 void
 reset_this_command_keys (Lisp_Object console, int clear_echo_area_p)
 {
-  struct command_builder *command_builder =
-    XCOMMAND_BUILDER (XCONSOLE (console)->command_builder);
-
-  reset_key_echo (command_builder, clear_echo_area_p);
+  if (!NILP (console))
+    {
+      /* console is nil if we just deleted the console as a result of C-x 5
+	 0.  Unfortunately things are currently in a messy situation where
+	 some stuff is console-local and other stuff isn't, so we need to
+	 do everything that's not console-local. */
+      struct command_builder *command_builder =
+	XCOMMAND_BUILDER (XCONSOLE (console)->command_builder);
+
+      reset_key_echo (command_builder, clear_echo_area_p);
+      reset_current_events (command_builder);
+    }
+  else
+    reset_key_echo (0, clear_echo_area_p);
 
   deallocate_event_chain (Vthis_command_keys);
   Vthis_command_keys = Qnil;
   Vthis_command_keys_tail = Qnil;
-
-  reset_current_events (command_builder);
 }
 
 static void
@@ -3904,7 +3913,8 @@
 
     post_command_hook ();
 
-    if (!NILP (con->prefix_arg))
+    /* Console might have been deleted by command */
+    if (CONSOLE_LIVE_P (con) && !NILP (con->prefix_arg))
       {
 	/* Commands that set the prefix arg don't update last-command, don't
 	   reset the echoing state, and don't go into keyboard macros unless
@@ -3933,7 +3943,8 @@
 	   so we don't either */
 
 	if (!is_scrollbar_event (event))
-	  reset_this_command_keys (make_console (con), 0);
+	  reset_this_command_keys (CONSOLE_LIVE_P (con) ? make_console (con)
+				   : Qnil, 0);
       }
   }