aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-09-28 17:16:22 +0800
committerGitHub <noreply@github.com>2024-09-28 17:16:22 +0800
commitd5f6f61879bac3ac90512efe05d68e3500125a08 (patch)
treee47b8f939eab5cbca68b2ecd1ed876b0706bd9d3 /src
parent4349bdbd0bd0096b4f4bea0feda0961e3b03f3cc (diff)
downloadrneovim-d5f6f61879bac3ac90512efe05d68e3500125a08.tar.gz
rneovim-d5f6f61879bac3ac90512efe05d68e3500125a08.tar.bz2
rneovim-d5f6f61879bac3ac90512efe05d68e3500125a08.zip
fix(column): set signcolumn width after splitting window (#30556)
Diffstat (limited to 'src')
-rw-r--r--src/nvim/optionstr.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c
index 8eadd52972..a9651084b7 100644
--- a/src/nvim/optionstr.c
+++ b/src/nvim/optionstr.c
@@ -306,26 +306,26 @@ int check_signcolumn(win_T *wp)
wp->w_minscwidth = 0;
wp->w_maxscwidth = 1;
}
- return OK;
- }
-
- if (strncmp(val, "auto:", 5) != 0
- || strlen(val) != 8
- || !ascii_isdigit(val[5])
- || val[6] != '-'
- || !ascii_isdigit(val[7])) {
- return FAIL;
- }
-
- // auto:<NUM>-<NUM>
- int min = val[5] - '0';
- int max = val[7] - '0';
- if (min < 1 || max < 2 || min > 8 || min >= max) {
- return FAIL;
+ } else {
+ if (strncmp(val, "auto:", 5) != 0
+ || strlen(val) != 8
+ || !ascii_isdigit(val[5])
+ || val[6] != '-'
+ || !ascii_isdigit(val[7])) {
+ return FAIL;
+ }
+ // auto:<NUM>-<NUM>
+ int min = val[5] - '0';
+ int max = val[7] - '0';
+ if (min < 1 || max < 2 || min > 8 || min >= max) {
+ return FAIL;
+ }
+ wp->w_minscwidth = min;
+ wp->w_maxscwidth = max;
}
- wp->w_minscwidth = min;
- wp->w_maxscwidth = max;
+ int scwidth = wp->w_minscwidth <= 0 ? 0 : MIN(wp->w_maxscwidth, wp->w_scwidth);
+ wp->w_scwidth = MAX(wp->w_minscwidth, scwidth);
return OK;
}
@@ -2038,8 +2038,6 @@ const char *did_set_signcolumn(optset_T *args)
if (check_signcolumn(win) != OK) {
return e_invarg;
}
- int scwidth = win->w_minscwidth <= 0 ? 0 : MIN(win->w_maxscwidth, win->w_scwidth);
- win->w_scwidth = MAX(win->w_minscwidth, scwidth);
// When changing the 'signcolumn' to or from 'number', recompute the
// width of the number column if 'number' or 'relativenumber' is set.
if ((*oldval == 'n' && *(oldval + 1) == 'u') || win->w_minscwidth == SCL_NUM) {