Skip to content

Commit 3d30af8

Browse files
committed
patch 8.2.1844: using "q" at the more prompt doesn't stop a long message
Problem: Using "q" at the more prompt doesn't stop a long message. Solution: Check for "got_int". (closes #7122)
1 parent b9616af commit 3d30af8

File tree

4 files changed

+33
-2
lines changed

4 files changed

+33
-2
lines changed

src/message.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,6 +1551,10 @@ msg_outtrans_len_attr(char_u *msgstr, int len, int attr)
15511551
char_u *s;
15521552
int mb_l;
15531553
int c;
1554+
int save_got_int = got_int;
1555+
1556+
// Only quit when got_int was set in here.
1557+
got_int = FALSE;
15541558

15551559
// if MSG_HIST flag set, add message to history
15561560
if (attr & MSG_HIST)
@@ -1568,7 +1572,7 @@ msg_outtrans_len_attr(char_u *msgstr, int len, int attr)
15681572
* Go over the string. Special characters are translated and printed.
15691573
* Normal characters are printed several at a time.
15701574
*/
1571-
while (--len >= 0)
1575+
while (--len >= 0 && !got_int)
15721576
{
15731577
if (enc_utf8)
15741578
// Don't include composing chars after the end.
@@ -1618,10 +1622,12 @@ msg_outtrans_len_attr(char_u *msgstr, int len, int attr)
16181622
}
16191623
}
16201624

1621-
if (str > plain_start)
1625+
if (str > plain_start && !got_int)
16221626
// print the printable chars at the end
16231627
msg_puts_attr_len((char *)plain_start, (int)(str - plain_start), attr);
16241628

1629+
got_int |= save_got_int;
1630+
16251631
return retval;
16261632
}
16271633

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
> +0&#ffffff0@74
2+
|~+0#4040ff13&| @73
3+
|~| @73
4+
|~| @73
5+
|~| @73
6+
| +0#0000000&@56|0|,|0|-|1| @8|A|l@1|

src/testdir/test_messages.vim

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ source check.vim
44
source shared.vim
55
source term_util.vim
66
source view_util.vim
7+
source screendump.vim
78

89
func Test_messages()
910
let oldmore = &more
@@ -309,4 +310,20 @@ func Test_mapping_at_hit_return_prompt()
309310
nunmap <C-B>
310311
endfunc
311312

313+
func Test_quit_long_message()
314+
CheckScreendump
315+
316+
let content =<< trim END
317+
echom range(9999)->join("\x01")
318+
END
319+
call writefile(content, 'Xtest_quit_message')
320+
let buf = RunVimInTerminal('-S Xtest_quit_message', #{rows: 6})
321+
call term_sendkeys(buf, "q")
322+
call VerifyScreenDump(buf, 'Test_quit_long_message', {})
323+
324+
" clean up
325+
call StopVimInTerminal(buf)
326+
call delete('Xtest_diff_rnu')
327+
endfunc
328+
312329
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
1844,
753755
/**/
754756
1843,
755757
/**/

0 commit comments

Comments
 (0)