Patch 8.2.0128

8 views
Skip to first unread message

Bram Moolenaar

unread,
Jan 18, 2020, 9:54:01 AM1/18/20
to vim...@googlegroups.com

Patch 8.2.0128
Problem: Cannot list options one per line.
Solution: Use ":set!" to list one option per line.
Files: src/ex_docmd.c, src/option.c, src/proto/option.pro, src/vim.h,
src/ex_cmds.h, src/optiondefs.h, src/testdir/test_options.vim,
runtime/doc/options.txt


*** ../vim-8.2.0127/src/ex_docmd.c 2020-01-18 15:06:15.689256648 +0100
--- src/ex_docmd.c 2020-01-18 15:12:00.923806710 +0100
***************
*** 320,326 ****
# define ex_diffupdate ex_ni
#endif
static void ex_digraphs(exarg_T *eap);
- static void ex_set(exarg_T *eap);
#ifdef FEAT_SEARCH_EXTRA
static void ex_nohlsearch(exarg_T *eap);
#else
--- 320,325 ----
***************
*** 8488,8510 ****
#endif
}

- static 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 defined(FEAT_EVAL) && defined(FEAT_BROWSE)
- if (cmdmod.browse && flags == 0)
- ex_options(eap);
- else
- #endif
- (void)do_set(eap->arg, flags);
- }
-
#if defined(FEAT_SEARCH_EXTRA) || defined(PROTO)
void
set_no_hlsearch(int flag)
--- 8487,8492 ----
*** ../vim-8.2.0127/src/option.c 2019-12-29 23:04:20.294639884 +0100
--- src/option.c 2020-01-18 15:39:42.765921720 +0100
***************
*** 1066,1071 ****
--- 1066,1092 ----
}
#endif

+ 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 defined(FEAT_EVAL) && defined(FEAT_BROWSE)
+ if (cmdmod.browse && flags == 0)
+ ex_options(eap);
+ else
+ #endif
+ {
+ if (eap->forceit)
+ flags |= OPT_ONECOLUMN;
+ (void)do_set(eap->arg, flags);
+ }
+ }
+
/*
* Parse 'arg' for option settings.
*
***************
*** 4349,4355 ****
#define INC 20
#define GAP 3

! items = ALLOC_MULT(struct vimoption *, PARAM_COUNT);
if (items == NULL)
return;

--- 4370,4376 ----
#define INC 20
#define GAP 3

! items = ALLOC_MULT(struct vimoption *, OPTION_COUNT);
if (items == NULL)
return;

***************
*** 4364,4372 ****
msg_puts_title(_("\n--- Options ---"));

/*
! * do the loop two times:
* 1. display the short items
* 2. display the long items (only strings and numbers)
*/
for (run = 1; run <= 2 && !got_int; ++run)
{
--- 4385,4394 ----
msg_puts_title(_("\n--- Options ---"));

/*
! * 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)
{
***************
*** 4377,4388 ****
for (p = &options[0]; p->fullname != NULL; p++)
{
// apply :filter /pat/
! if (message_filtered((char_u *) p->fullname))
continue;

varp = NULL;
isterm = istermoption(p);
! if (opt_flags != 0)
{
if (p->indir != PV_NONE && !isterm)
varp = get_varp_scope(p, opt_flags);
--- 4399,4410 ----
for (p = &options[0]; p->fullname != NULL; p++)
{
// apply :filter /pat/
! if (message_filtered((char_u *)p->fullname))
continue;

varp = NULL;
isterm = istermoption(p);
! if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) != 0)
{
if (p->indir != PV_NONE && !isterm)
varp = get_varp_scope(p, opt_flags);
***************
*** 4394,4400 ****
|| (all == 1 && !isterm)
|| (all == 0 && !optval_default(p, varp, p_cp))))
{
! if (p->flags & P_BOOL)
len = 1; // a toggle option fits always
else
{
--- 4416,4424 ----
|| (all == 1 && !isterm)
|| (all == 0 && !optval_default(p, varp, p_cp))))
{
! if (opt_flags & OPT_ONECOLUMN)
! len = Columns;
! else if (p->flags & P_BOOL)
len = 1; // a toggle option fits always
else
{
*** ../vim-8.2.0127/src/proto/option.pro 2019-12-12 12:55:29.000000000 +0100
--- src/proto/option.pro 2020-01-18 15:17:24.058442851 +0100
***************
*** 8,13 ****
--- 8,14 ----
void set_init_3(void);
void set_helplang_default(char_u *lang);
void set_title_defaults(void);
+ void ex_set(exarg_T *eap);
int do_set(char_u *arg, int opt_flags);
void did_set_option(int opt_idx, int opt_flags, int new_value, int value_checked);
int string_to_key(char_u *arg, int multi_byte);
*** ../vim-8.2.0127/src/vim.h 2020-01-11 16:05:19.594287610 +0100
--- src/vim.h 2020-01-18 15:13:39.019393145 +0100
***************
*** 1229,1240 ****
* When OPT_GLOBAL and OPT_LOCAL are both missing, set both local and global
* values, get local value.
*/
! #define OPT_FREE 1 // free old value if it was allocated
! #define OPT_GLOBAL 2 // use global value
! #define OPT_LOCAL 4 // use local value
! #define OPT_MODELINE 8 // option in modeline
! #define OPT_WINONLY 16 // only set window-local options
! #define OPT_NOWIN 32 // don't set window-local options

// Magic chars used in confirm dialog strings
#define DLG_BUTTON_SEP '\n'
--- 1229,1241 ----
* When OPT_GLOBAL and OPT_LOCAL are both missing, set both local and global
* values, get local value.
*/
! #define OPT_FREE 0x01 // free old value if it was allocated
! #define OPT_GLOBAL 0x02 // use global value
! #define OPT_LOCAL 0x04 // use local value
! #define OPT_MODELINE 0x08 // option in modeline
! #define OPT_WINONLY 0x10 // only set window-local options
! #define OPT_NOWIN 0x20 // don't set window-local options
! #define OPT_ONECOLUMN 0x40 // list options one per line

// Magic chars used in confirm dialog strings
#define DLG_BUTTON_SEP '\n'
*** ../vim-8.2.0127/src/ex_cmds.h 2020-01-12 15:46:01.962935912 +0100
--- src/ex_cmds.h 2020-01-18 15:40:36.057724112 +0100
***************
*** 1307,1322 ****
EX_EXTRA|EX_NOTRLCOM,
ADDR_NONE),
EXCMD(CMD_set, "set", ex_set,
! EX_TRLBAR|EX_EXTRA|EX_CMDWIN|EX_SBOXOK,
ADDR_NONE),
EXCMD(CMD_setfiletype, "setfiletype", ex_setfiletype,
EX_TRLBAR|EX_EXTRA|EX_NEEDARG|EX_CMDWIN,
ADDR_NONE),
EXCMD(CMD_setglobal, "setglobal", ex_set,
! EX_TRLBAR|EX_EXTRA|EX_CMDWIN|EX_SBOXOK,
ADDR_NONE),
EXCMD(CMD_setlocal, "setlocal", ex_set,
! EX_TRLBAR|EX_EXTRA|EX_CMDWIN|EX_SBOXOK,
ADDR_NONE),
EXCMD(CMD_sfind, "sfind", ex_splitview,
EX_BANG|EX_FILE1|EX_RANGE|EX_CMDARG|EX_ARGOPT|EX_TRLBAR,
--- 1307,1322 ----
EX_EXTRA|EX_NOTRLCOM,
ADDR_NONE),
EXCMD(CMD_set, "set", ex_set,
! EX_BANG|EX_TRLBAR|EX_EXTRA|EX_CMDWIN|EX_SBOXOK,
ADDR_NONE),
EXCMD(CMD_setfiletype, "setfiletype", ex_setfiletype,
EX_TRLBAR|EX_EXTRA|EX_NEEDARG|EX_CMDWIN,
ADDR_NONE),
EXCMD(CMD_setglobal, "setglobal", ex_set,
! EX_BANG|EX_TRLBAR|EX_EXTRA|EX_CMDWIN|EX_SBOXOK,
ADDR_NONE),
EXCMD(CMD_setlocal, "setlocal", ex_set,
! EX_BANG|EX_TRLBAR|EX_EXTRA|EX_CMDWIN|EX_SBOXOK,
ADDR_NONE),
EXCMD(CMD_sfind, "sfind", ex_splitview,
EX_BANG|EX_FILE1|EX_RANGE|EX_CMDARG|EX_ARGOPT|EX_TRLBAR,
*** ../vim-8.2.0127/src/optiondefs.h 2019-11-30 22:40:44.000000000 +0100
--- src/optiondefs.h 2020-01-18 15:32:31.887440770 +0100
***************
*** 3009,3015 ****
{NULL, NULL, 0, NULL, PV_NONE, {NULL, NULL} SCTX_INIT}
};

! #define PARAM_COUNT (sizeof(options) / sizeof(struct vimoption))

// The following is needed to make the gen_opt_test.vim script work.
// {"
--- 3009,3015 ----
{NULL, NULL, 0, NULL, PV_NONE, {NULL, NULL} SCTX_INIT}
};

! #define OPTION_COUNT (sizeof(options) / sizeof(struct vimoption))

// The following is needed to make the gen_opt_test.vim script work.
// {"
*** ../vim-8.2.0127/src/testdir/test_options.vim 2019-12-27 17:20:51.533918083 +0100
--- src/testdir/test_options.vim 2020-01-18 15:51:26.239229443 +0100
***************
*** 44,50 ****
set wildchar&
endfunc

! func Test_options()
let caught = 'ok'
try
options
--- 44,50 ----
set wildchar&
endfunc

! func Test_options_command()
let caught = 'ok'
try
options
***************
*** 388,393 ****
--- 388,400 ----
set tw& iskeyword& splitbelow&
endfunc

+ func Test_set_one_column()
+ let out_mult = execute('set all')->split("\n")
+ let out_one = execute('set! all')->split("\n")
+ " one column should be two to four times as many lines
+ call assert_inrange(len(out_mult) * 2, len(out_mult) * 4, len(out_one))
+ endfunc
+
func Test_set_values()
if filereadable('opt_test.vim')
source opt_test.vim
*** ../vim-8.2.0127/runtime/doc/options.txt 2020-01-01 16:18:33.204997405 +0100
--- runtime/doc/options.txt 2020-01-18 15:41:14.553580483 +0100
***************
*** 22,30 ****
1. Setting options *set-option* *E764*

*:se* *:set*
! :se[t] Show all options that differ from their default value.

! :se[t] all Show all but terminal options.

:se[t] termcap Show all terminal options. Note that in the GUI the
key codes are not shown, because they are generated
--- 22,34 ----
1. Setting options *set-option* *E764*

*:se* *:set*
! :se[t][!] Show all options that differ from their default value.
! When [!] is present every option is on a separate
! line.

! :se[t][!] all Show all but terminal options.
! When [!] is present every option is on a separate
! line.

:se[t] termcap Show all terminal options. Note that in the GUI the
key codes are not shown, because they are generated
***************
*** 287,293 ****
wiped out |:bwipe|.

*:setl* *:setlocal*
! :setl[ocal] ... Like ":set" but set only the value local to the
current buffer or window. Not all options have a
local value. If the option does not have a local
value the global value is set.
--- 291,297 ----
wiped out |:bwipe|.

*:setl* *:setlocal*
! :setl[ocal][!] ... Like ":set" but set only the value local to the
current buffer or window. Not all options have a
local value. If the option does not have a local
value the global value is set.
***************
*** 309,315 ****
{option}, so that the global value will be used.

*:setg* *:setglobal*
! :setg[lobal] ... Like ":set" but set only the global value for a local
option without changing the local value.
When displaying an option, the global value is shown.
With the "all" argument: display global values for all
--- 313,319 ----
{option}, so that the global value will be used.

*:setg* *:setglobal*
! :setg[lobal][!] ... Like ":set" but set only the global value for a local
option without changing the local value.
When displaying an option, the global value is shown.
With the "all" argument: display global values for all
*** ../vim-8.2.0127/src/version.c 2020-01-18 15:06:15.689256648 +0100
--- src/version.c 2020-01-18 15:44:41.760796530 +0100
***************
*** 744,745 ****
--- 744,747 ----
{ /* Add new patch number below this line */
+ /**/
+ 128,
/**/

--
CART DRIVER: Bring out your dead!
We follow the cart through a wretched, impoverished plague-ridden village.
A few starved mongrels run about in the mud scavenging. In the open
doorway of one house perhaps we jug glimpse a pair of legs dangling from
the ceiling. In another doorway an OLD WOMAN is beating a cat against a
wall rather like one does with a mat. The cart passes round a dead donkey
or cow in the mud. And a MAN tied to a cart is being hammered to death by
four NUNS with huge mallets.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages