Hello:
Here's my patch for neater folding displays, updated to apply cleanly
for vim 7.4.1979.
Regards,
Chip Campbell
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
*** eval.c.orig 2016-07-01 17:46:29.997747660 -0400
--- eval.c 2016-07-01 17:47:11.949546588 -0400
***************
*** 12222,12227 ****
--- 12222,12231 ----
char_u *r;
int len;
char *txt;
+ char fmt[40];
+ int nuw;
+ int padding;
+ unsigned rlen;
#endif
rettv->v_type = VAR_STRING;
***************
*** 12255,12270 ****
s = skipwhite(s + 1);
}
}
! txt = _("+-%s%3ld lines: ");
! r = alloc((unsigned)(STRLEN(txt)
! + STRLEN(vimvars[VV_FOLDDASHES].vv_str) /* for %s */
! + 20 /* for %3ld */
! + STRLEN(s))); /* concatenated */
if (r != NULL)
{
sprintf((char *)r, txt, vimvars[VV_FOLDDASHES].vv_str,
(long)((linenr_T)vimvars[VV_FOLDEND].vv_nr
! - (linenr_T)vimvars[VV_FOLDSTART].vv_nr + 1));
len = (int)STRLEN(r);
STRCAT(r, s);
/* remove 'foldmarker' and 'commentstring' */
--- 12259,12280 ----
s = skipwhite(s + 1);
}
}
! /* next two lines construct a format to be used for the folded region.
! * Example: assume nuw=5, then fmt becomes "+-%-5s%5ld lines: %*s"
! */
! nuw = number_width(curwin); /* obtain log10(lastline) */
! padding= STRLEN(vimvars[VV_FOLDDASHES].vv_str);
! sprintf(fmt,"+-%%-%ds%%%dld lines:%%*s",(padding > nuw)? padding :
nuw,nuw);
! txt = _(fmt); /* internationalize */
! rlen= (STRLEN(txt) - 11) + 2*nuw + ((padding > nuw)? padding : nuw) +
STRLEN(s) + 10;
! r = alloc(rlen);
if (r != NULL)
{
+ if(padding > nuw) padding= nuw;
sprintf((char *)r, txt, vimvars[VV_FOLDDASHES].vv_str,
(long)((linenr_T)vimvars[VV_FOLDEND].vv_nr
! - (linenr_T)vimvars[VV_FOLDSTART].vv_nr + 1),
! padding," ");
len = (int)STRLEN(r);
STRCAT(r, s);
/* remove 'foldmarker' and 'commentstring' */