0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

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)
This commit is contained in:
Bram Moolenaar
2020-04-13 21:16:21 +02:00
parent 067297e16a
commit 7a1637f4c0
6 changed files with 98 additions and 33 deletions

View File

@@ -1233,6 +1233,37 @@ add_cmd_modifier(char_u *buf, char *mod_str, int *multi_mods)
return result;
}
/*
* 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).
@@ -1451,16 +1482,6 @@ uc_check_code(
*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 @@ uc_check_code(
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;