]> git.eshelyaron.com Git - emacs.git/commitdiff
(ispell-word): If we replace the word, move point to the end.
authorRichard M. Stallman <rms@gnu.org>
Wed, 26 Jul 2006 17:11:07 +0000 (17:11 +0000)
committerRichard M. Stallman <rms@gnu.org>
Wed, 26 Jul 2006 17:11:07 +0000 (17:11 +0000)
Insert before deleting.

lisp/textmodes/ispell.el

index a4d873a543d83ae5de20cc8bda6a7f7b0ad9a767..a0eb147d9c86b24a318a9644977d969e0a5dbe75 100644 (file)
@@ -1650,9 +1650,15 @@ quit          spell session exited."
                                             cursor-location))
                    (if (not (equal new-word (car poss)))
                        (progn
-                         (delete-region start end)
-                         (setq start (point))
+                         (goto-char start)
+                         ;; Insert first and then delete,
+                         ;; to avoid collapsing markers before and after
+                         ;; into a single place.
                          (ispell-insert-word new-word)
+                         (delete-region (point) (+ (point) (- end start)))
+                         ;; It is meaningless to preserve the cursor position
+                         ;; inside a word that has changed.
+                         (setq cursor-location (point))
                          (setq end (point))))
                    (if (not (atom replace)) ;recheck spelling of replacement
                        (progn