mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 20:41:20 +00:00
Change Con_ClearTyping to take a save flag that will cause the current line
(if not empty) to be saved in the inputline history. Clear the input (but put in history) of say or say team when pressing escape. Don't say or say_team if the text is empty.
This commit is contained in:
parent
7cc9f48207
commit
246ab0009c
6 changed files with 23 additions and 12 deletions
|
@ -104,7 +104,7 @@ void Con_DisplayList(const char **list, int con_linewidth);
|
|||
|
||||
inputline_t *Con_CreateInputLine (int lines, int lsize, char prompt);
|
||||
void Con_DestroyInputLine (inputline_t *inputline);
|
||||
void Con_ClearTyping (inputline_t *il);
|
||||
void Con_ClearTyping (inputline_t *il, int save);
|
||||
void Con_ProcessInputLine (inputline_t *il, int ch);
|
||||
|
||||
con_buffer_t *Con_CreateBuffer (size_t buffer_size, int max_lines);
|
||||
|
|
|
@ -108,7 +108,7 @@ ClearNotify (void)
|
|||
static void
|
||||
ToggleConsole_f (void)
|
||||
{
|
||||
Con_ClearTyping (input_line);
|
||||
Con_ClearTyping (input_line, 0);
|
||||
|
||||
if (key_dest == key_console && !con_data.force_commandline) {
|
||||
key_dest = key_game;
|
||||
|
@ -124,7 +124,7 @@ ToggleConsole_f (void)
|
|||
static void
|
||||
ToggleChat_f (void)
|
||||
{
|
||||
Con_ClearTyping (input_line);
|
||||
Con_ClearTyping (input_line, 0);
|
||||
|
||||
if (key_dest == key_console && !con_data.force_commandline) {
|
||||
key_dest = key_game;
|
||||
|
@ -315,6 +315,8 @@ C_ExecLine (const char *line)
|
|||
static void
|
||||
C_Say (const char *line)
|
||||
{
|
||||
if (!*line)
|
||||
return;
|
||||
dstring_t *dstr = dstring_newstr ();
|
||||
dstring_appendstr (dstr, line);
|
||||
Cbuf_AddText (con_data.cbuf, "say \"");
|
||||
|
@ -328,6 +330,8 @@ C_Say (const char *line)
|
|||
static void
|
||||
C_SayTeam (const char *line)
|
||||
{
|
||||
if (!*line)
|
||||
return;
|
||||
dstring_t *dstr = dstring_newstr ();
|
||||
dstring_appendstr (dstr, line);
|
||||
Cbuf_AddText (con_data.cbuf, "say_team \"");
|
||||
|
@ -515,6 +519,11 @@ C_KeyEvent (knum_t key, short unicode, qboolean down)
|
|||
Menu_Leave ();
|
||||
return;
|
||||
case key_message:
|
||||
if (chat_team) {
|
||||
Con_ClearTyping (say_team_line, 1);
|
||||
} else {
|
||||
Con_ClearTyping (say_line, 1);
|
||||
}
|
||||
key_dest = key_game;
|
||||
game_target = IMT_0;
|
||||
return;
|
||||
|
|
|
@ -85,8 +85,13 @@ Con_DestroyInputLine (inputline_t *inputline)
|
|||
}
|
||||
|
||||
void
|
||||
Con_ClearTyping (inputline_t *il)
|
||||
Con_ClearTyping (inputline_t *il, int save)
|
||||
{
|
||||
if (save && il->lines[il->edit_line][1]) {
|
||||
il->edit_line = (il->edit_line + 1) % il->num_lines;
|
||||
il->history_line = il->edit_line;
|
||||
}
|
||||
il->lines[il->edit_line][0] = il->prompt_char;
|
||||
il->lines[il->edit_line][1] = 0;
|
||||
il->linepos = 1;
|
||||
}
|
||||
|
@ -101,11 +106,7 @@ Con_ProcessInputLine (inputline_t *il, int ch)
|
|||
case QFK_RETURN:
|
||||
if (il->enter)
|
||||
il->enter (il->lines[il->edit_line] + 1);
|
||||
il->edit_line = (il->edit_line + 1) % il->num_lines;
|
||||
il->history_line = il->edit_line;
|
||||
il->lines[il->edit_line][0] = il->prompt_char;
|
||||
il->lines[il->edit_line][1] = 0;
|
||||
il->linepos = 1;
|
||||
Con_ClearTyping (il, 1);
|
||||
break;
|
||||
case QFK_TAB:
|
||||
if (il->complete)
|
||||
|
|
|
@ -157,8 +157,9 @@ static void
|
|||
bi_InputLine_Clear (progs_t *pr)
|
||||
{
|
||||
inputline_t *line = get_inputline (pr, P_INT (pr, 0), "InputLine_Clear");
|
||||
int save = P_INT (pr, 1);
|
||||
|
||||
Con_ClearTyping (line);
|
||||
Con_ClearTyping (line, save);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -10,7 +10,7 @@ typedef _inputline_t [] inputline_t;
|
|||
@extern void (inputline_t il, void [] data) InputLine_SetUserData;
|
||||
@extern void (inputline_t il, integer width) InputLine_SetWidth;
|
||||
@extern void (inputline_t il) InputLine_Destroy;
|
||||
@extern void (inputline_t il) InputLine_Clear;
|
||||
@extern void (inputline_t il, integer save) InputLine_Clear;
|
||||
@extern void (inputline_t il, integer ch) InputLine_Process;
|
||||
@extern void (inputline_t il) InputLine_Draw;
|
||||
@extern void (inputline_t il, string str) InputLine_SetText;
|
||||
|
|
|
@ -6,7 +6,7 @@ inputline_t (integer lines, integer size, integer prompt) InputLine_Create = #0;
|
|||
void (inputline_t il, void [] data) InputLine_SetUserData = #0;
|
||||
void (inputline_t il, integer width) InputLine_SetWidth = #0;
|
||||
void (inputline_t il) InputLine_Destroy = #0;
|
||||
void (inputline_t il) InputLine_Clear = #0;
|
||||
void (inputline_t il, integer size) InputLine_Clear = #0;
|
||||
void (inputline_t il, integer ch) InputLine_Process = #0;
|
||||
void (inputline_t il) InputLine_Draw = #0;
|
||||
void (inputline_t il, string str) InputLine_SetText = #0;
|
||||
|
|
Loading…
Reference in a new issue