mirror of
https://github.com/neovim/neovim.git
synced 2025-01-01 17:23:36 -07:00
messages: redraw after resize in pager
note: does not "return" space at the bottom to the caller
This commit is contained in:
parent
f72c7b0b3a
commit
bf9ff5148a
@ -2556,6 +2556,7 @@ static int do_more_prompt(int typed_char)
|
||||
int c;
|
||||
int retval = FALSE;
|
||||
int toscroll;
|
||||
bool to_redraw = false;
|
||||
msgchunk_T *mp_last = NULL;
|
||||
msgchunk_T *mp;
|
||||
int i;
|
||||
@ -2589,7 +2590,6 @@ static int do_more_prompt(int typed_char)
|
||||
used_typed_char = NUL;
|
||||
} else {
|
||||
c = get_keystroke(resize_events);
|
||||
multiqueue_process_events(resize_events);
|
||||
}
|
||||
|
||||
|
||||
@ -2663,31 +2663,44 @@ static int do_more_prompt(int typed_char)
|
||||
lines_left = Rows - 1;
|
||||
break;
|
||||
|
||||
case K_EVENT:
|
||||
// only resize_events are processed here
|
||||
// Attempt to redraw the screen. sb_text doesn't support reflow
|
||||
// so this only really works for vertical resize.
|
||||
multiqueue_process_events(resize_events);
|
||||
to_redraw = true;
|
||||
break;
|
||||
|
||||
default: /* no valid response */
|
||||
msg_moremsg(TRUE);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (toscroll != 0) {
|
||||
if (toscroll < 0) {
|
||||
/* go to start of last line */
|
||||
if (mp_last == NULL)
|
||||
// code assumes we only do one at a time
|
||||
assert((toscroll == 0) || !to_redraw);
|
||||
|
||||
if (toscroll != 0 || to_redraw) {
|
||||
if (toscroll < 0 || to_redraw) {
|
||||
// go to start of last line
|
||||
if (mp_last == NULL) {
|
||||
mp = msg_sb_start(last_msgchunk);
|
||||
else if (mp_last->sb_prev != NULL)
|
||||
} else if (mp_last->sb_prev != NULL) {
|
||||
mp = msg_sb_start(mp_last->sb_prev);
|
||||
else
|
||||
} else {
|
||||
mp = NULL;
|
||||
}
|
||||
|
||||
/* go to start of line at top of the screen */
|
||||
for (i = 0; i < Rows - 2 && mp != NULL && mp->sb_prev != NULL;
|
||||
++i)
|
||||
mp = msg_sb_start(mp->sb_prev);
|
||||
|
||||
if (mp != NULL && mp->sb_prev != NULL) {
|
||||
/* Find line to be displayed at top. */
|
||||
for (i = 0; i > toscroll; --i) {
|
||||
if (mp == NULL || mp->sb_prev == NULL)
|
||||
if (mp != NULL && (mp->sb_prev != NULL || to_redraw)) {
|
||||
// Find line to be displayed at top
|
||||
for (i = 0; i > toscroll; i--) {
|
||||
if (mp == NULL || mp->sb_prev == NULL) {
|
||||
break;
|
||||
}
|
||||
mp = msg_sb_start(mp->sb_prev);
|
||||
if (mp_last == NULL)
|
||||
mp_last = msg_sb_start(last_msgchunk);
|
||||
@ -2695,7 +2708,7 @@ static int do_more_prompt(int typed_char)
|
||||
mp_last = msg_sb_start(mp_last->sb_prev);
|
||||
}
|
||||
|
||||
if (toscroll == -1) {
|
||||
if (toscroll == -1 && !to_redraw) {
|
||||
grid_ins_lines(&msg_grid_adj, 0, 1, Rows, 0, Columns);
|
||||
grid_fill(&msg_grid_adj, 0, 1, 0, Columns, ' ', ' ',
|
||||
HL_ATTR(HLF_MSG));
|
||||
@ -2711,6 +2724,7 @@ static int do_more_prompt(int typed_char)
|
||||
mp = disp_sb_line(i, mp);
|
||||
++msg_scrolled;
|
||||
}
|
||||
to_redraw = false;
|
||||
}
|
||||
toscroll = 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user