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>
diff --git a/src/indent.c b/src/indent.c
index 4ba31d2..e7de005 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -869,11 +869,15 @@
#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
* initialized.
+ * Returns FAIL for failure, OK otherwise.
*/
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;
int bri_shift = 0;
@@ -882,7 +886,11 @@
int bri_list = 0;
int bri_vcol = 0;
- p = wp->w_p_briopt;
+ if (briopt != NULL)
+ p = briopt;
+ else
+ p = wp->w_p_briopt;
+
while (*p != NUL)
{
// Note: Keep this in sync with p_briopt_values
@@ -918,6 +926,9 @@
++p;
}
+ if (wp == NULL)
+ return OK;
+
wp->w_briopt_shift = bri_shift;
wp->w_briopt_min = bri_min;
wp->w_briopt_sbr = bri_sbr;