mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
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: #15911 Signed-off-by: Milly <milly.ca@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
231480f975
commit
b38700ac81
15
src/indent.c
15
src/indent.c
@@ -869,11 +869,15 @@ get_number_indent(linenr_T lnum)
|
|||||||
|
|
||||||
#if defined(FEAT_LINEBREAK) || defined(PROTO)
|
#if defined(FEAT_LINEBREAK) || defined(PROTO)
|
||||||
/*
|
/*
|
||||||
|
* Check "briopt" as 'breakindentopt' and update the members of "wp".
|
||||||
* This is called when 'breakindentopt' is changed and when a window is
|
* This is called when 'breakindentopt' is changed and when a window is
|
||||||
* initialized.
|
* initialized.
|
||||||
|
* Returns FAIL for failure, OK otherwise.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
briopt_check(win_T *wp)
|
briopt_check(
|
||||||
|
char_u *briopt, // when NULL: use "wp->w_p_briopt"
|
||||||
|
win_T *wp) // when NULL: only check "briopt"
|
||||||
{
|
{
|
||||||
char_u *p;
|
char_u *p;
|
||||||
int bri_shift = 0;
|
int bri_shift = 0;
|
||||||
@@ -882,7 +886,11 @@ briopt_check(win_T *wp)
|
|||||||
int bri_list = 0;
|
int bri_list = 0;
|
||||||
int bri_vcol = 0;
|
int bri_vcol = 0;
|
||||||
|
|
||||||
p = wp->w_p_briopt;
|
if (briopt != NULL)
|
||||||
|
p = briopt;
|
||||||
|
else
|
||||||
|
p = wp->w_p_briopt;
|
||||||
|
|
||||||
while (*p != NUL)
|
while (*p != NUL)
|
||||||
{
|
{
|
||||||
// Note: Keep this in sync with p_briopt_values
|
// Note: Keep this in sync with p_briopt_values
|
||||||
@@ -918,6 +926,9 @@ briopt_check(win_T *wp)
|
|||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (wp == NULL)
|
||||||
|
return OK;
|
||||||
|
|
||||||
wp->w_briopt_shift = bri_shift;
|
wp->w_briopt_shift = bri_shift;
|
||||||
wp->w_briopt_min = bri_min;
|
wp->w_briopt_min = bri_min;
|
||||||
wp->w_briopt_sbr = bri_sbr;
|
wp->w_briopt_sbr = bri_sbr;
|
||||||
|
@@ -6751,7 +6751,7 @@ after_copy_winopt(win_T *wp)
|
|||||||
else
|
else
|
||||||
wp->w_skipcol = 0;
|
wp->w_skipcol = 0;
|
||||||
#ifdef FEAT_LINEBREAK
|
#ifdef FEAT_LINEBREAK
|
||||||
briopt_check(wp);
|
briopt_check(NULL, wp);
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_SYN_HL
|
#ifdef FEAT_SYN_HL
|
||||||
fill_culopt_flags(NULL, wp);
|
fill_culopt_flags(NULL, wp);
|
||||||
|
@@ -1235,17 +1235,19 @@ did_set_breakat(optset_T *args UNUSED)
|
|||||||
* The 'breakindentopt' option is changed.
|
* The 'breakindentopt' option is changed.
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
did_set_breakindentopt(optset_T *args UNUSED)
|
did_set_breakindentopt(optset_T *args)
|
||||||
{
|
{
|
||||||
char *errmsg = NULL;
|
char_u **varp = (char_u **)args->os_varp;
|
||||||
|
|
||||||
|
if (briopt_check(*varp, varp == &curwin->w_p_briopt ? curwin : NULL)
|
||||||
|
== FAIL)
|
||||||
|
return e_invalid_argument;
|
||||||
|
|
||||||
if (briopt_check(curwin) == FAIL)
|
|
||||||
errmsg = e_invalid_argument;
|
|
||||||
// list setting requires a redraw
|
// list setting requires a redraw
|
||||||
if (curwin->w_briopt_list)
|
if (varp == &curwin->w_p_briopt && curwin->w_briopt_list)
|
||||||
redraw_all_later(UPD_NOT_VALID);
|
redraw_all_later(UPD_NOT_VALID);
|
||||||
|
|
||||||
return errmsg;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@@ -18,7 +18,7 @@ int get_indent_str(char_u *ptr, int ts, int no_ts);
|
|||||||
int get_indent_str_vtab(char_u *ptr, int ts, int *vts, int no_ts);
|
int get_indent_str_vtab(char_u *ptr, int ts, int *vts, int no_ts);
|
||||||
int set_indent(int size, int flags);
|
int set_indent(int size, int flags);
|
||||||
int get_number_indent(linenr_T lnum);
|
int get_number_indent(linenr_T lnum);
|
||||||
int briopt_check(win_T *wp);
|
int briopt_check(char_u *briopt, win_T *wp);
|
||||||
int get_breakindent_win(win_T *wp, char_u *line);
|
int get_breakindent_win(win_T *wp, char_u *line);
|
||||||
int inindent(int extra);
|
int inindent(int extra);
|
||||||
void op_reindent(oparg_T *oap, int (*how)(void));
|
void op_reindent(oparg_T *oap, int (*how)(void));
|
||||||
|
@@ -45,7 +45,6 @@ endwhile
|
|||||||
let skip_setglobal_reasons = #{
|
let skip_setglobal_reasons = #{
|
||||||
\ iminsert: 'The global value is always overwritten by the local value',
|
\ iminsert: 'The global value is always overwritten by the local value',
|
||||||
\ imsearch: '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',
|
\ conceallevel: 'TODO: fix missing error handling for setglobal',
|
||||||
\ foldcolumn: 'TODO: fix missing error handling for setglobal',
|
\ foldcolumn: 'TODO: fix missing error handling for setglobal',
|
||||||
\ numberwidth: 'TODO: fix missing error handling for setglobal',
|
\ numberwidth: 'TODO: fix missing error handling for setglobal',
|
||||||
|
@@ -704,6 +704,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
806,
|
||||||
/**/
|
/**/
|
||||||
805,
|
805,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user