// not necessary for mobile
#ifndef DP_MOBILETOUCH
qfile_t *historyfile = FS_OpenRealFile("darkplaces_history.txt", "w", false);
if(historyfile)
{
int i;
// not necessary for mobile
#ifndef DP_MOBILETOUCH
qfile_t *historyfile = FS_OpenRealFile("darkplaces_history.txt", "w", false);
if(historyfile)
{
int i;
for(i = 0; i < CONBUFFER_LINES_COUNT(&history); ++i)
FS_Printf(historyfile, "%s\n", ConBuffer_GetLine(&history, i));
FS_Close(historyfile);
}
for(i = 0; i < CONBUFFER_LINES_COUNT(&history); ++i)
FS_Printf(historyfile, "%s\n", ConBuffer_GetLine(&history, i));
FS_Close(historyfile);
}
- strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1);
+ dp_strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1);
- strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1);
+ dp_strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1);
key_linepos = (int)strlen(key_line);
}
}
else if(history_line > 0)
{
--history_line; // this also does -1 -> 0, so it is good
key_linepos = (int)strlen(key_line);
}
}
else if(history_line > 0)
{
--history_line; // this also does -1 -> 0, so it is good
- strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1);
+ dp_strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1);
- strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1);
+ dp_strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1);
- strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1);
+ dp_strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1);
- strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1);
+ dp_strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1);
size_t digits = strlen(va(vabuf, sizeof(vabuf), "%i", HIST_MAXLINES));
if (history_line == -1) // editing the "new" line
size_t digits = strlen(va(vabuf, sizeof(vabuf), "%i", HIST_MAXLINES));
if (history_line == -1) // editing the "new" line
{
// hide ']' from u8_prevbyte otherwise it could go out of bounds
int newpos = (int)u8_prevbyte(line + linestart, linepos - linestart) + linestart;
{
// hide ']' from u8_prevbyte otherwise it could go out of bounds
int newpos = (int)u8_prevbyte(line + linestart, linepos - linestart) + linestart;
- Cbuf_AddText (cmd, key_line+1); // skip the ]
- Cbuf_AddText (cmd, "\n");
+ // bones_was_here: prepending allows a loop such as `alias foo "bar; wait; foo"; foo`
+ // to be broken with an alias or unalias command
+ Cbuf_InsertText(cmd, key_line+1); // skip the ]
Key_History_Push();
key_linepos = Key_ClearEditLine(true);
// force an update, because the command may take some time
Key_History_Push();
key_linepos = Key_ClearEditLine(true);
// force an update, because the command may take some time
- Cmd_ExecuteString(cmd, chat_buffer, src_local, true); // not Cbuf_AddText to allow semiclons in args; however, this allows no variables then. Use aliases!
+ Cmd_ExecuteString(cmd, chat_buffer, strlen(chat_buffer), src_local, true); // not Cbuf_AddText to allow semiclons in args; however, this allows no variables then. Use aliases!
else
CL_ForwardToServer(va(vabuf, sizeof(vabuf), "%s %s", chat_mode ? "say_team" : "say ", chat_buffer));
else
CL_ForwardToServer(va(vabuf, sizeof(vabuf), "%s %s", chat_mode ? "say_team" : "say ", chat_buffer));
// copy the rest of the command line
line[0] = 0; // start out with a null string
for (i = 3; i < c; i++) {
// copy the rest of the command line
line[0] = 0; // start out with a null string
for (i = 3; i < c; i++) {
- strlcat (line, Cmd_Argv(cmd, i), sizeof (line));
+ dp_strlcat (line, Cmd_Argv(cmd, i), sizeof (line));
// copy the rest of the command line
line[0] = 0; // start out with a null string
for (i = 2; i < c; i++) {
// copy the rest of the command line
line[0] = 0; // start out with a null string
for (i = 2; i < c; i++) {
- strlcat (line, Cmd_Argv(cmd, i), sizeof (line));
+ dp_strlcat (line, Cmd_Argv(cmd, i), sizeof (line));
if (bind[0] == '+')
Cbuf_InsertText(cmd, va(vabuf, sizeof(vabuf), "%s %i\n", bind, key));
else
Cbuf_InsertText(cmd, bind);
}
else if(bind[0] == '+' && !down && keydown[key] == 0)
if (bind[0] == '+')
Cbuf_InsertText(cmd, va(vabuf, sizeof(vabuf), "%s %i\n", bind, key));
else
Cbuf_InsertText(cmd, bind);
}
else if(bind[0] == '+' && !down && keydown[key] == 0)
- Cbuf_InsertText(cmd, va(vabuf, sizeof(vabuf), "-%s %i\n", bind + 1, key));
+ // append -bind to ensure it's after the +bind in case they arrive in the same frame
+ Cbuf_AddText(cmd, va(vabuf, sizeof(vabuf), "-%s %i\n", bind + 1, key));
if (bind[0] == '+')
Cbuf_InsertText(cmd, va(vabuf, sizeof(vabuf), "%s %i\n", bind, key));
else
Cbuf_InsertText(cmd, bind);
}
else if(bind[0] == '+' && !down && keydown[key] == 0)
if (bind[0] == '+')
Cbuf_InsertText(cmd, va(vabuf, sizeof(vabuf), "%s %i\n", bind, key));
else
Cbuf_InsertText(cmd, bind);
}
else if(bind[0] == '+' && !down && keydown[key] == 0)
- Cbuf_InsertText(cmd, va(vabuf, sizeof(vabuf), "-%s %i\n", bind + 1, key));
+ // append -bind to ensure it's after the +bind in case they arrive in the same frame
+ Cbuf_AddText(cmd, va(vabuf, sizeof(vabuf), "-%s %i\n", bind + 1, key));