changeset 98059:fa8fea8ec49a

(ispell-command-loop): Suspend ispell if the user enters a mouse event in another frame, or a special event.
author Chong Yidong <cyd@stupidchicken.com>
date Sat, 06 Sep 2008 20:07:49 +0000
parents f5d9629680f8
children 5cc38a558cdd
files lisp/textmodes/ispell.el
diffstat 1 files changed, 17 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/textmodes/ispell.el	Sat Sep 06 20:07:40 2008 +0000
+++ b/lisp/textmodes/ispell.el	Sat Sep 06 20:07:49 2008 +0000
@@ -1858,14 +1858,23 @@
 		  (let (message-log-max)
 		    (message (concat "C-h or ? for more options; SPC to leave "
 				     "unchanged, Character to replace word")))
-		  (let ((inhibit-quit t))
-		    (setq char (if (fboundp 'read-char-exclusive)
-				   (read-char-exclusive)
-				 (read-char))
-			  skipped 0)
-		    (if (or quit-flag (= char ?\C-g)) ; C-g is like typing X
-			(setq char ?X
-			      quit-flag nil)))
+		  (let ((inhibit-quit t)
+			(input-valid t))
+		    (setq char nil skipped 0)
+		    ;; If the user types C-g, or generates some other
+		    ;; non-character event (such as a frame switch
+		    ;; event), stop ispell.  As a special exception,
+		    ;; ignore mouse events occuring in the same frame.
+		    (while (and input-valid (not (characterp char)))
+		      (setq char (read-event))
+		      (setq input-valid
+			    (or (characterp char)
+				(and (mouse-event-p char)
+				     (eq (selected-frame)
+					 (window-frame
+					  (posn-window (event-start char))))))))
+		    (when (or quit-flag (not input-valid) (= char ?\C-g))
+		      (setq char ?X quit-flag nil)))
 		  ;; Adjust num to array offset skipping command characters.
 		  (let ((com-chars command-characters))
 		    (while com-chars