/*
* 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;
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;
(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;
}
}
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;
}
}
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);
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);
|| (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
* 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
}
/*
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)
if (doclear && can_clear(T_CL))
{
out_str(T_CL); // clear the display
+ did_clear = TRUE;
clear_cmdline = FALSE;
mode_displayed = FALSE;
}
screen_start(); // don't know where cursor is now
msg_didany = FALSE;
msg_didout = FALSE;
+
+ return did_clear;
}
/*
--- /dev/null
+|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
--- /dev/null
+|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
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})
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 592,
/**/
591,
/**/