diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2024-11-25 19:15:05 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2024-11-25 19:27:38 +0000 |
commit | c5d770d311841ea5230426cc4c868e8db27300a8 (patch) | |
tree | dd21f70127b4b8b5f109baefc8ecc5016f507c91 /src/nvim/indent.c | |
parent | 9be89f131f87608f224f0ee06d199fcd09d32176 (diff) | |
parent | 081beb3659bd6d8efc3e977a160b1e72becbd8a2 (diff) | |
download | rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.gz rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.bz2 rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.zip |
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'src/nvim/indent.c')
-rw-r--r-- | src/nvim/indent.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/nvim/indent.c b/src/nvim/indent.c index b7e3842aad..e487728901 100644 --- a/src/nvim/indent.c +++ b/src/nvim/indent.c @@ -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; @@ -1166,7 +1182,7 @@ int get_expr_indent(void) sandbox++; } textlock++; - current_sctx = curbuf->b_p_script_ctx[BV_INDE].script_ctx; + current_sctx = curbuf->b_p_script_ctx[kBufOptIndentexpr].script_ctx; // Need to make a copy, the 'indentexpr' option could be changed while // evaluating it. |