diff --git a/doc/fixes37.0 b/doc/fixes37.0 index cc0d32d33..b788905ff 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -980,8 +980,8 @@ changing engraving to an occupation resulted in not dulling a weapon used to a change to wounded legs handling resulted in not recovering lost dexterity or receiving the "leg(s) feel better" message if wound time expired rather than having legs be explicitly healed -turning movement into commands interfered with using pick-axe plus autodig - in downward direction +turning movement into commands broke the rest_on_space option; it also + interfered with using pick-axe plus autodig in downward direction curses: 'msg_window' option wasn't functional for curses unless the binary also included tty support diff --git a/include/extern.h b/include/extern.h index 459fa758c..12fdb986d 100644 --- a/include/extern.h +++ b/include/extern.h @@ -252,6 +252,7 @@ extern const char *key2extcmddesc(uchar); extern boolean bind_specialkey(uchar, const char *); extern void parseautocomplete(char *, boolean); extern void reset_commands(boolean); +extern void update_rest_on_space(void); extern void rhack(char *); extern int doextlist(void); extern int extcmd_via_menu(void); diff --git a/src/cmd.c b/src/cmd.c index 00e8f551a..474000bed 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -2574,9 +2574,10 @@ commands_init(void) (void) bind_key(M('2'), "twoweapon"); (void) bind_key(M('n'), "name"); (void) bind_key(M('N'), "name"); - - /* wait_on_space */ +#if 0 + /* don't do this until the rest_on_space option is set or cleared */ (void) bind_key(' ', "wait"); +#endif } static boolean @@ -3573,6 +3574,22 @@ reset_commands(boolean initial) (void) bind_key_fn(M(g.Cmd.dirchars[i]), move_funcs[i][MV_RUSH]); } } + update_rest_on_space(); +} + +void +update_rest_on_space(void) +{ + /* cloned from extcmdlist['.'], then slightly modified to be distinct; + donull is all that's needed for it to operate; command name and + description get shown by help menu's "Info on what a given key does" + (which runs the '&' command) and "Full list of keyboard commands" */ + static const struct ext_func_tab restonspace = { + ' ', "wait", "rest one move via 'rest_on_space' option", + donull, (IFBURIED | CMD_M_PREFIX), "waiting" + }; + + g.Cmd.commands[' '] = flags.rest_on_space ? &restonspace : 0; } /* commands which accept 'm' prefix to request menu operation */ diff --git a/src/options.c b/src/options.c index 5be5bb904..1e91c7221 100644 --- a/src/options.c +++ b/src/options.c @@ -4225,6 +4225,9 @@ optfn_boolean(int optidx, int req, boolean negated, char *opts, char *op) case opt_mention_decor: iflags.prev_decor = STONE; break; + case opt_rest_on_space: + update_rest_on_space(); + break; } /* boolean value has been toggled but some option changes can @@ -5908,6 +5911,7 @@ initoptions_finish(void) } } #endif + update_rest_on_space(); g.opt_initial = FALSE; return; }