]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix display of working text on NS (Bug#23412, Bug#1453)
authorMasahiro Nakamura <tsuucat@icloud.com>
Wed, 18 Dec 2019 15:32:54 +0000 (00:32 +0900)
committerAlan Third <alan@idiocy.org>
Sun, 22 Dec 2019 11:47:29 +0000 (11:47 +0000)
* lisp/term/ns-win.el (ns-insert-working-text):
(ns-delete-working-text): Change how working text is deleted to handle
changed order of operations.
* src/nsterm.m ([EmacsView insertText:]): Move deletion of working
text until after insertion of new text.

Copyright-paperwork-exempt: yes

lisp/term/ns-win.el
src/nsterm.m

index 1841e679ac83dc8c62e0709afd06f1ed152f7a68..81e9a0cc9a88f9cc402d66c1f37646f2c291db54 100644 (file)
@@ -316,10 +316,9 @@ The overlay is assigned the face `ns-working-text-face'."
   (interactive)
   (ns-delete-working-text)
   (let ((start (point)))
-    (insert ns-working-text)
-    (overlay-put (setq ns-working-overlay (make-overlay start (point)
-                                                       (current-buffer) nil t))
-                'face 'ns-working-text-face)))
+    (overlay-put (setq ns-working-overlay (make-overlay start (point)))
+                 'after-string
+                 (propertize ns-working-text 'face 'ns-working-text-face))))
 
 (defun ns-echo-working-text ()
   "Echo contents of `ns-working-text' in message display area.
@@ -342,8 +341,7 @@ See `ns-insert-working-text'."
          ;; Still alive?
          (overlay-buffer ns-working-overlay))
     (with-current-buffer (overlay-buffer ns-working-overlay)
-      (delete-region (overlay-start ns-working-overlay)
-                     (overlay-end ns-working-overlay))
+      (overlay-put ns-working-overlay 'after-string nil)
       (delete-overlay ns-working-overlay)))
    ((integerp ns-working-overlay)
     (let ((msg (current-message))
index 6995577920e27a856754c387927d3a46bd076106..9e036aa16081fee94a812422aee98d296e8535de 100644 (file)
@@ -6460,10 +6460,6 @@ not_in_argv (NSString *arg)
   if (!emacs_event)
     return;
 
-  /* First, clear any working text.  */
-  if (workingText != nil)
-    [self deleteWorkingText];
-
   /* It might be preferable to use getCharacters:range: below,
      cf. https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CocoaPerformance/Articles/StringDrawing.html#//apple_ref/doc/uid/TP40001445-112378.
      However, we probably can't use SAFE_NALLOCA here because it might
@@ -6492,6 +6488,10 @@ not_in_argv (NSString *arg)
       emacs_event->code = code;
       EV_TRAILER ((id)nil);
     }
+
+  /* Last, clear any working text.  */
+  if (workingText != nil)
+    [self deleteWorkingText];
 }