mirror of
https://github.com/neovim/neovim.git
synced 2025-09-05 19:08:15 +00:00
vim-patch:9.1.0806: tests: no error check when setting global 'briopt'
Problem: tests: no error check when setting global 'briopt'
Solution: also parse and check global 'briopt' value (Milly)
closes: vim/vim#15911
b38700ac81
Co-authored-by: Milly <milly.ca@gmail.com>
This commit is contained in:
@@ -769,9 +769,15 @@ int get_number_indent(linenr_T lnum)
|
||||
return (int)col;
|
||||
}
|
||||
|
||||
/// Check "briopt" as 'breakindentopt' and update the members of "wp".
|
||||
/// This is called when 'breakindentopt' is changed and when a window is
|
||||
/// initialized
|
||||
bool briopt_check(win_T *wp)
|
||||
///
|
||||
/// @param briopt when NULL: use "wp->w_p_briopt"
|
||||
/// @param wp when NULL: only check "briopt"
|
||||
///
|
||||
/// @return FAIL for failure, OK otherwise.
|
||||
bool briopt_check(char *briopt, win_T *wp)
|
||||
{
|
||||
int bri_shift = 0;
|
||||
int bri_min = 20;
|
||||
@@ -779,7 +785,13 @@ bool briopt_check(win_T *wp)
|
||||
int bri_list = 0;
|
||||
int bri_vcol = 0;
|
||||
|
||||
char *p = wp->w_p_briopt;
|
||||
char *p = empty_string_option;
|
||||
if (briopt != NULL) {
|
||||
p = briopt;
|
||||
} else if (wp != NULL) {
|
||||
p = wp->w_p_briopt;
|
||||
}
|
||||
|
||||
while (*p != NUL) {
|
||||
// Note: Keep this in sync with p_briopt_values
|
||||
if (strncmp(p, "shift:", 6) == 0
|
||||
@@ -807,6 +819,10 @@ bool briopt_check(win_T *wp)
|
||||
}
|
||||
}
|
||||
|
||||
if (wp == NULL) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
wp->w_briopt_shift = bri_shift;
|
||||
wp->w_briopt_min = bri_min;
|
||||
wp->w_briopt_sbr = bri_sbr;
|
||||
|
@@ -5112,7 +5112,7 @@ void didset_window_options(win_T *wp, bool valid_cursor)
|
||||
wp->w_skipcol = 0;
|
||||
}
|
||||
check_colorcolumn(NULL, wp);
|
||||
briopt_check(wp);
|
||||
briopt_check(NULL, wp);
|
||||
fill_culopt_flags(NULL, wp);
|
||||
set_chars_option(wp, wp->w_p_fcs, kFillchars, true, NULL, 0);
|
||||
set_chars_option(wp, wp->w_p_lcs, kListchars, true, NULL, 0);
|
||||
|
@@ -717,11 +717,14 @@ const char *did_set_breakat(optset_T *args FUNC_ATTR_UNUSED)
|
||||
const char *did_set_breakindentopt(optset_T *args)
|
||||
{
|
||||
win_T *win = (win_T *)args->os_win;
|
||||
if (briopt_check(win) == FAIL) {
|
||||
char **varp = (char **)args->os_varp;
|
||||
|
||||
if (briopt_check(*varp, varp == &win->w_p_briopt ? win : NULL) == FAIL) {
|
||||
return e_invarg;
|
||||
}
|
||||
|
||||
// list setting requires a redraw
|
||||
if (win == curwin && win->w_briopt_list) {
|
||||
if (varp == &win->w_p_briopt && win->w_briopt_list) {
|
||||
redraw_all_later(UPD_NOT_VALID);
|
||||
}
|
||||
|
||||
|
@@ -45,7 +45,6 @@ endwhile
|
||||
let skip_setglobal_reasons = #{
|
||||
\ iminsert: 'The global value is always overwritten by the local value',
|
||||
\ imsearch: 'The global value is always overwritten by the local value',
|
||||
\ breakindentopt: 'TODO: fix missing error handling for setglobal',
|
||||
\ conceallevel: 'TODO: fix missing error handling for setglobal',
|
||||
\ foldcolumn: 'TODO: fix missing error handling for setglobal',
|
||||
\ numberwidth: 'TODO: fix missing error handling for setglobal',
|
||||
|
Reference in New Issue
Block a user