patch 8.2.0577: not all modifiers supported for :options
Problem: Not all modifiers supported for :options.
Solution: Use all cmdmod.split flags. (closes #4401)
diff --git a/src/usercmd.c b/src/usercmd.c
index 7ff7f02..e903e6b 100644
--- a/src/usercmd.c
+++ b/src/usercmd.c
@@ -1234,6 +1234,37 @@
}
/*
+ * Add modifiers from "cmdmod.split" to "buf". Set "multi_mods" when one was
+ * added. Return the number of bytes added.
+ */
+ size_t
+add_win_cmd_modifers(char_u *buf, int *multi_mods)
+{
+ size_t result = 0;
+
+ // :aboveleft and :leftabove
+ if (cmdmod.split & WSP_ABOVE)
+ result += add_cmd_modifier(buf, "aboveleft", multi_mods);
+ // :belowright and :rightbelow
+ if (cmdmod.split & WSP_BELOW)
+ result += add_cmd_modifier(buf, "belowright", multi_mods);
+ // :botright
+ if (cmdmod.split & WSP_BOT)
+ result += add_cmd_modifier(buf, "botright", multi_mods);
+
+ // :tab
+ if (cmdmod.tab > 0)
+ result += add_cmd_modifier(buf, "tab", multi_mods);
+ // :topleft
+ if (cmdmod.split & WSP_TOP)
+ result += add_cmd_modifier(buf, "topleft", multi_mods);
+ // :vertical
+ if (cmdmod.split & WSP_VERT)
+ result += add_cmd_modifier(buf, "vertical", multi_mods);
+ return result;
+}
+
+/*
* Check for a <> code in a user command.
* "code" points to the '<'. "len" the length of the <> (inclusive).
* "buf" is where the result is to be added.
@@ -1451,16 +1482,6 @@
*buf = '\0';
}
- // :aboveleft and :leftabove
- if (cmdmod.split & WSP_ABOVE)
- result += add_cmd_modifier(buf, "aboveleft", &multi_mods);
- // :belowright and :rightbelow
- if (cmdmod.split & WSP_BELOW)
- result += add_cmd_modifier(buf, "belowright", &multi_mods);
- // :botright
- if (cmdmod.split & WSP_BOT)
- result += add_cmd_modifier(buf, "botright", &multi_mods);
-
// the modifiers that are simple flags
for (i = 0; mod_entries[i].varp != NULL; ++i)
if (*mod_entries[i].varp)
@@ -1475,19 +1496,12 @@
if (msg_silent > 0)
result += add_cmd_modifier(buf,
emsg_silent > 0 ? "silent!" : "silent", &multi_mods);
- // :tab
- if (cmdmod.tab > 0)
- result += add_cmd_modifier(buf, "tab", &multi_mods);
- // :topleft
- if (cmdmod.split & WSP_TOP)
- result += add_cmd_modifier(buf, "topleft", &multi_mods);
// TODO: How to support :unsilent?
// :verbose
if (p_verbose > 0)
result += add_cmd_modifier(buf, "verbose", &multi_mods);
- // :vertical
- if (cmdmod.split & WSP_VERT)
- result += add_cmd_modifier(buf, "vertical", &multi_mods);
+ // flags from cmdmod.split
+ result += add_win_cmd_modifers(buf, &multi_mods);
if (quote && buf != NULL)
{
buf += result - 2;