On 26-Mar-2007 18:25, Bram Moolenaar wrote:
Michael Schaap wrote:

Here's a patch to make virtcol([123, '$']) do the right thing.
If it looks good to you, can you include it?

Looks good, I'll include it.  Thanks!

Thanks!

This lets me replace a function:

   " Maximum line length
   function! MaxLineLength0()
       let currline = line(".")
       let lastline = line("$")
       let lengths = [ ]
       let linenr = 1
       while linenr <= lastline
           exe ":".linenr
           let lengths += [ virtcol("$") ]
           let linenr += 1
       endwhile
       exe ":".currline
       return max(lengths)
   endfunction

with the slightly shorter:

   " Maximum line length
   function! MaxLineLength()
       return max(map(range(1,line('$')), "virtcol([v:val,'$'])"))
   endfunction

- Michael

Reply via email to