mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 9.0.0592: display not cleared when scrolling back in messages
Problem: Display not cleared when scrolling back in messages, a background color is set and t_ut is empty. Solution: Clear to the end of the display if needed. (closes #8973)
This commit is contained in:
@@ -2913,10 +2913,11 @@ msg_sb_eol(void)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Display a screen line from previously displayed text at row "row".
|
* 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).
|
* Returns a pointer to the text for the next line (can be NULL).
|
||||||
*/
|
*/
|
||||||
static msgchunk_T *
|
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;
|
msgchunk_T *mp = smp;
|
||||||
char_u *p;
|
char_u *p;
|
||||||
@@ -2929,6 +2930,12 @@ disp_sb_line(int row, msgchunk_T *smp)
|
|||||||
if (*p == '\n') // don't display the line break
|
if (*p == '\n') // don't display the line break
|
||||||
++p;
|
++p;
|
||||||
msg_puts_display(p, -1, mp->sb_attr, TRUE);
|
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)
|
if (mp->sb_eol || mp->sb_next == NULL)
|
||||||
break;
|
break;
|
||||||
mp = mp->sb_next;
|
mp = mp->sb_next;
|
||||||
@@ -3279,15 +3286,16 @@ do_more_prompt(int typed_char)
|
|||||||
(int)Rows, 0, NULL) == OK)
|
(int)Rows, 0, NULL) == OK)
|
||||||
{
|
{
|
||||||
// display line at top
|
// display line at top
|
||||||
(void)disp_sb_line(0, mp);
|
(void)disp_sb_line(0, mp, FALSE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
int did_clear = screenclear();
|
||||||
|
|
||||||
// redisplay all lines
|
// redisplay all lines
|
||||||
screenclear();
|
|
||||||
for (i = 0; mp != NULL && i < Rows - 1; ++i)
|
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;
|
++msg_scrolled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3304,7 +3312,7 @@ do_more_prompt(int typed_char)
|
|||||||
inc_msg_scrolled();
|
inc_msg_scrolled();
|
||||||
screen_fill((int)Rows - 2, (int)Rows - 1, 0,
|
screen_fill((int)Rows - 2, (int)Rows - 1, 0,
|
||||||
(int)Columns, ' ', ' ', 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;
|
--toscroll;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,7 @@ void check_for_delay(int check_msg_scroll);
|
|||||||
int screen_valid(int doclear);
|
int screen_valid(int doclear);
|
||||||
void screenalloc(int doclear);
|
void screenalloc(int doclear);
|
||||||
void free_screenlines(void);
|
void free_screenlines(void);
|
||||||
void screenclear(void);
|
int screenclear(void);
|
||||||
void redraw_as_cleared(void);
|
void redraw_as_cleared(void);
|
||||||
void line_was_clobbered(int screen_lnum);
|
void line_was_clobbered(int screen_lnum);
|
||||||
int can_clear(char_u *p);
|
int can_clear(char_u *p);
|
||||||
|
19
src/screen.c
19
src/screen.c
@@ -49,7 +49,7 @@
|
|||||||
static int screen_attr = 0;
|
static int screen_attr = 0;
|
||||||
|
|
||||||
static void screen_char_2(unsigned off, int row, int col);
|
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 lineclear(unsigned off, int width, int attr);
|
||||||
static void lineinvalid(unsigned off, int width);
|
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);
|
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]
|
|| (enc_utf8 && (int)ScreenLinesUC[off]
|
||||||
!= (c >= 0x80 ? c : 0))
|
!= (c >= 0x80 ? c : 0))
|
||||||
|| ScreenAttrs[off] != attr
|
|| ScreenAttrs[off] != attr
|
||||||
|
|| must_redraw == UPD_CLEAR // screen clear pending
|
||||||
#if defined(FEAT_GUI) || defined(UNIX)
|
#if defined(FEAT_GUI) || defined(UNIX)
|
||||||
|| force_next
|
|| force_next
|
||||||
#endif
|
#endif
|
||||||
@@ -2975,13 +2976,15 @@ free_screenlines(void)
|
|||||||
* Clear the screen.
|
* Clear the screen.
|
||||||
* May delay if there is something the user should read.
|
* May delay if there is something the user should read.
|
||||||
* Allocated the screen for resizing if needed.
|
* 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)
|
screenclear(void)
|
||||||
{
|
{
|
||||||
check_for_delay(FALSE);
|
check_for_delay(FALSE);
|
||||||
screenalloc(FALSE); // allocate screen buffers if size changed
|
screenalloc(FALSE); // allocate screen buffers if size changed
|
||||||
screenclear2(TRUE); // clear the screen
|
return screenclear2(TRUE); // clear the screen
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2993,17 +2996,18 @@ redraw_as_cleared(void)
|
|||||||
screenclear2(FALSE);
|
screenclear2(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
screenclear2(int doclear)
|
screenclear2(int doclear)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
int did_clear = FALSE;
|
||||||
|
|
||||||
if (starting == NO_SCREEN || ScreenLines == NULL
|
if (starting == NO_SCREEN || ScreenLines == NULL
|
||||||
#ifdef FEAT_GUI
|
#ifdef FEAT_GUI
|
||||||
|| (gui.in_use && gui.starting)
|
|| (gui.in_use && gui.starting)
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
return;
|
return FALSE;
|
||||||
|
|
||||||
#ifdef FEAT_GUI
|
#ifdef FEAT_GUI
|
||||||
if (!gui.in_use)
|
if (!gui.in_use)
|
||||||
@@ -3026,6 +3030,7 @@ screenclear2(int doclear)
|
|||||||
if (doclear && can_clear(T_CL))
|
if (doclear && can_clear(T_CL))
|
||||||
{
|
{
|
||||||
out_str(T_CL); // clear the display
|
out_str(T_CL); // clear the display
|
||||||
|
did_clear = TRUE;
|
||||||
clear_cmdline = FALSE;
|
clear_cmdline = FALSE;
|
||||||
mode_displayed = FALSE;
|
mode_displayed = FALSE;
|
||||||
}
|
}
|
||||||
@@ -3054,6 +3059,8 @@ screenclear2(int doclear)
|
|||||||
screen_start(); // don't know where cursor is now
|
screen_start(); // don't know where cursor is now
|
||||||
msg_didany = FALSE;
|
msg_didany = FALSE;
|
||||||
msg_didout = FALSE;
|
msg_didout = FALSE;
|
||||||
|
|
||||||
|
return did_clear;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
10
src/testdir/dumps/Test_more_scrollback_1.dump
Normal file
10
src/testdir/dumps/Test_more_scrollback_1.dump
Normal file
@@ -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
|
10
src/testdir/dumps/Test_more_scrollback_2.dump
Normal file
10
src/testdir/dumps/Test_more_scrollback_2.dump
Normal file
@@ -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
|
@@ -311,6 +311,32 @@ func Test_message_more()
|
|||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
endfunc
|
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()
|
func Test_ask_yesno()
|
||||||
CheckRunVimInTerminal
|
CheckRunVimInTerminal
|
||||||
let buf = RunVimInTerminal('', {'rows': 6})
|
let buf = RunVimInTerminal('', {'rows': 6})
|
||||||
|
@@ -699,6 +699,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
592,
|
||||||
/**/
|
/**/
|
||||||
591,
|
591,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user