aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/screen.c
diff options
context:
space:
mode:
authorerw7 <erw7.github@gmail.com>2020-07-14 05:15:04 +0900
committerShougo Matsushita <Shougo.Matsu@gmail.com>2020-07-23 10:29:36 +0900
commitbfe94d0a0814eab5e9f9b6c6b06e770ba904da9f (patch)
treeb4cfe764073ba6bffe541f55d89376d1c47c38cb /src/nvim/screen.c
parentd3eddcf630f29da72409934eb14fb7a534f6497e (diff)
downloadrneovim-bfe94d0a0814eab5e9f9b6c6b06e770ba904da9f.tar.gz
rneovim-bfe94d0a0814eab5e9f9b6c6b06e770ba904da9f.tar.bz2
rneovim-bfe94d0a0814eab5e9f9b6c6b06e770ba904da9f.zip
vim-patch:8.1.1623: display wrong with signs in narrow number column
Problem: Display wrong with signs in narrow number column. Solution: Increase the numbercolumn width if needed. (Yegappan Lakshmanan, closes vim/vim#4606) https://github.com/vim/vim/commit/e4b407f536ba8bd007152649a347a95320d80fce
Diffstat (limited to 'src/nvim/screen.c')
-rw-r--r--src/nvim/screen.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index e9df68f657..92a34dfc42 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -7400,9 +7400,17 @@ int number_width(win_T *wp)
++n;
} while (lnum > 0);
- /* 'numberwidth' gives the minimal width plus one */
- if (n < wp->w_p_nuw - 1)
+ // 'numberwidth' gives the minimal width plus one
+ if (n < wp->w_p_nuw - 1) {
n = wp->w_p_nuw - 1;
+ }
+
+ // If 'signcolumn' is set to 'number' and there is a sign to display, then
+ // the minimal width for the number column is 2.
+ if (n < 2 && (wp->w_buffer->b_signlist != NULL)
+ && (*wp->w_p_scl == 'n' && *(wp->w_p_scl + 1) == 'u')) {
+ n = 2;
+ }
wp->w_nrwidth_width = n;
return n;