]> granicus.if.org Git - vim/commitdiff
patch 8.1.2179: pressing "q" at the more prompt doesn't stop Python output v8.1.2179
authorBram Moolenaar <Bram@vim.org>
Sat, 19 Oct 2019 13:18:44 +0000 (15:18 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 19 Oct 2019 13:18:44 +0000 (15:18 +0200)
Problem:    Pressing "q" at the more prompt doesn't stop Python output. (Daniel
            Hahler)
Solution:   Check for got_int in writer(). (closes #5053)
            Also do this for Lua.

src/if_lua.c
src/if_py_both.h
src/version.c

index 4c0eb42a49b43f02f136aa4156a283e926565e51..31d9659236dc7fc79a78858583d90d6c8aff5cd6 100644 (file)
@@ -1612,7 +1612,8 @@ luaV_print(lua_State *L)
        lua_pop(L, 1);
     }
     luaL_pushresult(&b);
-    luaV_msg(L);
+    if (!got_int)
+       luaV_msg(L);
     return 0;
 }
 
index aa44bf8e31493a6c862b6b1e9df2bac4aae509dc..ee848f9f8bddc88e646ed49edf62bb795f5e4325 100644 (file)
@@ -375,9 +375,13 @@ writer(writefn fn, char_u *str, PyInt n)
        PythonIO_Flush();
     old_fn = fn;
 
-    /* Write each NL separated line.  Text after the last NL is kept for
-     * writing later. */
-    while (n > 0 && (ptr = memchr(str, '\n', n)) != NULL)
+    // Write each NL separated line.  Text after the last NL is kept for
+    // writing later.
+    // For normal messages: Do not output when "got_int" was set.  This avoids
+    // a loop gone crazy flooding the terminal with messages.  Also for when
+    // "q" is pressed at the more-prompt.
+    while (n > 0 && (ptr = memchr(str, '\n', n)) != NULL
+                                         && (fn == (writefn)emsg || !got_int))
     {
        PyInt len = ptr - str;
 
@@ -392,8 +396,9 @@ writer(writefn fn, char_u *str, PyInt n)
        io_ga.ga_len = 0;
     }
 
-    /* Put the remaining text into io_ga for later printing. */
-    if (n > 0 && ga_grow(&io_ga, (int)(n + 1)) == OK)
+    // Put the remaining text into io_ga for later printing.
+    if (n > 0 && (fn == (writefn)emsg || !got_int)
+                                       && ga_grow(&io_ga, (int)(n + 1)) == OK)
     {
        mch_memmove(((char *)io_ga.ga_data) + io_ga.ga_len, str, (size_t)n);
        io_ga.ga_len += (int)n;
index 6a58b3db0e8d143394c2fb07ef96c41f70c1f94d..38f82778b39ef842f620563b9a2221e4a915b98a 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2179,
 /**/
     2178,
 /**/