aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editor.c1
-rw-r--r--editor.h1
-rw-r--r--vis.c12
3 files changed, 7 insertions, 7 deletions
diff --git a/editor.c b/editor.c
index 70b8066..244c568 100644
--- a/editor.c
+++ b/editor.c
@@ -410,6 +410,7 @@ void editor_free(Editor *ed) {
editor_syntax_unload(ed);
ed->ui->free(ed->ui);
map_free(ed->cmds);
+ map_free(ed->options);
free(ed);
}
diff --git a/editor.h b/editor.h
index dd242ec..771f8f8 100644
--- a/editor.h
+++ b/editor.h
@@ -122,6 +122,7 @@ struct Editor {
bool expandtab; /* whether typed tabs should be converted to spaces */
bool autoindent; /* whether indentation should be copied from previous line on newline */
Map *cmds; /* ":"-commands, used for unique prefix queries */
+ Map *options; /* ":set"-options */
};
Editor *editor_new(Ui*);
diff --git a/vis.c b/vis.c
index d8ede5d..e4c618a 100644
--- a/vis.c
+++ b/vis.c
@@ -1392,15 +1392,13 @@ static bool cmd_set(Filerange *range, enum CmdOpt cmdopt, const char *argv[]) {
[OPTION_NUMBER_RELATIVE] = { { "relativenumbers", "rnu" }, OPTION_TYPE_BOOL },
};
- static Map *optmap = NULL;
-
- if (!optmap) {
- if (!(optmap = map_new()))
+ if (!vis->options) {
+ if (!(vis->options = map_new()))
return false;
for (int i = 0; i < LENGTH(options); i++) {
options[i].index = i;
for (const char **name = options[i].names; *name; name++) {
- if (!map_put(optmap, *name, &options[i]))
+ if (!map_put(vis->options, *name, &options[i]))
return false;
}
}
@@ -1416,7 +1414,7 @@ static bool cmd_set(Filerange *range, enum CmdOpt cmdopt, const char *argv[]) {
OptionDef *opt = NULL;
if (!strncasecmp(argv[1], "no", 2)) {
- opt = map_closest(optmap, argv[1]+2);
+ opt = map_closest(vis->options, argv[1]+2);
if (opt && opt->type == OPTION_TYPE_BOOL)
invert = true;
else
@@ -1424,7 +1422,7 @@ static bool cmd_set(Filerange *range, enum CmdOpt cmdopt, const char *argv[]) {
}
if (!opt)
- opt = map_closest(optmap, argv[1]);
+ opt = map_closest(vis->options, argv[1]);
if (!opt) {
editor_info_show(vis, "Unknown option: `%s'", argv[1]);
return false;