Ensure that new empty console line are really empty.

This fixes a corner case: When the client is in state `ca_disconnected`
and the user presses repeatedly return, there is a chance that a older
line is erroneously printed again. This is caused by spinning through
the console history buffer, when an old line is the current line a the
frame were the console refreshs it's printed. Work around that by
clearing every line as soon as it becomes the current line.

Closes #987.
This commit is contained in:
Yamagi 2023-04-16 10:26:07 +02:00
parent 3a9b8de2ab
commit a04809a66e

View file

@ -399,9 +399,10 @@ Key_Console(int key)
Cbuf_AddText("\n");
Com_Printf("%s\n", key_lines[edit_line]);
edit_line = (edit_line + 1) & (NUM_KEY_LINES-1);
edit_line = (edit_line + 1) & (NUM_KEY_LINES - 1);
history_line = edit_line;
key_lines[edit_line][0] = ']';
key_lines[edit_line][1] = '\0';
key_linepos = 1;
if (cls.state == ca_disconnected)