Mercurial > vim
comparison src/if_py_both.h @ 18370:026034963159 v8.1.2179
patch 8.1.2179: pressing "q" at the more prompt doesn't stop Python output
Commit: https://github.com/vim/vim/commit/b98678a974914aaf1d00b575364c13a6446353bf
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Oct 19 15:18:44 2019 +0200
patch 8.1.2179: pressing "q" at the more prompt doesn't stop Python output
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 19 Oct 2019 15:30:04 +0200 |
parents | 4d63d47d87ef |
children | 6e3dc2d630c2 |
comparison
equal
deleted
inserted
replaced
18369:dbe92b7679db | 18370:026034963159 |
---|---|
373 /* Flush when switching output function. */ | 373 /* Flush when switching output function. */ |
374 if (fn != old_fn) | 374 if (fn != old_fn) |
375 PythonIO_Flush(); | 375 PythonIO_Flush(); |
376 old_fn = fn; | 376 old_fn = fn; |
377 | 377 |
378 /* Write each NL separated line. Text after the last NL is kept for | 378 // Write each NL separated line. Text after the last NL is kept for |
379 * writing later. */ | 379 // writing later. |
380 while (n > 0 && (ptr = memchr(str, '\n', n)) != NULL) | 380 // For normal messages: Do not output when "got_int" was set. This avoids |
381 // a loop gone crazy flooding the terminal with messages. Also for when | |
382 // "q" is pressed at the more-prompt. | |
383 while (n > 0 && (ptr = memchr(str, '\n', n)) != NULL | |
384 && (fn == (writefn)emsg || !got_int)) | |
381 { | 385 { |
382 PyInt len = ptr - str; | 386 PyInt len = ptr - str; |
383 | 387 |
384 if (ga_grow(&io_ga, (int)(len + 1)) == FAIL) | 388 if (ga_grow(&io_ga, (int)(len + 1)) == FAIL) |
385 break; | 389 break; |
390 str = ptr + 1; | 394 str = ptr + 1; |
391 n -= len + 1; | 395 n -= len + 1; |
392 io_ga.ga_len = 0; | 396 io_ga.ga_len = 0; |
393 } | 397 } |
394 | 398 |
395 /* Put the remaining text into io_ga for later printing. */ | 399 // Put the remaining text into io_ga for later printing. |
396 if (n > 0 && ga_grow(&io_ga, (int)(n + 1)) == OK) | 400 if (n > 0 && (fn == (writefn)emsg || !got_int) |
401 && ga_grow(&io_ga, (int)(n + 1)) == OK) | |
397 { | 402 { |
398 mch_memmove(((char *)io_ga.ga_data) + io_ga.ga_len, str, (size_t)n); | 403 mch_memmove(((char *)io_ga.ga_data) + io_ga.ga_len, str, (size_t)n); |
399 io_ga.ga_len += (int)n; | 404 io_ga.ga_len += (int)n; |
400 } | 405 } |
401 } | 406 } |