aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/drawline.c
diff options
context:
space:
mode:
authorLuuk van Baal <luukvbaal@gmail.com>2024-06-15 05:46:43 +0200
committerLuuk van Baal <luukvbaal@gmail.com>2024-06-16 19:04:34 +0200
commitad70c9892d5b5ebcc106742386c99524f074bcea (patch)
tree13ef468ac927d78a1f35fbdf01ffc6a2e2ba914f /src/nvim/drawline.c
parent114197517f89de557333dbc6022912b2f8b4eaf5 (diff)
downloadrneovim-ad70c9892d5b5ebcc106742386c99524f074bcea.tar.gz
rneovim-ad70c9892d5b5ebcc106742386c99524f074bcea.tar.bz2
rneovim-ad70c9892d5b5ebcc106742386c99524f074bcea.zip
feat(column)!: rework 'statuscolumn' %r/l items
Problem: A custom 'statuscolumn' needs to check a bunch of options and placed signs to replicate the default number column. Solution: Rework %l item to include the necessary logic to mimic the default number column. Remove now redundant %r item.
Diffstat (limited to 'src/nvim/drawline.c')
-rw-r--r--src/nvim/drawline.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c
index 4247705896..6109652f7d 100644
--- a/src/nvim/drawline.c
+++ b/src/nvim/drawline.c
@@ -587,12 +587,13 @@ static void draw_statuscol(win_T *wp, winlinevars_T *wlv, linenr_T lnum, int vir
char buf[MAXPATHL];
// When a buffer's line count has changed, make a best estimate for the full
- // width of the status column by building with "w_nrwidth_line_count". Add
- // potentially truncated width and rebuild before drawing anything.
+ // width of the status column by building with the largest possible line number.
+ // Add potentially truncated width and rebuild before drawing anything.
if (wp->w_statuscol_line_count != wp->w_nrwidth_line_count) {
wp->w_statuscol_line_count = wp->w_nrwidth_line_count;
set_vim_var_nr(VV_VIRTNUM, 0);
- int width = build_statuscol_str(wp, wp->w_nrwidth_line_count, 0, buf, stcp);
+ int width = build_statuscol_str(wp, wp->w_nrwidth_line_count,
+ wp->w_nrwidth_line_count, buf, stcp);
if (width > stcp->width) {
int addwidth = MIN(width - stcp->width, MAX_STCWIDTH - stcp->width);
wp->w_nrwidth += addwidth;