mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Prevent endless loop in printdigraph(). (#5215)
Calling printdiagraph() with msg_silent != 0 can result in an endless loop because the loop condition never changes, if msg_col is never changed. To fix this, calculate the number of iterations before the loop, which is always smaller than list_width.
This commit is contained in:
parent
a1682281f4
commit
c10fe010f1
@ -1691,8 +1691,11 @@ static void printdigraph(digr_T *dp)
|
|||||||
msg_putchar('\n');
|
msg_putchar('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg_col) {
|
|
||||||
while (msg_col % list_width != 0) {
|
// Make msg_col a multiple of list_width by using spaces.
|
||||||
|
if (msg_col % list_width != 0) {
|
||||||
|
int spaces = (msg_col / list_width + 1) * list_width - msg_col;
|
||||||
|
while (spaces--) {
|
||||||
msg_putchar(' ');
|
msg_putchar(' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user