aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/indent.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-08-26 18:49:29 +0800
committerGitHub <noreply@github.com>2022-08-26 18:49:29 +0800
commit6547f4397fe643f194763306f8fcdfc6f6ce4b24 (patch)
tree5301f5cc0801a477219a50902228916dce6ae08b /src/nvim/indent.c
parent06d5c6332deeb52ccd78d632d1fb28df91faf7dc (diff)
downloadrneovim-6547f4397fe643f194763306f8fcdfc6f6ce4b24.tar.gz
rneovim-6547f4397fe643f194763306f8fcdfc6f6ce4b24.tar.bz2
rneovim-6547f4397fe643f194763306f8fcdfc6f6ce4b24.zip
vim-patch:8.1.2331: the option.c file is still very big (#19954)
Problem: The option.c file is still very big. Solution: Move a few functions to where they fit better. (Yegappan Lakshmanan, closes vim/vim#4895) https://github.com/vim/vim/commit/7bae0b1bc84a95d565ffab38cf7f82ad21c656b6 vim-patch:9.0.0271: using INIT() in non-header files Problem: Using INIT() in non-header files. Solution: Remove INIT(). (closes vim/vim#10981) https://github.com/vim/vim/commit/9b7d2a959646560f5770329f4428c4739eed4656
Diffstat (limited to 'src/nvim/indent.c')
-rw-r--r--src/nvim/indent.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/nvim/indent.c b/src/nvim/indent.c
index 12fad371ae..c44cd06a2f 100644
--- a/src/nvim/indent.c
+++ b/src/nvim/indent.c
@@ -732,6 +732,47 @@ int get_number_indent(linenr_T lnum)
return (int)col;
}
+/// This is called when 'breakindentopt' is changed and when a window is
+/// initialized
+bool briopt_check(win_T *wp)
+{
+ int bri_shift = 0;
+ int bri_min = 20;
+ bool bri_sbr = false;
+ int bri_list = 0;
+
+ char *p = wp->w_p_briopt;
+ while (*p != NUL) {
+ if (STRNCMP(p, "shift:", 6) == 0
+ && ((p[6] == '-' && ascii_isdigit(p[7])) || ascii_isdigit(p[6]))) {
+ p += 6;
+ bri_shift = getdigits_int(&p, true, 0);
+ } else if (STRNCMP(p, "min:", 4) == 0 && ascii_isdigit(p[4])) {
+ p += 4;
+ bri_min = getdigits_int(&p, true, 0);
+ } else if (STRNCMP(p, "sbr", 3) == 0) {
+ p += 3;
+ bri_sbr = true;
+ } else if (STRNCMP(p, "list:", 5) == 0) {
+ p += 5;
+ bri_list = (int)getdigits(&p, false, 0);
+ }
+ if (*p != ',' && *p != NUL) {
+ return false;
+ }
+ if (*p == ',') {
+ p++;
+ }
+ }
+
+ wp->w_briopt_shift = bri_shift;
+ wp->w_briopt_min = bri_min;
+ wp->w_briopt_sbr = bri_sbr;
+ wp->w_briopt_list = bri_list;
+
+ return true;
+}
+
// Return appropriate space number for breakindent, taking influencing
// parameters into account. Window must be specified, since it is not
// necessarily always the current one.