diff --git a/include/QF/console.h b/include/QF/console.h index 932c9b832..a4f722aee 100644 --- a/include/QF/console.h +++ b/include/QF/console.h @@ -57,10 +57,11 @@ typedef struct inputline_s int history_line; // current history line size_t linepos; // cursor position within the current edit line size_t scroll; // beginning of displayed line - size_t width; // viewable widht for horizontal scrolling + size_t width; // viewable width for horizontal scrolling + const char *line; void *user_data; // eg: window pointer void (*complete)(struct inputline_s *); // tab key pressed - void (*enter)(const char *line); // enter key pressed + void (*enter)(struct inputline_s *); // enter key pressed void (*draw)(struct inputline_s *); // draw input line to screen } inputline_t; diff --git a/libs/console/client.c b/libs/console/client.c index bc64f8bec..a94ef5223 100644 --- a/libs/console/client.c +++ b/libs/console/client.c @@ -326,8 +326,9 @@ cl_conmode_f (cvar_t *var) } static void -C_Say (const char *line) +C_Say (inputline_t *il) { + const char *line = il->line; if (!*line) return; @@ -339,8 +340,9 @@ C_Say (const char *line) } static void -C_SayTeam (const char *line) +C_SayTeam (inputline_t *il) { + const char *line = il->line; if (!*line) return; @@ -797,6 +799,12 @@ C_GIB_HUD_Disable_f (void) hud_view->visible = 0; } +static void +exec_line (inputline_t *il) +{ + Con_ExecLine (il->line); +} + static void C_Init (void) { @@ -875,7 +883,7 @@ C_Init (void) input_line = Con_CreateInputLine (32, MAXCMDLINE, ']'); input_line->complete = Con_BasicCompleteCommandLine; - input_line->enter = Con_ExecLine; + input_line->enter = exec_line; input_line->width = con_linewidth; input_line->user_data = 0; input_line->draw = 0; diff --git a/libs/console/inputline.c b/libs/console/inputline.c index 835ab911b..b5c578b3a 100644 --- a/libs/console/inputline.c +++ b/libs/console/inputline.c @@ -105,8 +105,10 @@ Con_ProcessInputLine (inputline_t *il, int ch) switch (ch) { case QFK_RETURN: - if (il->enter) - il->enter (il->lines[il->edit_line] + 1); + if (il->enter) { + il->line = il->lines[il->edit_line] + 1; + il->enter (il); + } Con_ClearTyping (il, 1); break; case QFK_TAB: diff --git a/libs/console/server.c b/libs/console/server.c index b0c102735..3e124b788 100644 --- a/libs/console/server.c +++ b/libs/console/server.c @@ -544,6 +544,12 @@ create_window (view_t *parent, int xpos, int ypos, int xlen, int ylen, return view; } +static void +exec_line (inputline_t *il) +{ + Con_ExecLine (il->line); +} + static inputline_t * create_input_line (int width) { @@ -551,7 +557,7 @@ create_input_line (int width) input_line = Con_CreateInputLine (16, MAXCMDLINE, ']'); input_line->complete = sv_complete; - input_line->enter = Con_ExecLine; + input_line->enter = exec_line; input_line->user_data = input; input_line->draw = draw_input_line; input_line->width = width;