Skip to content

Commit da80db1

Browse files
committed
Allow autocompletion of multiple commands in console input
1 parent 4f1887b commit da80db1

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

releasenotes.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
* A bug is fixed whereby it sometimes wasn’t possible to scroll all the way to the top of the console.
1515
* The scroll bar’s thumb in the console is now sized more accurately, and no longer gets too small such that its grip isn’t shown.
1616
* Long lines in the console can now wrap over multiple lines.
17-
* Minor improvements have been made to text autocompleted in the console by pressing the <kbd><b>TAB</b></kbd> key.
17+
* Minor improvements have been made to text autocompleted in the console.
18+
* When a semicolon is used to enter another command on the same line in the console, the <kbd><b>TAB</b></kbd> key can now be pressed to autocomplete that command.
1819
* Changes made to the console’s input that have been undone by pressing <kbd><b>CTRL</b></kbd> + <kbd><b>Z</b></kbd> can now be redone by pressing <kbd><b>CTRL</b></kbd> + <kbd><b>Y</b></kbd>.
1920
* These changes have been made to the support of `MAPINFO` lumps:
2021
* Maps greater than `MAP99` are now supported.

src/c_console.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3164,18 +3164,18 @@ bool C_Responder(event_t *ev)
31643164
{
31653165
const int scrolldirection = ((modstate & KMOD_SHIFT) ? -1 : 1);
31663166
const int start = autocomplete;
3167+
const bool singlecommand = (M_StringStartsWith(consoleinput, "bind ")
3168+
|| M_StringStartsWith(consoleinput, "unbind ")
3169+
|| M_StringStartsWith(consoleinput, "alias "));
31673170
static char input[255];
31683171
char prefix[255] = "";
31693172
int spaces1;
31703173
bool endspace1;
31713174

31723175
for (i = len - 1; i >= 0; i--)
3173-
if ((consoleinput[i] == ';'
3174-
&& M_StringStartsWith(consoleinput, "bind")
3175-
&& M_StringStartsWith(consoleinput, "unbind")
3176-
&& M_StringStartsWith(consoleinput, "alias"))
3176+
if ((!singlecommand && consoleinput[i] == ';')
31773177
|| (consoleinput[i] == '"'
3178-
&& M_StringStartsWith(consoleinput, "bind")))
3178+
&& M_StringStartsWith(consoleinput, "bind ")))
31793179
break;
31803180

31813181
if (i == len)

0 commit comments

Comments
 (0)