options key parsing

OPTIONS=menu_previous_page:\mv
  BINDINGS=M-v:menu_previous_page
both worked, but
  OPTIONS=menu_previous_page:M-v
  BINDINGS=\mv:menu_previous_page
both failed.  Make all four variations work.  Tiny change made large
by the need to move some things around.

The option definition for menu_first_page had a couple of its flag
bits swapped.  I didn't try to figure out whether that had any impact.
This commit is contained in:
PatR
2021-03-10 12:28:09 -08:00
parent 28b7a70b33
commit d8bef90009
6 changed files with 129 additions and 116 deletions

View File

@@ -210,7 +210,6 @@ extern void pushch(char);
extern void savech(char);
extern const char *key2extcmddesc(uchar);
extern boolean bind_specialkey(uchar, const char *);
extern uchar txt2key(char *);
extern void parseautocomplete(char *, boolean);
extern void reset_commands(boolean);
extern void rhack(char *);
@@ -1784,6 +1783,7 @@ extern int shiny_obj(char);
/* ### options.c ### */
extern boolean match_optname(const char *, const char *, int, boolean);
extern uchar txt2key(char *);
extern void initoptions(void);
extern void initoptions_init(void);
extern void initoptions_finish(void);

View File

@@ -443,4 +443,23 @@ struct savefile_info {
(nhassert_failed(#expression, __FILE__, __LINE__), 0))
#endif
/* Macros for meta and ctrl modifiers:
* M and C return the meta/ctrl code for the given character;
* e.g., (C('c') is ctrl-c
*/
#ifndef M
#ifndef NHSTDC
#define M(c) (0x80 | (c))
#else
#define M(c) ((c) - 128)
#endif /* NHSTDC */
#endif
#ifndef C
#define C(c) (0x1f & (c))
#endif
#define unctrl(c) ((c) <= C('z') ? (0x60 | (c)) : (c))
#define unmeta(c) (0x7f & (c))
#endif /* GLOBAL_H */

View File

@@ -263,8 +263,8 @@ opt_##a,
NoAlias, "deselect all items in a menu")
NHOPTC(menu_deselect_page, 4, opt_in, set_in_config, No, Yes, No, No,
NoAlias, "deselect all items on this page of a menu")
NHOPTC(menu_first_page, 4, opt_in, set_in_config, No, No, Yes, No, NoAlias,
"jump to the first page in a menu")
NHOPTC(menu_first_page, 4, opt_in, set_in_config, No, Yes, No, No,
NoAlias, "jump to the first page in a menu")
NHOPTC(menu_headings, 4, opt_in, set_in_game, No, Yes, No, Yes, NoAlias,
"display style for menu headings")
NHOPTC(menu_invert_all, 4, opt_in, set_in_config, No, Yes, No, No, NoAlias,