Make saveoptions save changed autocompletions
This commit is contained in:
@@ -399,6 +399,7 @@ extern int extcmds_match(const char *, int, int **);
|
|||||||
extern const char *key2extcmddesc(uchar);
|
extern const char *key2extcmddesc(uchar);
|
||||||
extern boolean bind_specialkey(uchar, const char *);
|
extern boolean bind_specialkey(uchar, const char *);
|
||||||
extern void parseautocomplete(char *, boolean);
|
extern void parseautocomplete(char *, boolean);
|
||||||
|
extern void all_options_autocomplete(strbuf_t *);
|
||||||
extern void lock_mouse_buttons(boolean);
|
extern void lock_mouse_buttons(boolean);
|
||||||
extern void reset_commands(boolean);
|
extern void reset_commands(boolean);
|
||||||
extern void update_rest_on_space(void);
|
extern void update_rest_on_space(void);
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#define MOVEMENTCMD 0x0400 /* used to move hero/cursor */
|
#define MOVEMENTCMD 0x0400 /* used to move hero/cursor */
|
||||||
#define MOUSECMD 0x0800 /* cmd allowed to be bound to mouse button */
|
#define MOUSECMD 0x0800 /* cmd allowed to be bound to mouse button */
|
||||||
#define CMD_INSANE 0x1000 /* suppress sanity check (for ^P and ^R) */
|
#define CMD_INSANE 0x1000 /* suppress sanity check (for ^P and ^R) */
|
||||||
|
#define AUTOCOMP_ADJ 0x2000 /* user changed command autocompletion */
|
||||||
|
|
||||||
/* flags for extcmds_match() */
|
/* flags for extcmds_match() */
|
||||||
#define ECM_NOFLAGS 0
|
#define ECM_NOFLAGS 0
|
||||||
|
|||||||
@@ -2952,6 +2952,8 @@ parseautocomplete(char *autocomplete, boolean condition)
|
|||||||
/* find and modify the extended command */
|
/* find and modify the extended command */
|
||||||
for (efp = extcmdlist; efp->ef_txt; efp++) {
|
for (efp = extcmdlist; efp->ef_txt; efp++) {
|
||||||
if (!strcmp(autocomplete, efp->ef_txt)) {
|
if (!strcmp(autocomplete, efp->ef_txt)) {
|
||||||
|
if (condition == ((efp->flags & AUTOCOMPLETE) ? FALSE : TRUE))
|
||||||
|
efp->flags |= AUTOCOMP_ADJ;
|
||||||
if (condition)
|
if (condition)
|
||||||
efp->flags |= AUTOCOMPLETE;
|
efp->flags |= AUTOCOMPLETE;
|
||||||
else
|
else
|
||||||
@@ -2966,6 +2968,22 @@ parseautocomplete(char *autocomplete, boolean condition)
|
|||||||
wait_synch();
|
wait_synch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* add changed autocompletions to the string buffer in config file format */
|
||||||
|
void
|
||||||
|
all_options_autocomplete(strbuf_t *sbuf)
|
||||||
|
{
|
||||||
|
struct ext_func_tab *efp;
|
||||||
|
char buf[BUFSZ];
|
||||||
|
|
||||||
|
for (efp = extcmdlist; efp->ef_txt; efp++)
|
||||||
|
if ((efp->flags & AUTOCOMP_ADJ) != 0) {
|
||||||
|
Sprintf(buf, "AUTOCOMPLETE=%s%s\n",
|
||||||
|
(efp->flags & AUTOCOMPLETE) ? "" : "!",
|
||||||
|
efp->ef_txt);
|
||||||
|
strbuf_append(sbuf, buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* save&clear the mouse button actions, or restore the saved ones */
|
/* save&clear the mouse button actions, or restore the saved ones */
|
||||||
void
|
void
|
||||||
lock_mouse_buttons(boolean savebtns)
|
lock_mouse_buttons(boolean savebtns)
|
||||||
|
|||||||
@@ -9503,6 +9503,7 @@ all_options_strbuf(strbuf_t *sbuf)
|
|||||||
all_options_menucolors(sbuf);
|
all_options_menucolors(sbuf);
|
||||||
all_options_msgtypes(sbuf);
|
all_options_msgtypes(sbuf);
|
||||||
all_options_apes(sbuf);
|
all_options_apes(sbuf);
|
||||||
|
all_options_autocomplete(sbuf);
|
||||||
#ifdef STATUS_HILITES
|
#ifdef STATUS_HILITES
|
||||||
all_options_statushilites(sbuf);
|
all_options_statushilites(sbuf);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user