more !SHELL, !SUSPEND
Update tty command completion to ignore #shell and #suspend when they're disabled. (Since they aren't flagged for command completion, this should be unnoticeable.) Update X11 extended command selection to not show shell and suspend in the menu when they're disabled. (Trickier than I expected.) X11 currently rejects #suspend (at run time, not compile time) but allows #shell. If it was launched syncronously from a terminal window, shell escape behaves sanely. Otherwise, that seems like asking for trouble.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 winmisc.c $NHDT-Date: 1539892610 2018/10/18 19:56:50 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.39 $ */
|
||||
/* NetHack 3.6 winmisc.c $NHDT-Date: 1543830350 2018/12/03 09:45:50 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.42 $ */
|
||||
/* Copyright (c) Dean Luick, 1992 */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -1890,6 +1890,8 @@ Cardinal *num_params;
|
||||
ec_nchars = 1;
|
||||
}
|
||||
for (i = 0; extcmdlist[i].ef_txt; i++) {
|
||||
if (extcmdlist[i].flags & CMD_NOT_AVAILABLE)
|
||||
continue;
|
||||
if (extcmdlist[i].ef_txt[0] == '?')
|
||||
continue;
|
||||
|
||||
@@ -1926,22 +1928,27 @@ Cardinal *num_params;
|
||||
static void
|
||||
init_extended_commands_popup()
|
||||
{
|
||||
int i, num_commands;
|
||||
int i, j, num_commands, ignore_cmds = 0;
|
||||
const char **command_list;
|
||||
|
||||
/* count commands */
|
||||
for (num_commands = 0; extcmdlist[num_commands].ef_txt; num_commands++)
|
||||
; /* do nothing */
|
||||
if (extcmdlist[num_commands].flags & CMD_NOT_AVAILABLE)
|
||||
++ignore_cmds;
|
||||
|
||||
/* If the last entry is "help", don't use it. */
|
||||
if (strcmp(extcmdlist[num_commands - 1].ef_txt, "?") == 0)
|
||||
--num_commands;
|
||||
|
||||
command_list =
|
||||
(const char **) alloc((unsigned) num_commands * sizeof(char *));
|
||||
j = num_commands - ignore_cmds;
|
||||
command_list = (const char **) alloc((unsigned) j * sizeof (char *));
|
||||
|
||||
for (i = 0; i < num_commands; i++)
|
||||
command_list[i] = extcmdlist[i].ef_txt;
|
||||
for (i = j = 0; i < num_commands; i++) {
|
||||
if (extcmdlist[i].flags & CMD_NOT_AVAILABLE)
|
||||
continue;
|
||||
command_list[j++] = extcmdlist[i].ef_txt;
|
||||
}
|
||||
num_commands = j;
|
||||
|
||||
extended_command_popup =
|
||||
make_menu("extended_commands", "Extended Commands",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 getline.c $NHDT-Date: 1523619111 2018/04/13 11:31:51 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.35 $ */
|
||||
/* NetHack 3.6 getline.c $NHDT-Date: 1543830347 2018/12/03 09:45:47 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.37 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Michael Allison, 2006. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -260,6 +260,8 @@ char *base;
|
||||
|
||||
com_index = -1;
|
||||
for (oindex = 0; extcmdlist[oindex].ef_txt != (char *) 0; oindex++) {
|
||||
if (extcmdlist[oindex].flags & CMD_NOT_AVAILABLE)
|
||||
continue;
|
||||
if ((extcmdlist[oindex].flags & AUTOCOMPLETE)
|
||||
&& !(!wizard && (extcmdlist[oindex].flags & WIZMODECMD))
|
||||
&& !strncmpi(base, extcmdlist[oindex].ef_txt, strlen(base))) {
|
||||
|
||||
Reference in New Issue
Block a user