fix console weirdnesses:
* empty lines kill command history (instead don't add empty lines to the history)
* cursor position and history line length were done the wrong way, positioning
the cursor outside of the line or only recalling part of a line
NOTE: maybe it is better to move the Con_Printf BELOW the return so an empty
prompt isn't even displayed? bash does not do it like that, IRC clients do it
like that, and personally I don't care
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6552
d7cf8633-e32d-0410-b094-
e92efae38249
Cbuf_AddText (key_lines[edit_line]+1); // skip the ]
Cbuf_AddText ("\n");
Con_Printf("%s\n",key_lines[edit_line]);
Cbuf_AddText (key_lines[edit_line]+1); // skip the ]
Cbuf_AddText ("\n");
Con_Printf("%s\n",key_lines[edit_line]);
+ if(key_lines[edit_line][1] == 0) // empty line (just a [)?
+ return; // no, no, you can't submit empty lines to the history...
// LordHavoc: redesigned edit_line/history_line
edit_line = 31;
history_line = edit_line;
// LordHavoc: redesigned edit_line/history_line
edit_line = 31;
history_line = edit_line;
{
size_t linelen;
history_line--;
{
size_t linelen;
history_line--;
- linelen = strlen(key_lines[edit_line]);
+ linelen = strlen(key_lines[history_line]);
memcpy(key_lines[edit_line], key_lines[history_line], linelen + 1);
key_linepos = (int)linelen;
}
memcpy(key_lines[edit_line], key_lines[history_line], linelen + 1);
key_linepos = (int)linelen;
}
- linelen = strlen(key_lines[edit_line]);
+ linelen = strlen(key_lines[history_line]);
memcpy(key_lines[edit_line], key_lines[history_line], linelen + 1);
key_linepos = (int)linelen;
}
memcpy(key_lines[edit_line], key_lines[history_line], linelen + 1);
key_linepos = (int)linelen;
}