Mercurial > vim
diff src/usercmd.c @ 20043:d13f8ae3b1de v8.2.0577
patch 8.2.0577: not all modifiers supported for :options
Commit: https://github.com/vim/vim/commit/7a1637f4c00ac3d0cbf894803ada1586a1717470
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Apr 13 21:16:21 2020 +0200
patch 8.2.0577: not all modifiers supported for :options
Problem: Not all modifiers supported for :options.
Solution: Use all cmdmod.split flags. (closes https://github.com/vim/vim/issues/4401)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 13 Apr 2020 21:30:36 +0200 |
parents | 847cc7932c42 |
children | 336483164ca6 |
line wrap: on
line diff
--- a/src/usercmd.c +++ b/src/usercmd.c @@ -1234,6 +1234,37 @@ add_cmd_modifier(char_u *buf, char *mod_ } /* + * 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 @@ 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;