To: vim_dev@googlegroups.com Subject: Patch 8.1.2179 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.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. Files: src/if_py_both.h, src/if_lua.c *** ../vim-8.1.2178/src/if_py_both.h 2019-09-01 16:01:25.584754569 +0200 --- src/if_py_both.h 2019-10-19 15:18:29.279034645 +0200 *************** *** 375,383 **** 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) { PyInt len = ptr - str; --- 375,387 ---- PythonIO_Flush(); old_fn = fn; ! // 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,399 **** 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) { mch_memmove(((char *)io_ga.ga_data) + io_ga.ga_len, str, (size_t)n); io_ga.ga_len += (int)n; --- 396,404 ---- io_ga.ga_len = 0; } ! // 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; *** ../vim-8.1.2178/src/if_lua.c 2019-06-23 01:46:11.840059790 +0200 --- src/if_lua.c 2019-10-19 15:14:22.475617791 +0200 *************** *** 1612,1618 **** lua_pop(L, 1); } luaL_pushresult(&b); ! luaV_msg(L); return 0; } --- 1612,1619 ---- lua_pop(L, 1); } luaL_pushresult(&b); ! if (!got_int) ! luaV_msg(L); return 0; } *** ../vim-8.1.2178/src/version.c 2019-10-19 14:34:58.122164179 +0200 --- src/version.c 2019-10-19 15:18:13.771075935 +0200 *************** *** 743,744 **** --- 743,746 ---- { /* Add new patch number below this line */ + /**/ + 2179, /**/ -- SOLDIER: Where did you get the coconuts? ARTHUR: Through ... We found them. SOLDIER: Found them? In Mercea. The coconut's tropical! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///