aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Möllmann2024-10-21 11:21:17 +0200
committerGerd Möllmann2024-10-22 06:40:20 +0200
commit0012e555d963b1df2d2c8be9f515ddf09417e110 (patch)
tree54f7cc12ab40c8de1f77697db806e417efce9ef5
parent6aa203bb04fa75e7562064e9261d7760c1b6562a (diff)
downloademacs-0012e555d963b1df2d2c8be9f515ddf09417e110.tar.gz
emacs-0012e555d963b1df2d2c8be9f515ddf09417e110.zip
Don't set internal_last_event_frame to nil
* src/frame.c (do_switch_frame): Do not set internal_last_event_frame to nil on ttys.
-rw-r--r--src/frame.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/frame.c b/src/frame.c
index 69ffc53ebbf..1cdd923150d 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1792,8 +1792,29 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor
1792 (select-window (frame-root-window (make-frame))) doesn't end up 1792 (select-window (frame-root-window (make-frame))) doesn't end up
1793 with your typing being interpreted in the new frame instead of 1793 with your typing being interpreted in the new frame instead of
1794 the one you're actually typing in. */ 1794 the one you're actually typing in. */
1795 if (!frame_ancestor_p (f, sf)) 1795
1796 internal_last_event_frame = Qnil; 1796 /* FIXME/tty: I don't understand this. Setting the last event
1797 frame to nil leads to switch-frame events being generated even
1798 if they normally wouldn't because the frame in question equals
1799 selected-frame. This leads to problems at least on ttys.
1800
1801 Imagine that we have functions on post-command-hook that use
1802 with-selected-window (which is the case with Vertico-Posframe),
1803 Secondly, let these functions select/restore windows on different
1804 frames, so there will be select-frame calls with different frames
1805 during the execution of post-command-hook. Setting
1806 internal_last_event_frame to nil makes these select-frame calls
1807 potentially generate switch-frame events (but only in one direction
1808 (frame_ancestor_p), which I also don't understand).
1809
1810 These switch-frame events form an endless loop in command_loop_1 by
1811 running post-command-hook, which generates switch-frame events,
1812 which command_loop_1 finds (bound to '#ignore) and executes, which
1813 again runs post-command-hook etc. ad infinitum. */
1814
1815 if (!is_tty_frame (f))
1816 if (!frame_ancestor_p (f, sf))
1817 internal_last_event_frame = Qnil;
1797 1818
1798 return frame; 1819 return frame;
1799} 1820}