Bram Moolenaar wrote:
Charles Campbell wrote:
Updated patch.  The "optionsptch" patch will insert one line into the
options.txt help; I separated it out in case its not wanted.
Thanks, I'll put it in the todo list.  I'll await comments for a little
while.

Hello!

I've attached an improved patch which adjusts the allocated size of the fold text to handle the fold's +---.... string, even if there's an awful lot of folds.

Chip

--
--
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 vim_dev+unsubscr...@googlegroups.com.
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 14:28:55.766340893 -0400
***************
*** 11030,11035 ****
--- 11030,11039 ----
      char_u    *r;
      int               len;
      char      *txt;
+     char        fmt[30];
+     int         nuw;
+     int         padding;
+     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' */
--- 11067,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) */
!       padding= STRLEN(vimvars[VV_FOLDDASHES].vv_str);
!       sprintf(fmt,"+-%%-%ds%%%dld lines:%%*s",(padding > nuw)? padding : 
nuw,nuw);
!       txt = _(fmt);                   /* internationalize       */
!       rlen= (STRLEN(txt) - 10) + 2*nuw + ((padding > nuw)? padding : nuw) + 
STRLEN(s);
!       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' */

Raspunde prin e-mail lui