diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-01-20 14:34:24 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-01-20 14:34:24 +0800 |
commit | aa4eadd2bee7d389edc6284078bb43c700de5b0f (patch) | |
tree | 6cf4bdb05214e705166cfa1da257137703fe8ce6 /src/nvim/option.c | |
parent | 431915fe6af4e176a84a60c95ad7aa9d36b71e50 (diff) | |
download | rneovim-aa4eadd2bee7d389edc6284078bb43c700de5b0f.tar.gz rneovim-aa4eadd2bee7d389edc6284078bb43c700de5b0f.tar.bz2 rneovim-aa4eadd2bee7d389edc6284078bb43c700de5b0f.zip |
vim-patch:8.2.0128: cannot list options one per line
Problem: Cannot list options one per line.
Solution: Use ":set!" to list one option per line.
https://github.com/vim/vim/commit/6b915c0c0ee7ef82f8d3d310a4345e098cb929b0
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r-- | src/nvim/option.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index 659965b64c..37cf2aa5b1 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -281,7 +281,7 @@ typedef struct vimoption { # include "options.generated.h" #endif -#define PARAM_COUNT ARRAY_SIZE(options) +#define OPTION_COUNT ARRAY_SIZE(options) static char *(p_ambw_values[]) = { "single", "double", NULL }; static char *(p_bg_values[]) = { "light", "dark", NULL }; @@ -931,6 +931,21 @@ void set_title_defaults(void) } } +void ex_set(exarg_T *eap) +{ + int flags = 0; + + if (eap->cmdidx == CMD_setlocal) { + flags = OPT_LOCAL; + } else if (eap->cmdidx == CMD_setglobal) { + flags = OPT_GLOBAL; + } + if (eap->forceit) { + flags |= OPT_ONECOLUMN; + } + (void)do_set(eap->arg, flags); +} + /// Parse 'arg' for option settings. /// /// 'arg' may be IObuff, but only when no errors can be present and option @@ -5184,7 +5199,7 @@ static void showoptions(int all, int opt_flags) #define INC 20 #define GAP 3 - vimoption_T **items = xmalloc(sizeof(vimoption_T *) * PARAM_COUNT); + vimoption_T **items = xmalloc(sizeof(vimoption_T *) * OPTION_COUNT); // Highlight title if (opt_flags & OPT_GLOBAL) { @@ -5198,6 +5213,7 @@ static void showoptions(int all, int opt_flags) // Do the loop two times: // 1. display the short items // 2. display the long items (only strings and numbers) + // When "opt_flags" has OPT_ONECOLUMN do everything in run 2. for (run = 1; run <= 2 && !got_int; run++) { // collect the items in items[] item_count = 0; @@ -5208,7 +5224,7 @@ static void showoptions(int all, int opt_flags) } varp = NULL; - if (opt_flags != 0) { + if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) != 0) { if (p->indir != PV_NONE) { varp = get_varp_scope(p, opt_flags); } @@ -5217,8 +5233,10 @@ static void showoptions(int all, int opt_flags) } if (varp != NULL && (all == 1 || (all == 0 && !optval_default(p, varp)))) { - if (p->flags & P_BOOL) { - len = 1; // a toggle option fits always + if (opt_flags & OPT_ONECOLUMN) { + len = Columns; + } else if (p->flags & P_BOOL) { + len = 1; // a toggle option fits always } else { option_value2string(p, opt_flags); len = (int)STRLEN(p->fullname) + vim_strsize(NameBuff) + 1; |