aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMasahiro Nakamura2020-02-14 03:21:15 +0900
committerAlan Third2020-02-19 11:07:58 +0000
commitb3de1302ca347b95fe6aa2608aba550292d32353 (patch)
tree01069f069780a62207ec49924d264ea7c6297126
parent1a75e8b7e0d3159dea43c11748e0492ee4d3d929 (diff)
downloademacs-b3de1302ca347b95fe6aa2608aba550292d32353.tar.gz
emacs-b3de1302ca347b95fe6aa2608aba550292d32353.zip
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,
2901 example banishing the mouse under mouse-avoidance-mode. */ 2901 example banishing the mouse under mouse-avoidance-mode. */
2902 timer_resume_idle (); 2902 timer_resume_idle ();
2903 2903
2904#ifdef HAVE_NS
2905 if (CONSP (c)
2906 && (EQ (XCAR (c), intern ("ns-unput-working-text"))))
2907 input_was_pending = input_pending;
2908#endif
2909
2904 if (current_buffer != prev_buffer) 2910 if (current_buffer != prev_buffer)
2905 { 2911 {
2906 /* The command may have changed the keymaps. Pretend there 2912 /* 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)
6457 if (!emacs_event) 6457 if (!emacs_event)
6458 return; 6458 return;
6459 6459
6460 /* First, clear any working text. */
6461 if (workingText != nil)
6462 [self deleteWorkingText];
6463
6460 /* It might be preferable to use getCharacters:range: below, 6464 /* It might be preferable to use getCharacters:range: below,
6461 cf. https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CocoaPerformance/Articles/StringDrawing.html#//apple_ref/doc/uid/TP40001445-112378. 6465 cf. https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CocoaPerformance/Articles/StringDrawing.html#//apple_ref/doc/uid/TP40001445-112378.
6462 However, we probably can't use SAFE_NALLOCA here because it might 6466 However, we probably can't use SAFE_NALLOCA here because it might
@@ -6485,10 +6489,6 @@ not_in_argv (NSString *arg)
6485 emacs_event->code = code; 6489 emacs_event->code = code;
6486 EV_TRAILER ((id)nil); 6490 EV_TRAILER ((id)nil);
6487 } 6491 }
6488
6489 /* Last, clear any working text. */
6490 if (workingText != nil)
6491 [self deleteWorkingText];
6492} 6492}
6493 6493
6494 6494
@@ -6584,13 +6584,18 @@ not_in_argv (NSString *arg)
6584{ 6584{
6585 NSRect rect; 6585 NSRect rect;
6586 NSPoint pt; 6586 NSPoint pt;
6587 struct window *win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe)); 6587 struct window *win;
6588 6588
6589 NSTRACE ("[EmacsView firstRectForCharacterRange:]"); 6589 NSTRACE ("[EmacsView firstRectForCharacterRange:]");
6590 6590
6591 if (NS_KEYLOG) 6591 if (NS_KEYLOG)
6592 NSLog (@"firstRectForCharRange request"); 6592 NSLog (@"firstRectForCharRange request");
6593 6593
6594 if (WINDOWP (echo_area_window) && ! NILP (call0 (intern ("ns-in-echo-area"))))
6595 win = XWINDOW (echo_area_window);
6596 else
6597 win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
6598
6594 rect.size.width = theRange.length * FRAME_COLUMN_WIDTH (emacsframe); 6599 rect.size.width = theRange.length * FRAME_COLUMN_WIDTH (emacsframe);
6595 rect.size.height = FRAME_LINE_HEIGHT (emacsframe); 6600 rect.size.height = FRAME_LINE_HEIGHT (emacsframe);
6596 pt.x = WINDOW_TEXT_TO_FRAME_PIXEL_X (win, win->phys_cursor.x); 6601 pt.x = WINDOW_TEXT_TO_FRAME_PIXEL_X (win, win->phys_cursor.x);
@@ -6697,8 +6702,6 @@ not_in_argv (NSString *arg)
6697 6702
6698 NSTRACE ("[EmacsView mouseDown:]"); 6703 NSTRACE ("[EmacsView mouseDown:]");
6699 6704
6700 [self deleteWorkingText];
6701
6702 if (!emacs_event) 6705 if (!emacs_event)
6703 return; 6706 return;
6704 6707
@@ -7325,7 +7328,6 @@ not_in_argv (NSString *arg)
7325 7328
7326 if (emacs_event && is_focus_frame) 7329 if (emacs_event && is_focus_frame)
7327 { 7330 {
7328 [self deleteWorkingText];
7329 emacs_event->kind = FOCUS_OUT_EVENT; 7331 emacs_event->kind = FOCUS_OUT_EVENT;
7330 EV_TRAILER ((id)nil); 7332 EV_TRAILER ((id)nil);
7331 } 7333 }