diff src/indent.c @ 18679:fd95d4dbeb37 v8.1.2331

patch 8.1.2331: the option.c file is still very big Commit: https://github.com/vim/vim/commit/7bae0b1bc84a95d565ffab38cf7f82ad21c656b6 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Nov 21 22:14:18 2019 +0100 patch 8.1.2331: the option.c file is still very big Problem: The option.c file is still very big. Solution: Move a few functions to where they fit better. (Yegappan Lakshmanan, closes #4895)
author Bram Moolenaar <Bram@vim.org>
date Thu, 21 Nov 2019 22:15:03 +0100
parents 788d76db02ac
children 49b78d6465e5
line wrap: on
line diff
--- a/src/indent.c
+++ b/src/indent.c
@@ -839,6 +839,50 @@ get_number_indent(linenr_T lnum)
 
 #if defined(FEAT_LINEBREAK) || defined(PROTO)
 /*
+ * This is called when 'breakindentopt' is changed and when a window is
+ * initialized.
+ */
+    int
+briopt_check(win_T *wp)
+{
+    char_u	*p;
+    int		bri_shift = 0;
+    long	bri_min = 20;
+    int		bri_sbr = FALSE;
+
+    p = wp->w_p_briopt;
+    while (*p != NUL)
+    {
+	if (STRNCMP(p, "shift:", 6) == 0
+		 && ((p[6] == '-' && VIM_ISDIGIT(p[7])) || VIM_ISDIGIT(p[6])))
+	{
+	    p += 6;
+	    bri_shift = getdigits(&p);
+	}
+	else if (STRNCMP(p, "min:", 4) == 0 && VIM_ISDIGIT(p[4]))
+	{
+	    p += 4;
+	    bri_min = getdigits(&p);
+	}
+	else if (STRNCMP(p, "sbr", 3) == 0)
+	{
+	    p += 3;
+	    bri_sbr = TRUE;
+	}
+	if (*p != ',' && *p != NUL)
+	    return FAIL;
+	if (*p == ',')
+	    ++p;
+    }
+
+    wp->w_p_brishift = bri_shift;
+    wp->w_p_brimin   = bri_min;
+    wp->w_p_brisbr   = bri_sbr;
+
+    return OK;
+}
+
+/*
  * Return appropriate space number for breakindent, taking influencing
  * parameters into account. Window must be specified, since it is not
  * necessarily always the current one.