aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/statusline.c
diff options
context:
space:
mode:
authorLuuk van Baal <luukvbaal@gmail.com>2024-01-01 14:24:48 +0100
committerLewis Russell <me@lewisr.dev>2024-01-04 11:52:37 +0000
commitfa61e0c047954e7eb494ee02144a4dc71a42b3b2 (patch)
tree7fe807a23591eec0ea2286cc3e0845c7f620538e /src/nvim/statusline.c
parent444f37fe510f4c28c59bade40d7ba152a5ee8f7c (diff)
downloadrneovim-fa61e0c047954e7eb494ee02144a4dc71a42b3b2.tar.gz
rneovim-fa61e0c047954e7eb494ee02144a4dc71a42b3b2.tar.bz2
rneovim-fa61e0c047954e7eb494ee02144a4dc71a42b3b2.zip
refactor(column): define and use maximum 'statuscolumn' width
Problem: The maximum 'statuscolumn' width and grow behavior is undocumented. Solution: Define, use and document the maximum 'statuscolumn' width and grow behavior.
Diffstat (limited to 'src/nvim/statusline.c')
-rw-r--r--src/nvim/statusline.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/nvim/statusline.c b/src/nvim/statusline.c
index 3575b6fba3..1f00b406ec 100644
--- a/src/nvim/statusline.c
+++ b/src/nvim/statusline.c
@@ -1964,11 +1964,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, OptIndex op
// What follows is post-processing to handle alignment and highlighting.
int width = vim_strsize(out);
- // Return truncated width for 'statuscolumn'
- if (stcp != NULL && width > stcp->width) {
- stcp->truncate = width - stcp->width;
- }
- if (maxwidth > 0 && width > maxwidth) {
+ if (maxwidth > 0 && width > maxwidth && (!stcp || width > MAX_STCWIDTH)) {
// Result is too long, must truncate somewhere.
int item_idx = 0;
char *trunc_p;