summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/message.c18
-rw-r--r--src/proto/screen.pro2
-rw-r--r--src/screen.c19
-rw-r--r--src/testdir/dumps/Test_more_scrollback_1.dump10
-rw-r--r--src/testdir/dumps/Test_more_scrollback_2.dump10
-rw-r--r--src/testdir/test_messages.vim26
-rw-r--r--src/version.c2
7 files changed, 75 insertions, 12 deletions
diff --git a/src/message.c b/src/message.c
index 9c35543031..ee11758ff0 100644
--- a/src/message.c
+++ b/src/message.c
@@ -2913,10 +2913,11 @@ msg_sb_eol(void)
/*
* Display a screen line from previously displayed text at row "row".
+ * When "clear_to_eol" is set clear the rest of the screen line.
* Returns a pointer to the text for the next line (can be NULL).
*/
static msgchunk_T *
-disp_sb_line(int row, msgchunk_T *smp)
+disp_sb_line(int row, msgchunk_T *smp, int clear_to_eol)
{
msgchunk_T *mp = smp;
char_u *p;
@@ -2929,6 +2930,12 @@ disp_sb_line(int row, msgchunk_T *smp)
if (*p == '\n') // don't display the line break
++p;
msg_puts_display(p, -1, mp->sb_attr, TRUE);
+
+ // If clearing the screen did not work (e.g. because of a background
+ // color and t_ut isn't set) clear until the last column here.
+ if (clear_to_eol)
+ screen_fill(row, row + 1, msg_col, (int)Columns, ' ', ' ', 0);
+
if (mp->sb_eol || mp->sb_next == NULL)
break;
mp = mp->sb_next;
@@ -3279,15 +3286,16 @@ do_more_prompt(int typed_char)
(int)Rows, 0, NULL) == OK)
{
// display line at top
- (void)disp_sb_line(0, mp);
+ (void)disp_sb_line(0, mp, FALSE);
}
else
{
+ int did_clear = screenclear();
+
// redisplay all lines
- screenclear();
for (i = 0; mp != NULL && i < Rows - 1; ++i)
{
- mp = disp_sb_line(i, mp);
+ mp = disp_sb_line(i, mp, !did_clear);
++msg_scrolled;
}
}
@@ -3304,7 +3312,7 @@ do_more_prompt(int typed_char)
inc_msg_scrolled();
screen_fill((int)Rows - 2, (int)Rows - 1, 0,
(int)Columns, ' ', ' ', 0);
- mp_last = disp_sb_line((int)Rows - 2, mp_last);
+ mp_last = disp_sb_line((int)Rows - 2, mp_last, FALSE);
--toscroll;
}
}
diff --git a/src/proto/screen.pro b/src/proto/screen.pro
index 2b775372bd..d53955efc7 100644
--- a/src/proto/screen.pro
+++ b/src/proto/screen.pro
@@ -30,7 +30,7 @@ void check_for_delay(int check_msg_scroll);
int screen_valid(int doclear);
void screenalloc(int doclear);
void free_screenlines(void);
-void screenclear(void);
+int screenclear(void);
void redraw_as_cleared(void);
void line_was_clobbered(int screen_lnum);
int can_clear(char_u *p);
diff --git a/src/screen.c b/src/screen.c
index 06bda0d63a..e44da02164 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -49,7 +49,7 @@
static int screen_attr = 0;
static void screen_char_2(unsigned off, int row, int col);
-static void screenclear2(int doclear);
+static int screenclear2(int doclear);
static void lineclear(unsigned off, int width, int attr);
static void lineinvalid(unsigned off, int width);
static int win_do_lines(win_T *wp, int row, int line_count, int mayclear, int del, int clear_attr);
@@ -2473,6 +2473,7 @@ screen_fill(
|| (enc_utf8 && (int)ScreenLinesUC[off]
!= (c >= 0x80 ? c : 0))
|| ScreenAttrs[off] != attr
+ || must_redraw == UPD_CLEAR // screen clear pending
#if defined(FEAT_GUI) || defined(UNIX)
|| force_next
#endif
@@ -2975,13 +2976,15 @@ free_screenlines(void)
* Clear the screen.
* May delay if there is something the user should read.
* Allocated the screen for resizing if needed.
+ * Returns TRUE when the screen was actually claared, FALSE if all display
+ * cells were marked for updating.
*/
- void
+ int
screenclear(void)
{
check_for_delay(FALSE);
- screenalloc(FALSE); // allocate screen buffers if size changed
- screenclear2(TRUE); // clear the screen
+ screenalloc(FALSE); // allocate screen buffers if size changed
+ return screenclear2(TRUE); // clear the screen
}
/*
@@ -2993,17 +2996,18 @@ redraw_as_cleared(void)
screenclear2(FALSE);
}
- static void
+ static int
screenclear2(int doclear)
{
int i;
+ int did_clear = FALSE;
if (starting == NO_SCREEN || ScreenLines == NULL
#ifdef FEAT_GUI
|| (gui.in_use && gui.starting)
#endif
)
- return;
+ return FALSE;
#ifdef FEAT_GUI
if (!gui.in_use)
@@ -3026,6 +3030,7 @@ screenclear2(int doclear)
if (doclear && can_clear(T_CL))
{
out_str(T_CL); // clear the display
+ did_clear = TRUE;
clear_cmdline = FALSE;
mode_displayed = FALSE;
}
@@ -3054,6 +3059,8 @@ screenclear2(int doclear)
screen_start(); // don't know where cursor is now
msg_didany = FALSE;
msg_didout = FALSE;
+
+ return did_clear;
}
/*
diff --git a/src/testdir/dumps/Test_more_scrollback_1.dump b/src/testdir/dumps/Test_more_scrollback_1.dump
new file mode 100644
index 0000000000..619f5a7d0b
--- /dev/null
+++ b/src/testdir/dumps/Test_more_scrollback_1.dump
@@ -0,0 +1,10 @@
+|0+0#ffffff16#0000001| @73
+|1| @73
+|2| @73
+|3| @73
+|4| @73
+|5| @73
+|6| @73
+|7| @73
+|8| @73
+|-+0#00e0003&@1| |M|o|r|e| |-@1> +0#ffffff16&@64
diff --git a/src/testdir/dumps/Test_more_scrollback_2.dump b/src/testdir/dumps/Test_more_scrollback_2.dump
new file mode 100644
index 0000000000..619f5a7d0b
--- /dev/null
+++ b/src/testdir/dumps/Test_more_scrollback_2.dump
@@ -0,0 +1,10 @@
+|0+0#ffffff16#0000001| @73
+|1| @73
+|2| @73
+|3| @73
+|4| @73
+|5| @73
+|6| @73
+|7| @73
+|8| @73
+|-+0#00e0003&@1| |M|o|r|e| |-@1> +0#ffffff16&@64
diff --git a/src/testdir/test_messages.vim b/src/testdir/test_messages.vim
index a32ff512a4..c69d0a9ae7 100644
--- a/src/testdir/test_messages.vim
+++ b/src/testdir/test_messages.vim
@@ -311,6 +311,32 @@ func Test_message_more()
call StopVimInTerminal(buf)
endfunc
+" Test more-prompt scrollback
+func Test_message_more_scrollback()
+ CheckRunVimInTerminal
+
+ let lines =<< trim END
+ set t_ut=
+ hi Normal ctermfg=15 ctermbg=0
+ for i in range(100)
+ echo i
+ endfor
+ END
+ call writefile(lines, 'XmoreScrollback', 'D')
+ let buf = RunVimInTerminal('-S XmoreScrollback', {'rows': 10})
+ call VerifyScreenDump(buf, 'Test_more_scrollback_1', {})
+
+ call term_sendkeys(buf, 'f')
+ call TermWait(buf)
+ call term_sendkeys(buf, 'b')
+ call VerifyScreenDump(buf, 'Test_more_scrollback_2', {})
+
+ call term_sendkeys(buf, 'q')
+ call TermWait(buf)
+ call StopVimInTerminal(buf)
+endfunc
+
+
func Test_ask_yesno()
CheckRunVimInTerminal
let buf = RunVimInTerminal('', {'rows': 6})
diff --git a/src/version.c b/src/version.c
index d17276bb9e..ab4cea34f7 100644
--- a/src/version.c
+++ b/src/version.c
@@ -700,6 +700,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 592,
+/**/
591,
/**/
590,