summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-10-19 15:18:44 +0200
committerBram Moolenaar <Bram@vim.org>2019-10-19 15:18:44 +0200
commitb98678a974914aaf1d00b575364c13a6446353bf (patch)
tree2a9a00300b93f1899fef5c410fcde4a908119461
parent15ee567809a9808693163dd7c357ef0c172ecc9e (diff)
downloadvim-git-b98678a974914aaf1d00b575364c13a6446353bf.tar.gz
patch 8.1.2179: pressing "q" at the more prompt doesn't stop Python outputv8.1.2179
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.
-rw-r--r--src/if_lua.c3
-rw-r--r--src/if_py_both.h15
-rw-r--r--src/version.c2
3 files changed, 14 insertions, 6 deletions
diff --git a/src/if_lua.c b/src/if_lua.c
index 4c0eb42a4..31d965923 100644
--- a/src/if_lua.c
+++ b/src/if_lua.c
@@ -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;
}
diff --git a/src/if_py_both.h b/src/if_py_both.h
index aa44bf8e3..ee848f9f8 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -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;
diff --git a/src/version.c b/src/version.c
index 6a58b3db0..38f82778b 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2179,
+/**/
2178,
/**/
2177,