Mercurial > vim
comparison src/option.c @ 19137:69f0e9b5c107 v8.2.0128
patch 8.2.0128: cannot list options one per line
Commit: https://github.com/vim/vim/commit/6b915c0c0ee7ef82f8d3d310a4345e098cb929b0
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 18 15:53:19 2020 +0100
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 18 Jan 2020 16:00:04 +0100 |
parents | 847cc7932c42 |
children | 2ef19eed524a |
comparison
equal
deleted
inserted
replaced
19136:bbce494fe8df | 19137:69f0e9b5c107 |
---|---|
1063 options[idx1].def_val[VI_DEFAULT] = (char_u *)(long_i)val; | 1063 options[idx1].def_val[VI_DEFAULT] = (char_u *)(long_i)val; |
1064 p_icon = val; | 1064 p_icon = val; |
1065 } | 1065 } |
1066 } | 1066 } |
1067 #endif | 1067 #endif |
1068 | |
1069 void | |
1070 ex_set(exarg_T *eap) | |
1071 { | |
1072 int flags = 0; | |
1073 | |
1074 if (eap->cmdidx == CMD_setlocal) | |
1075 flags = OPT_LOCAL; | |
1076 else if (eap->cmdidx == CMD_setglobal) | |
1077 flags = OPT_GLOBAL; | |
1078 #if defined(FEAT_EVAL) && defined(FEAT_BROWSE) | |
1079 if (cmdmod.browse && flags == 0) | |
1080 ex_options(eap); | |
1081 else | |
1082 #endif | |
1083 { | |
1084 if (eap->forceit) | |
1085 flags |= OPT_ONECOLUMN; | |
1086 (void)do_set(eap->arg, flags); | |
1087 } | |
1088 } | |
1068 | 1089 |
1069 /* | 1090 /* |
1070 * Parse 'arg' for option settings. | 1091 * Parse 'arg' for option settings. |
1071 * | 1092 * |
1072 * 'arg' may be IObuff, but only when no errors can be present and option | 1093 * 'arg' may be IObuff, but only when no errors can be present and option |
4347 int len; | 4368 int len; |
4348 | 4369 |
4349 #define INC 20 | 4370 #define INC 20 |
4350 #define GAP 3 | 4371 #define GAP 3 |
4351 | 4372 |
4352 items = ALLOC_MULT(struct vimoption *, PARAM_COUNT); | 4373 items = ALLOC_MULT(struct vimoption *, OPTION_COUNT); |
4353 if (items == NULL) | 4374 if (items == NULL) |
4354 return; | 4375 return; |
4355 | 4376 |
4356 // Highlight title | 4377 // Highlight title |
4357 if (all == 2) | 4378 if (all == 2) |
4362 msg_puts_title(_("\n--- Local option values ---")); | 4383 msg_puts_title(_("\n--- Local option values ---")); |
4363 else | 4384 else |
4364 msg_puts_title(_("\n--- Options ---")); | 4385 msg_puts_title(_("\n--- Options ---")); |
4365 | 4386 |
4366 /* | 4387 /* |
4367 * do the loop two times: | 4388 * Do the loop two times: |
4368 * 1. display the short items | 4389 * 1. display the short items |
4369 * 2. display the long items (only strings and numbers) | 4390 * 2. display the long items (only strings and numbers) |
4391 * When "opt_flags" has OPT_ONECOLUMN do everything in run 2. | |
4370 */ | 4392 */ |
4371 for (run = 1; run <= 2 && !got_int; ++run) | 4393 for (run = 1; run <= 2 && !got_int; ++run) |
4372 { | 4394 { |
4373 /* | 4395 /* |
4374 * collect the items in items[] | 4396 * collect the items in items[] |
4375 */ | 4397 */ |
4376 item_count = 0; | 4398 item_count = 0; |
4377 for (p = &options[0]; p->fullname != NULL; p++) | 4399 for (p = &options[0]; p->fullname != NULL; p++) |
4378 { | 4400 { |
4379 // apply :filter /pat/ | 4401 // apply :filter /pat/ |
4380 if (message_filtered((char_u *) p->fullname)) | 4402 if (message_filtered((char_u *)p->fullname)) |
4381 continue; | 4403 continue; |
4382 | 4404 |
4383 varp = NULL; | 4405 varp = NULL; |
4384 isterm = istermoption(p); | 4406 isterm = istermoption(p); |
4385 if (opt_flags != 0) | 4407 if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) != 0) |
4386 { | 4408 { |
4387 if (p->indir != PV_NONE && !isterm) | 4409 if (p->indir != PV_NONE && !isterm) |
4388 varp = get_varp_scope(p, opt_flags); | 4410 varp = get_varp_scope(p, opt_flags); |
4389 } | 4411 } |
4390 else | 4412 else |
4392 if (varp != NULL | 4414 if (varp != NULL |
4393 && ((all == 2 && isterm) | 4415 && ((all == 2 && isterm) |
4394 || (all == 1 && !isterm) | 4416 || (all == 1 && !isterm) |
4395 || (all == 0 && !optval_default(p, varp, p_cp)))) | 4417 || (all == 0 && !optval_default(p, varp, p_cp)))) |
4396 { | 4418 { |
4397 if (p->flags & P_BOOL) | 4419 if (opt_flags & OPT_ONECOLUMN) |
4420 len = Columns; | |
4421 else if (p->flags & P_BOOL) | |
4398 len = 1; // a toggle option fits always | 4422 len = 1; // a toggle option fits always |
4399 else | 4423 else |
4400 { | 4424 { |
4401 option_value2string(p, opt_flags); | 4425 option_value2string(p, opt_flags); |
4402 len = (int)STRLEN(p->fullname) + vim_strsize(NameBuff) + 1; | 4426 len = (int)STRLEN(p->fullname) + vim_strsize(NameBuff) + 1; |