mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-22 20:51:31 +00:00
Don't save consecutive duplicate commands to console history
.. I don't want to scroll through 20x /quit in the history..
This commit is contained in:
parent
1ce9bdba51
commit
c79257b5d8
1 changed files with 6 additions and 2 deletions
|
@ -801,16 +801,20 @@ Key_WriteConsoleHistory()
|
|||
|
||||
// save the oldest lines first by starting at edit_line
|
||||
// and going forward (and wrapping around)
|
||||
const char* lastWrittenLine = "";
|
||||
for(i=0; i<NUM_KEY_LINES; ++i)
|
||||
{
|
||||
int lineIdx = (edit_line+i) & (NUM_KEY_LINES-1);
|
||||
const char* line = key_lines[lineIdx];
|
||||
|
||||
if(line[1] != '\0')
|
||||
if(line[1] != '\0' && strcmp(lastWrittenLine, line ) != 0)
|
||||
{
|
||||
// if the line actually contains something besides the ] prompt, write it to the file
|
||||
// if the line actually contains something besides the ] prompt,
|
||||
// and is not identical to the last written line, write it to the file
|
||||
fputs(line, f);
|
||||
fputc('\n', f);
|
||||
|
||||
lastWrittenLine = line;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue