mirror of
https://github.com/neovim/neovim.git
synced 2025-09-16 16:28:17 +00:00
messages: redraw after resize in pager
note: does not "return" space at the bottom to the caller
This commit is contained in:
@@ -2556,6 +2556,7 @@ static int do_more_prompt(int typed_char)
|
|||||||
int c;
|
int c;
|
||||||
int retval = FALSE;
|
int retval = FALSE;
|
||||||
int toscroll;
|
int toscroll;
|
||||||
|
bool to_redraw = false;
|
||||||
msgchunk_T *mp_last = NULL;
|
msgchunk_T *mp_last = NULL;
|
||||||
msgchunk_T *mp;
|
msgchunk_T *mp;
|
||||||
int i;
|
int i;
|
||||||
@@ -2589,7 +2590,6 @@ static int do_more_prompt(int typed_char)
|
|||||||
used_typed_char = NUL;
|
used_typed_char = NUL;
|
||||||
} else {
|
} else {
|
||||||
c = get_keystroke(resize_events);
|
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;
|
lines_left = Rows - 1;
|
||||||
break;
|
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 */
|
default: /* no valid response */
|
||||||
msg_moremsg(TRUE);
|
msg_moremsg(TRUE);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toscroll != 0) {
|
// code assumes we only do one at a time
|
||||||
if (toscroll < 0) {
|
assert((toscroll == 0) || !to_redraw);
|
||||||
/* go to start of last line */
|
|
||||||
if (mp_last == NULL)
|
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);
|
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);
|
mp = msg_sb_start(mp_last->sb_prev);
|
||||||
else
|
} else {
|
||||||
mp = NULL;
|
mp = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* go to start of line at top of the screen */
|
/* go to start of line at top of the screen */
|
||||||
for (i = 0; i < Rows - 2 && mp != NULL && mp->sb_prev != NULL;
|
for (i = 0; i < Rows - 2 && mp != NULL && mp->sb_prev != NULL;
|
||||||
++i)
|
++i)
|
||||||
mp = msg_sb_start(mp->sb_prev);
|
mp = msg_sb_start(mp->sb_prev);
|
||||||
|
|
||||||
if (mp != NULL && mp->sb_prev != NULL) {
|
if (mp != NULL && (mp->sb_prev != NULL || to_redraw)) {
|
||||||
/* Find line to be displayed at top. */
|
// Find line to be displayed at top
|
||||||
for (i = 0; i > toscroll; --i) {
|
for (i = 0; i > toscroll; i--) {
|
||||||
if (mp == NULL || mp->sb_prev == NULL)
|
if (mp == NULL || mp->sb_prev == NULL) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
mp = msg_sb_start(mp->sb_prev);
|
mp = msg_sb_start(mp->sb_prev);
|
||||||
if (mp_last == NULL)
|
if (mp_last == NULL)
|
||||||
mp_last = msg_sb_start(last_msgchunk);
|
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);
|
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_ins_lines(&msg_grid_adj, 0, 1, Rows, 0, Columns);
|
||||||
grid_fill(&msg_grid_adj, 0, 1, 0, Columns, ' ', ' ',
|
grid_fill(&msg_grid_adj, 0, 1, 0, Columns, ' ', ' ',
|
||||||
HL_ATTR(HLF_MSG));
|
HL_ATTR(HLF_MSG));
|
||||||
@@ -2711,6 +2724,7 @@ static int do_more_prompt(int typed_char)
|
|||||||
mp = disp_sb_line(i, mp);
|
mp = disp_sb_line(i, mp);
|
||||||
++msg_scrolled;
|
++msg_scrolled;
|
||||||
}
|
}
|
||||||
|
to_redraw = false;
|
||||||
}
|
}
|
||||||
toscroll = 0;
|
toscroll = 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user