Lua pushkey and getlin

Allow lua nh.pushkey to push multiple keys,
make getlin return the keys in the command queue.
This commit is contained in:
Pasi Kallinen
2026-01-22 18:16:51 +02:00
parent b9f8f845fc
commit 49a87bd09c
3 changed files with 35 additions and 1 deletions

View File

@@ -1867,6 +1867,27 @@ void
getlin(const char *query, char *bufp)
{
boolean old_bot_disabled = gb.bot_disabled;
char *obufp = bufp;
boolean got_cmdq = FALSE;
struct _cmd_queue *cmdq = NULL;
while ((cmdq = cmdq_pop()) != 0) {
if (cmdq->typ == CMDQ_KEY) {
got_cmdq = TRUE;
*bufp = (cmdq->key != '\n') ? cmdq->key : '\0';
bufp++;
if (cmdq->key == '\n')
break;
} else {
break;
}
}
if (got_cmdq) {
*bufp = '\0';
pline("%s %s", query, obufp);
return;
}
program_state.in_getlin = 1;
gb.bot_disabled = TRUE;