diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/nvim/api/vim.c | 4 | ||||
-rw-r--r-- | src/nvim/eval.lua | 7 | ||||
-rw-r--r-- | src/nvim/ex_cmds.c | 2 | ||||
-rw-r--r-- | src/nvim/ex_getln.c | 39 | ||||
-rw-r--r-- | src/nvim/option.c | 236 | ||||
-rw-r--r-- | src/nvim/optionstr.c | 5 | ||||
-rw-r--r-- | src/nvim/vvars.lua | 2 |
8 files changed, 129 insertions, 172 deletions
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 0ba2eeb376..cb71144130 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -750,6 +750,7 @@ add_custom_target(nvim_runtime_deps) if(WIN32) # Copy DLLs and third-party tools to bin/ and install them along with nvim add_custom_command(TARGET nvim_runtime_deps + POST_BUILD COMMAND ${CMAKE_COMMAND} -E ${COPY_DIRECTORY} ${PROJECT_BINARY_DIR}/windows_runtime_deps/ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) install(DIRECTORY ${PROJECT_BINARY_DIR}/windows_runtime_deps/ @@ -791,7 +792,10 @@ file(MAKE_DIRECTORY ${BINARY_LIB_DIR}) # install treesitter parser if bundled if(EXISTS ${DEPS_PREFIX}/lib/nvim/parser) - add_custom_command(TARGET nvim_runtime_deps COMMAND ${CMAKE_COMMAND} -E ${COPY_DIRECTORY} ${DEPS_PREFIX}/lib/nvim/parser ${BINARY_LIB_DIR}/parser) + add_custom_command( + TARGET nvim_runtime_deps + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E ${COPY_DIRECTORY} ${DEPS_PREFIX}/lib/nvim/parser ${BINARY_LIB_DIR}/parser) endif() install(DIRECTORY ${BINARY_LIB_DIR} diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index aacd7d754c..ee05ad28ac 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -781,8 +781,8 @@ void nvim_set_vvar(String name, Object value, Error *err) /// can be omitted for no highlight. /// @param history if true, add to |message-history|. /// @param opts Optional parameters. -/// - verbose: Message was printed as a result of 'verbose' option -/// if Nvim was invoked with -V3log_file, the message will be +/// - verbose: Message is printed as a result of 'verbose' option. +/// If Nvim was invoked with -V3log_file, the message will be /// redirected to the log_file and suppressed from direct output. void nvim_echo(Array chunks, Boolean history, Dict(echo_opts) *opts, Error *err) FUNC_API_SINCE(7) diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua index 870eb17b9e..a418b34909 100644 --- a/src/nvim/eval.lua +++ b/src/nvim/eval.lua @@ -1137,7 +1137,7 @@ M.funcs = { ]=], name = 'charcol', - params = { { 'expr', 'string|integer[]' }, { 'winid', 'integer' } }, + params = { { 'expr', 'string|any[]' }, { 'winid', 'integer' } }, returns = 'integer', signature = 'charcol({expr} [, {winid}])', }, @@ -1296,7 +1296,7 @@ M.funcs = { ]=], name = 'col', - params = { { 'expr', 'string|integer[]' }, { 'winid', 'integer' } }, + params = { { 'expr', 'string|any[]' }, { 'winid', 'integer' } }, returns = 'integer', signature = 'col({expr} [, {winid}])', }, @@ -2165,6 +2165,7 @@ M.funcs = { If {expr} starts with "./" the |current-directory| is used. ]=], + fast = true, name = 'exepath', params = { { 'expr', 'string' } }, signature = 'exepath({expr})', @@ -12683,7 +12684,7 @@ M.funcs = { ]=], name = 'virtcol', - params = { { 'expr', 'string|integer[]' }, { 'list', 'boolean' }, { 'winid', 'integer' } }, + params = { { 'expr', 'string|any[]' }, { 'list', 'boolean' }, { 'winid', 'integer' } }, signature = 'virtcol({expr} [, {list} [, {winid}]])', }, virtcol2col = { diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index bf43ce0a84..a143dc6e49 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -2261,7 +2261,7 @@ int do_ecmd(int fnum, char *ffname, char *sfname, exarg_T *eap, linenr_T newlnum if (buf == NULL) { goto theend; } - // autocommands try to edit a file that is goind to be removed, abort + // autocommands try to edit a file that is going to be removed, abort if (buf_locked(buf)) { // window was split, but not editing the new buffer, reset b_nwindows again if (oldwin == NULL diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 17474f2642..dd107cd3bf 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -2550,6 +2550,9 @@ static bool cmdpreview_may_show(CommandLineState *s) goto end; } + // Cursor may be at the end of the message grid rather than at cmdspos. + // Place it there in case preview callback flushes it. #30696 + cursorcmd(); // Flush now: external cmdline may itself wish to update the screen which is // currently disallowed during cmdpreview(no longer needed in case that changes). cmdline_ui_flush(); @@ -3589,38 +3592,14 @@ void put_on_cmdline(const char *str, int len, bool redraw) memmove(ccline.cmdbuff + ccline.cmdpos, str, (size_t)len); ccline.cmdbuff[ccline.cmdlen] = NUL; - { - // When the inserted text starts with a composing character, - // backup to the character before it. There could be two of them. - int i = 0; - int c = utf_ptr2char(ccline.cmdbuff + ccline.cmdpos); - // TODO(bfredl): this can be corrected/simplified as utf_head_off implements the - // correct grapheme cluster breaks - while (ccline.cmdpos > 0 && utf_iscomposing_legacy(c)) { - i = utf_head_off(ccline.cmdbuff, ccline.cmdbuff + ccline.cmdpos - 1) + 1; + // When the inserted text starts with a composing character, + // backup to the character before it. + if (ccline.cmdpos > 0 && (uint8_t)ccline.cmdbuff[ccline.cmdpos] >= 0x80) { + int i = utf_head_off(ccline.cmdbuff, ccline.cmdbuff + ccline.cmdpos); + if (i != 0) { ccline.cmdpos -= i; len += i; - c = utf_ptr2char(ccline.cmdbuff + ccline.cmdpos); - } - if (i == 0 && ccline.cmdpos > 0 && arabic_maycombine(c)) { - // Check the previous character for Arabic combining pair. - i = utf_head_off(ccline.cmdbuff, ccline.cmdbuff + ccline.cmdpos - 1) + 1; - if (arabic_combine(utf_ptr2char(ccline.cmdbuff + ccline.cmdpos - i), c)) { - ccline.cmdpos -= i; - len += i; - } else { - i = 0; - } - } - if (i != 0) { - // Also backup the cursor position. - i = ptr2cells(ccline.cmdbuff + ccline.cmdpos); - ccline.cmdspos -= i; - msg_col -= i; - if (msg_col < 0) { - msg_col += Columns; - msg_row--; - } + ccline.cmdspos = cmd_screencol(ccline.cmdpos); } } diff --git a/src/nvim/option.c b/src/nvim/option.c index 0944a3041e..25e9fa471d 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -1242,11 +1242,10 @@ static void do_one_set_option(int opt_flags, char **argp, bool *did_show, char * } uint8_t nextchar = (uint8_t)(*p); // next non-white char after option name - uint32_t flags = 0; // flags for current option - void *varp = NULL; // pointer to variable for current option - - flags = options[opt_idx].flags; - varp = get_varp_scope(&(options[opt_idx]), opt_flags); + // flags for current option + uint32_t flags = options[opt_idx].flags; + // pointer to variable for current option + void *varp = get_varp_scope(&(options[opt_idx]), opt_flags); if (validate_opt_idx(curwin, opt_idx, opt_flags, flags, prefix, errmsg) == FAIL) { return; @@ -1323,8 +1322,7 @@ static void do_one_set_option(int opt_flags, char **argp, bool *did_show, char * return; } - *errmsg = set_option(opt_idx, varp, newval, opt_flags, 0, false, op == OP_NONE, errbuf, - errbuflen); + *errmsg = set_option(opt_idx, newval, opt_flags, 0, false, op == OP_NONE, errbuf, errbuflen); } /// Parse 'arg' for option settings. @@ -1888,7 +1886,7 @@ static const char *did_set_arabic(optset_T *args) // set rightleft mode if (!win->w_p_rl) { win->w_p_rl = true; - changed_window_setting(curwin); + changed_window_setting(win); } // Enable Arabic shaping (major part of what Arabic requires) @@ -1919,7 +1917,7 @@ static const char *did_set_arabic(optset_T *args) // reset rightleft mode if (win->w_p_rl) { win->w_p_rl = false; - changed_window_setting(curwin); + changed_window_setting(win); } // 'arabicshape' isn't reset, it is a global option and @@ -1930,8 +1928,8 @@ static const char *did_set_arabic(optset_T *args) // window may still want it "on". // Revert to the default keymap - curbuf->b_p_iminsert = B_IMODE_NONE; - curbuf->b_p_imsearch = B_IMODE_USE_INSERT; + win->w_buffer->b_p_iminsert = B_IMODE_NONE; + win->w_buffer->b_p_imsearch = B_IMODE_USE_INSERT; } return errmsg; @@ -2053,9 +2051,7 @@ static const char *did_set_helpheight(optset_T *args) { // Change window height NOW if (!ONE_WINDOW) { - buf_T *buf = (buf_T *)args->os_buf; - win_T *win = (win_T *)args->os_win; - if (buf->b_help && win->w_height < p_hh) { + if (curbuf->b_help && curwin->w_height < p_hh) { win_setheight((int)p_hh); } } @@ -2384,14 +2380,16 @@ static const char *did_set_pumblend(optset_T *args FUNC_ATTR_UNUSED) /// Process the updated 'readonly' option value. static const char *did_set_readonly(optset_T *args) { + buf_T *buf = (buf_T *)args->os_buf; + // when 'readonly' is reset globally, also reset readonlymode - if (!curbuf->b_p_ro && (args->os_flags & OPT_LOCAL) == 0) { + if (!buf->b_p_ro && (args->os_flags & OPT_LOCAL) == 0) { readonlymode = false; } // when 'readonly' is set may give W10 again - if (curbuf->b_p_ro) { - curbuf->b_did_warn = false; + if (buf->b_p_ro) { + buf->b_did_warn = false; } redraw_titles(); @@ -2507,8 +2505,7 @@ static const char *did_set_swapfile(optset_T *args) if (buf->b_p_swf && p_uc) { ml_open_file(buf); // create the swap file } else { - // no need to reset curbuf->b_may_swap, ml_open_file() will check - // buf->b_p_swf + // no need to reset buf->b_may_swap, ml_open_file() will check buf->b_p_swf mf_close_file(buf, true); // remove the swap file } return NULL; @@ -2548,8 +2545,10 @@ static const char *did_set_titlelen(optset_T *args) /// Process the updated 'undofile' option value. static const char *did_set_undofile(optset_T *args) { + buf_T *buf = (buf_T *)args->os_buf; + // Only take action when the option was set. - if (!curbuf->b_p_udf && !p_udf) { + if (!buf->b_p_udf && !p_udf) { return NULL; } @@ -2562,7 +2561,7 @@ static const char *did_set_undofile(optset_T *args) // only for the current buffer: Try to read in the undofile, // if one exists, the buffer wasn't changed and the buffer was // loaded - if ((curbuf == bp + if ((buf == bp || (args->os_flags & OPT_GLOBAL) || args->os_flags == 0) && !bufIsChanged(bp) && bp->b_ml.ml_mfp != NULL) { u_compute_hash(bp, hash); @@ -2602,7 +2601,7 @@ static const char *did_set_undolevels(optset_T *args) if (pp == &p_ul) { // global 'undolevels' did_set_global_undolevels(args->os_newval.number, args->os_oldval.number); - } else if (pp == &curbuf->b_p_ul) { // buffer local 'undolevels' + } else if (pp == &buf->b_p_ul) { // buffer local 'undolevels' did_set_buflocal_undolevels(buf, args->os_newval.number, args->os_oldval.number); } @@ -2667,8 +2666,7 @@ static const char *did_set_winheight(optset_T *args) { // Change window height NOW if (!ONE_WINDOW) { - win_T *win = (win_T *)args->os_win; - if (win->w_height < p_wh) { + if (curwin->w_height < p_wh) { win_setheight((int)p_wh); } } @@ -2679,9 +2677,7 @@ static const char *did_set_winheight(optset_T *args) /// Process the new 'winwidth' option value. static const char *did_set_winwidth(optset_T *args) { - win_T *win = (win_T *)args->os_win; - - if (!ONE_WINDOW && win->w_width < p_wiw) { + if (!ONE_WINDOW && curwin->w_width < p_wiw) { win_setwidth((int)p_wiw); } return NULL; @@ -2744,15 +2740,14 @@ static void do_spelllang_source(win_T *win) /// Check the bounds of numeric options. /// /// @param opt_idx Index in options[] table. Must not be kOptInvalid. -/// @param[in] varp Pointer to option variable. /// @param[in,out] newval Pointer to new option value. Will be set to bound checked value. /// @param[out] errbuf Buffer for error message. Cannot be NULL. /// @param errbuflen Length of error buffer. /// /// @return Error message, if any. -static const char *check_num_option_bounds(OptIndex opt_idx, void *varp, OptInt *newval, - char *errbuf, size_t errbuflen) - FUNC_ATTR_NONNULL_ARG(4) +static const char *check_num_option_bounds(OptIndex opt_idx, OptInt *newval, char *errbuf, + size_t errbuflen) + FUNC_ATTR_NONNULL_ARG(3) { const char *errmsg = NULL; @@ -2785,9 +2780,7 @@ static const char *check_num_option_bounds(OptIndex opt_idx, void *varp, OptInt } break; case kOptScroll: - if (varp == &(curwin->w_p_scr) - && (*newval <= 0 - || (*newval > curwin->w_height_inner && curwin->w_height_inner > 0)) + if ((*newval <= 0 || (*newval > curwin->w_height_inner && curwin->w_height_inner > 0)) && full_screen) { if (*newval != 0) { errmsg = e_scroll; @@ -2805,13 +2798,12 @@ static const char *check_num_option_bounds(OptIndex opt_idx, void *varp, OptInt /// Validate and bound check option value. /// /// @param opt_idx Index in options[] table. Must not be kOptInvalid. -/// @param[in] varp Pointer to option variable. /// @param[in,out] newval Pointer to new option value. Will be set to bound checked value. /// @param[out] errbuf Buffer for error message. Cannot be NULL. /// @param errbuflen Length of error buffer. /// /// @return Error message, if any. -static const char *validate_num_option(OptIndex opt_idx, void *varp, OptInt *newval, char *errbuf, +static const char *validate_num_option(OptIndex opt_idx, OptInt *newval, char *errbuf, size_t errbuflen) { OptInt value = *newval; @@ -2821,145 +2813,137 @@ static const char *validate_num_option(OptIndex opt_idx, void *varp, OptInt *new return e_invarg; } - if (varp == &p_wh) { + switch (opt_idx) { + case kOptHelpheight: + case kOptTitlelen: + case kOptUpdatecount: + case kOptReport: + case kOptUpdatetime: + case kOptSidescroll: + case kOptFoldlevel: + case kOptShiftwidth: + case kOptTextwidth: + case kOptWritedelay: + case kOptTimeoutlen: + if (value < 0) { + return e_positive; + } + break; + case kOptWinheight: if (value < 1) { return e_positive; } else if (p_wmh > value) { return e_winheight; } - } else if (varp == &p_hh) { - if (value < 0) { - return e_positive; - } - } else if (varp == &p_wmh) { + break; + case kOptWinminheight: if (value < 0) { return e_positive; } else if (value > p_wh) { return e_winheight; } - } else if (varp == &p_wiw) { + break; + case kOptWinwidth: if (value < 1) { return e_positive; } else if (p_wmw > value) { return e_winwidth; } - } else if (varp == &p_wmw) { + break; + case kOptWinminwidth: if (value < 0) { return e_positive; } else if (value > p_wiw) { return e_winwidth; } - } else if (varp == &p_mco) { + break; + case kOptMaxcombine: *newval = MAX_MCO; - } else if (varp == &p_titlelen) { - if (value < 0) { - return e_positive; - } - } else if (varp == &p_uc) { - if (value < 0) { - return e_positive; - } - } else if (varp == &p_ch) { + break; + case kOptCmdheight: if (value < 0) { return e_positive; } else { p_ch_was_zero = value == 0; } - } else if (varp == &p_tm) { - if (value < 0) { - return e_positive; - } - } else if (varp == &p_hi) { + break; + case kOptHistory: if (value < 0) { return e_positive; } else if (value > 10000) { return e_invarg; } - } else if (varp == &p_pyx) { + break; + case kOptPyxversion: if (value == 0) { *newval = 3; } else if (value != 3) { return e_invarg; } - } else if (varp == &p_re) { + break; + case kOptRegexpengine: if (value < 0 || value > 2) { return e_invarg; } - } else if (varp == &p_report) { - if (value < 0) { - return e_positive; - } - } else if (varp == &p_so) { + break; + case kOptScrolloff: if (value < 0 && full_screen) { return e_positive; } - } else if (varp == &p_siso) { + break; + case kOptSidescrolloff: if (value < 0 && full_screen) { return e_positive; } - } else if (varp == &p_cwh) { + break; + case kOptCmdwinheight: if (value < 1) { return e_positive; } - } else if (varp == &p_ut) { - if (value < 0) { - return e_positive; - } - } else if (varp == &p_ss) { - if (value < 0) { - return e_positive; - } - } else if (varp == &curwin->w_p_fdl || varp == &curwin->w_allbuf_opt.wo_fdl) { - if (value < 0) { - return e_positive; - } - } else if (varp == &curwin->w_p_cole || varp == &curwin->w_allbuf_opt.wo_cole) { + break; + case kOptConceallevel: if (value < 0) { return e_positive; } else if (value > 3) { return e_invarg; } - } else if (varp == &curwin->w_p_nuw || varp == &curwin->w_allbuf_opt.wo_nuw) { + break; + case kOptNumberwidth: if (value < 1) { return e_positive; } else if (value > MAX_NUMBERWIDTH) { return e_invarg; } - } else if (varp == &curbuf->b_p_iminsert || varp == &p_iminsert) { + break; + case kOptIminsert: if (value < 0 || value > B_IMODE_LAST) { return e_invarg; } - } else if (varp == &curbuf->b_p_imsearch || varp == &p_imsearch) { + break; + case kOptImsearch: if (value < -1 || value > B_IMODE_LAST) { return e_invarg; } - } else if (varp == &curbuf->b_p_channel || varp == &p_channel) { + break; + case kOptChannel: return e_invarg; - } else if (varp == &curbuf->b_p_scbk || varp == &p_scbk) { + case kOptScrollback: if (value < -1 || value > SB_MAX) { return e_invarg; } - } else if (varp == &curbuf->b_p_sw || varp == &p_sw) { - if (value < 0) { - return e_positive; - } - } else if (varp == &curbuf->b_p_ts || varp == &p_ts) { + break; + case kOptTabstop: if (value < 1) { return e_positive; } else if (value > TABSTOP_MAX) { return e_invarg; } - } else if (varp == &curbuf->b_p_tw || varp == &p_tw) { - if (value < 0) { - return e_positive; - } - } else if (varp == &p_wd) { - if (value < 0) { - return e_positive; - } + break; + default: + break; } - return check_num_option_bounds(opt_idx, varp, newval, errbuf, errbuflen); + return check_num_option_bounds(opt_idx, newval, errbuf, errbuflen); } /// Called after an option changed: check if something needs to be redrawn. @@ -3124,7 +3108,8 @@ bool optval_equal(OptVal o1, OptVal o2) return o1.data.number == o2.data.number; case kOptValTypeString: return o1.data.string.size == o2.data.string.size - && strnequal(o1.data.string.data, o2.data.string.data, o1.data.string.size); + && (o1.data.string.data == o2.data.string.data + || strnequal(o1.data.string.data, o2.data.string.data, o1.data.string.size)); } UNREACHABLE; } @@ -3297,8 +3282,6 @@ static char *option_get_valid_types(OptIndex opt_idx) // Ensure that the string is NUL-terminated. kv_push(str, NUL); return str.items; - -#undef OPTION_ADD_TYPE } /// Check if option is hidden. @@ -3586,14 +3569,19 @@ static const char *did_set_option(OptIndex opt_idx, void *varp, OptVal old_value /// Validate the new value for an option. /// /// @param opt_idx Index in options[] table. Must not be kOptInvalid. -/// @param varp Pointer to option variable. /// @param newval[in,out] New option value. Might be modified. -static const char *validate_option_value(const OptIndex opt_idx, void *varp, OptVal *newval, - int opt_flags, char *errbuf, size_t errbuflen) +static const char *validate_option_value(const OptIndex opt_idx, OptVal *newval, int opt_flags, + char *errbuf, size_t errbuflen) { const char *errmsg = NULL; vimoption_T *opt = &options[opt_idx]; + // Always allow unsetting local value of global-local option. + if (option_is_global_local(opt_idx) && (opt_flags & OPT_LOCAL) + && optval_equal(*newval, get_option_unset_value(opt_idx))) { + return NULL; + } + if (newval->type == kOptValTypeNil) { // Don't try to unset local value if scope is global. // TODO(famiu): Change this to forbid changing all non-local scopes when the API scope bug is @@ -3613,7 +3601,7 @@ static const char *validate_option_value(const OptIndex opt_idx, void *varp, Opt errmsg = errbuf; } else if (newval->type == kOptValTypeNumber) { // Validate and bound check num option values. - errmsg = validate_num_option(opt_idx, varp, &newval->data.number, errbuf, errbuflen); + errmsg = validate_num_option(opt_idx, &newval->data.number, errbuf, errbuflen); } return errmsg; @@ -3622,7 +3610,6 @@ static const char *validate_option_value(const OptIndex opt_idx, void *varp, Opt /// Set the value of an option using an OptVal. /// /// @param opt_idx Index in options[] table. Must not be kOptInvalid. -/// @param[in] varp Option variable pointer, cannot be NULL. /// @param value New option value. Might get freed. /// @param opt_flags Option flags. /// @param set_sid Script ID. Special values: @@ -3634,17 +3621,16 @@ static const char *validate_option_value(const OptIndex opt_idx, void *varp, Opt /// @param errbuflen Length of error buffer. /// /// @return NULL on success, an untranslated error message on error. -static const char *set_option(const OptIndex opt_idx, void *varp, OptVal value, int opt_flags, - scid_T set_sid, const bool direct, const bool value_replaced, - char *errbuf, size_t errbuflen) - FUNC_ATTR_NONNULL_ARG(2) +static const char *set_option(const OptIndex opt_idx, OptVal value, int opt_flags, scid_T set_sid, + const bool direct, const bool value_replaced, char *errbuf, + size_t errbuflen) { assert(opt_idx != kOptInvalid); const char *errmsg = NULL; if (!direct) { - errmsg = validate_option_value(opt_idx, varp, &value, opt_flags, errbuf, errbuflen); + errmsg = validate_option_value(opt_idx, &value, opt_flags, errbuf, errbuflen); if (errmsg != NULL) { optval_free(value); @@ -3661,11 +3647,9 @@ static const char *set_option(const OptIndex opt_idx, void *varp, OptVal value, const bool is_opt_local_unset = is_option_local_value_unset(opt_idx); // When using ":set opt=val" for a global option with a local value the local value will be reset, - // use the global value here. - if (scope_both && option_is_global_local(opt_idx)) { - varp = opt->var; - } - + // use the global value in that case. + void *varp + = scope_both && option_is_global_local(opt_idx) ? opt->var : get_varp_scope(opt, opt_flags); void *varp_local = get_varp_scope(opt, OPT_LOCAL); void *varp_global = get_varp_scope(opt, OPT_GLOBAL); @@ -3739,16 +3723,11 @@ void set_option_direct(OptIndex opt_idx, OptVal value, int opt_flags, scid_T set { static char errbuf[IOSIZE]; - vimoption_T *opt = get_option(opt_idx); - if (is_option_hidden(opt_idx)) { return; } - const bool scope_both = (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0; - void *varp = get_varp_scope(opt, scope_both ? OPT_LOCAL : opt_flags); - - const char *errmsg = set_option(opt_idx, varp, optval_copy(value), opt_flags, set_sid, true, true, + const char *errmsg = set_option(opt_idx, optval_copy(value), opt_flags, set_sid, true, true, errbuf, sizeof(errbuf)); assert(errmsg == NULL); (void)errmsg; // ignore unused warning @@ -3810,14 +3789,7 @@ const char *set_option_value(const OptIndex opt_idx, const OptVal value, int opt return _(e_sandbox); } - void *varp = get_varp_scope(&(options[opt_idx]), opt_flags); - if (varp == NULL) { - // hidden option is not changed - return NULL; - } - - return set_option(opt_idx, varp, optval_copy(value), opt_flags, 0, false, true, errbuf, - sizeof(errbuf)); + return set_option(opt_idx, optval_copy(value), opt_flags, 0, false, true, errbuf, sizeof(errbuf)); } /// Unset the local value of a global-local option. diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c index af2b09513b..bfb26a0be6 100644 --- a/src/nvim/optionstr.c +++ b/src/nvim/optionstr.c @@ -892,10 +892,11 @@ int expand_set_chars_option(optexpand_T *args, int *numMatches, char ***matches) } /// The 'cinoptions' option is changed. -const char *did_set_cinoptions(optset_T *args FUNC_ATTR_UNUSED) +const char *did_set_cinoptions(optset_T *args) { + buf_T *buf = (buf_T *)args->os_buf; // TODO(vim): recognize errors - parse_cino(curbuf); + parse_cino(buf); return NULL; } diff --git a/src/nvim/vvars.lua b/src/nvim/vvars.lua index ad139bbbfe..4936f62e3e 100644 --- a/src/nvim/vvars.lua +++ b/src/nvim/vvars.lua @@ -177,7 +177,7 @@ M.vars = { inclusive Motion is |inclusive|, else exclusive. scope Event-specific scope name. operator Current |operator|. Also set for Ex - commands (unlike |v:operator|). For + commands (unlike |v:operator|). For example if |TextYankPost| is triggered by the |:yank| Ex command then `v:event.operator` is "y". |