1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-18 11:50:38 -08:00

Fix display of working text on NS (Bug#23412, Bug#1453)

* 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
This commit is contained in:
Masahiro Nakamura 2019-12-19 00:32:54 +09:00 committed by Alan Third
parent bfc54230c5
commit ba042176d8
2 changed files with 8 additions and 10 deletions

View file

@ -316,10 +316,9 @@ The overlay is assigned the face `ns-working-text-face'."
(interactive) (interactive)
(ns-delete-working-text) (ns-delete-working-text)
(let ((start (point))) (let ((start (point)))
(insert ns-working-text) (overlay-put (setq ns-working-overlay (make-overlay start (point)))
(overlay-put (setq ns-working-overlay (make-overlay start (point) 'after-string
(current-buffer) nil t)) (propertize ns-working-text 'face 'ns-working-text-face))))
'face 'ns-working-text-face)))
(defun ns-echo-working-text () (defun ns-echo-working-text ()
"Echo contents of `ns-working-text' in message display area. "Echo contents of `ns-working-text' in message display area.
@ -342,8 +341,7 @@ See `ns-insert-working-text'."
;; Still alive? ;; Still alive?
(overlay-buffer ns-working-overlay)) (overlay-buffer ns-working-overlay))
(with-current-buffer (overlay-buffer ns-working-overlay) (with-current-buffer (overlay-buffer ns-working-overlay)
(delete-region (overlay-start ns-working-overlay) (overlay-put ns-working-overlay 'after-string nil)
(overlay-end ns-working-overlay))
(delete-overlay ns-working-overlay))) (delete-overlay ns-working-overlay)))
((integerp ns-working-overlay) ((integerp ns-working-overlay)
(let ((msg (current-message)) (let ((msg (current-message))

View file

@ -6460,10 +6460,6 @@ not_in_argv (NSString *arg)
if (!emacs_event) if (!emacs_event)
return; return;
/* First, clear any working text. */
if (workingText != nil)
[self deleteWorkingText];
/* It might be preferable to use getCharacters:range: below, /* 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. 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 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; emacs_event->code = code;
EV_TRAILER ((id)nil); EV_TRAILER ((id)nil);
} }
/* Last, clear any working text. */
if (workingText != nil)
[self deleteWorkingText];
} }