summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasahiro Nakamura <tsuucat@icloud.com>2020-02-14 03:21:15 +0900
committerAlan Third <alan@idiocy.org>2020-02-19 11:07:58 +0000
commitb3de1302ca347b95fe6aa2608aba550292d32353 (patch)
tree01069f069780a62207ec49924d264ea7c6297126
parent1a75e8b7e0d3159dea43c11748e0492ee4d3d929 (diff)
downloademacs-b3de1302ca347b95fe6aa2608aba550292d32353.tar.gz
Fix working text related issues on NS (Bug#38851)
* src/keyboard.c (read_char): Prevent redsiplay right after ns-unput-working-text event. * src/nsterm.m ([EmacsView insertText:]): Partially revert commit ba04217. ([EmacsView firstRectForCharacterRange:]): Fix candidate window position when cursor is on echoarea. ([EmacsView mouseDown:]) ([EmacsView windowDidResignKey:]): Don't delete working text.
-rw-r--r--src/keyboard.c6
-rw-r--r--src/nsterm.m18
2 files changed, 16 insertions, 8 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index bf1f5da22d3..9dd7e00709e 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2901,6 +2901,12 @@ read_char (int commandflag, Lisp_Object map,
example banishing the mouse under mouse-avoidance-mode. */
timer_resume_idle ();
+#ifdef HAVE_NS
+ if (CONSP (c)
+ && (EQ (XCAR (c), intern ("ns-unput-working-text"))))
+ input_was_pending = input_pending;
+#endif
+
if (current_buffer != prev_buffer)
{
/* The command may have changed the keymaps. Pretend there
diff --git a/src/nsterm.m b/src/nsterm.m
index f31ba5de896..c0535825eee 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -6457,6 +6457,10 @@ 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
@@ -6485,10 +6489,6 @@ not_in_argv (NSString *arg)
emacs_event->code = code;
EV_TRAILER ((id)nil);
}
-
- /* Last, clear any working text. */
- if (workingText != nil)
- [self deleteWorkingText];
}
@@ -6584,13 +6584,18 @@ not_in_argv (NSString *arg)
{
NSRect rect;
NSPoint pt;
- struct window *win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
+ struct window *win;
NSTRACE ("[EmacsView firstRectForCharacterRange:]");
if (NS_KEYLOG)
NSLog (@"firstRectForCharRange request");
+ if (WINDOWP (echo_area_window) && ! NILP (call0 (intern ("ns-in-echo-area"))))
+ win = XWINDOW (echo_area_window);
+ else
+ win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
+
rect.size.width = theRange.length * FRAME_COLUMN_WIDTH (emacsframe);
rect.size.height = FRAME_LINE_HEIGHT (emacsframe);
pt.x = WINDOW_TEXT_TO_FRAME_PIXEL_X (win, win->phys_cursor.x);
@@ -6697,8 +6702,6 @@ not_in_argv (NSString *arg)
NSTRACE ("[EmacsView mouseDown:]");
- [self deleteWorkingText];
-
if (!emacs_event)
return;
@@ -7325,7 +7328,6 @@ not_in_argv (NSString *arg)
if (emacs_event && is_focus_frame)
{
- [self deleteWorkingText];
emacs_event->kind = FOCUS_OUT_EVENT;
EV_TRAILER ((id)nil);
}