Charles E Campbell wrote:
Bram Moolenaar wrote:
Charles Campbell wrote:
I find reading the folded lines to be less than ideal, as the extra
spacing required of the "+---"s varies and so lines: doesn't line up.
This patch makes all the +---... prefixes take up 5 spaces (using %-5s,
so it uses padding). By itself, this makes the folded sections, no
matter how deep, also line up; the patch now pads the beginning of the
folding titles with spaces indicating folding depth (and retaining the
+---- marking).
I find the result to be more quickly legible.
It does look nicer. The 5 spaces is an arbitrary number, perhaps that
should be an option? Or perhaps we can use 'numberwidth'?
I see that numberwidth defaults to 4 and its a minimum width. Perhaps
I should use numberwidth and similarly use the qty of lines in the
buffer (ie. use the number_width() fun ction). I think that re-use
of numberwidth would be ok. I'll submit another patch soon (I've
written it, but I'm still testing it).
Updated patch. The "optionsptch" patch will insert one line into the
options.txt help; I separated it out in case its not wanted.
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.
*** keep_eval.c 2014-09-10 10:50:35.997331712 -0400
--- eval.c 2014-09-12 10:45:41.405368593 -0400
***************
*** 11030,11035 ****
--- 11030,11038 ----
char_u *r;
int len;
char *txt;
+ char fmt[30];
+ int nuw;
+ unsigned rlen;
#endif
rettv->v_type = VAR_STRING;
***************
*** 11063,11078 ****
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' */
--- 11066,11088 ----
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) */
! sprintf(fmt,"+-%%-%ds%%%dld lines:%%*s",nuw,nuw);
! txt = _(fmt); /* internationalize */
! rlen= (STRLEN(txt) - 10) + 3*nuw + STRLEN(s);
! r = alloc(rlen);
if (r != NULL)
{
+ int padding;
+ padding= STRLEN(vimvars[VV_FOLDDASHES].vv_str);
+ 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' */
5246a5247
> This option also affects the display of folds.