]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0548: GTK4: terminal and pty job output is not processed v9.2.0548
authorFoxe Chen <chen.foxe@gmail.com>
Thu, 28 May 2026 19:29:55 +0000 (19:29 +0000)
committerChristian Brabandt <cb@256bit.org>
Thu, 28 May 2026 19:29:55 +0000 (19:29 +0000)
Problem:  GTK4: terminal and pty job output is not processed
Solution: When there is at least one channel with the keep_open flag,
          arm a 20ms timer that calls channel_handle_events() and
          parse_queued_messages(), matching the behaviour of the GTK2/3
          backend (Foxe Chen).

fixes:  #20345
closes: #20350

Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/gui_gtk4.c
src/version.c

index 2b09ce1ce8d41a31fe6c1a7befc3311287419103..e87733728d9c0a874155897fb57cda4dd8bb341a 100644 (file)
@@ -2132,6 +2132,18 @@ gui_mch_update(void)
        g_main_context_iteration(NULL, TRUE);
 }
 
+#ifdef FEAT_JOB_CHANNEL
+    static timeout_cb_type
+channel_poll_cb(gpointer data UNUSED)
+{
+    // Using an event handler for a channel that may be disconnected does
+    // not work, it hangs.  Instead poll for messages.
+    channel_handle_events(TRUE);
+    parse_queued_messages();
+    return TRUE; // Keep repeating
+}
+#endif
+
     int
 gui_mch_wait_for_chars(long wtime)
 {
@@ -2139,6 +2151,9 @@ gui_mch_wait_for_chars(long wtime)
     guint      timer;
     static int timed_out;
     int                retval = FAIL;
+#ifdef FEAT_JOB_CHANNEL
+    guint      channel_timer = 0;
+#endif
 
     timed_out = FALSE;
 
@@ -2148,6 +2163,13 @@ gui_mch_wait_for_chars(long wtime)
     else
        timer = 0;
 
+#ifdef FEAT_JOB_CHANNEL
+    // If there is a channel with the keep_open flag we need to poll for input
+    // on them.
+    if (channel_any_keep_open())
+       channel_timer = timeout_add(20, channel_poll_cb, NULL);
+#endif
+
     focus = gui.in_focus;
 
     do
@@ -2203,6 +2225,10 @@ gui_mch_wait_for_chars(long wtime)
 theend:
     if (timer != 0 && !timed_out)
        timeout_remove(timer);
+#ifdef FEAT_JOB_CHANNEL
+    if (channel_timer != 0)
+       timeout_remove(channel_timer);
+#endif
 
     return retval;
 }
index 5fda77f1bc270db1123a023a2a9cb285a6aabb7b..7b71661ea8fa5c4fe320c917318508625e3559a3 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    548,
 /**/
     547,
 /**/