Ingo Karkat wrote:

> I'd like to report a bug that occurs when a very long ex command is
> entered, so that the GUI / console screen space isn't sufficient to
> display the complete command.
> 
> I have an external VBScript that uses the VIM OLE SendKeys() function
> (or WshShell.SendKeys() as a fallback) to open a list of files in VIM
> via:
>      :drop file1 file2 C:/Program\ 
> Files/this_is_a_very_very_very_long_filename
> If the list of files is longer than the available space for the ex
> command, the characters that didn't fit in are appended in reversed
> order:
>      :args
>      [file1] file2 C:/Program\ Fiemanelif_gnol_yrev_yrev_yrev_a_si_siht/sel
>                                  ^ BUG: reversed string!!!                ^
> 
> This happens:
> - both in GVIM and console VIM
> - on Windows and Linux
> - through OLE SendKeys(), VIM's feedkeys(<string>,'t'), or by manually
> typing the string
> - in VIM 7.1.311 until back to VIM 6.0
> Probably, this is due to some bad pointer increment, which is
> hopefully easy to fix.
> 
> Steps to reproduce:
> -------------------
> vim -N -u NONE
> " Limit window size to minimize typing until overflow :-)
> :set columns=20 lines=4
> :drop 1234567890 1234567890 1234567890 1234567890 1234567890
> 1234567890 1234567890 1234567890
> " Enlarge again to better see the output (optional).
> :set columns=80
> :args
> [1234567890] 1234567890 1234567890 1234567890 1234567890 1234567890 
> 12345670987654321 098
> " Note the garbled strings at the end!
> 
> You can also reproduce without resizing via feedkeys():
> gvim -N -u NONE
> call feedkeys(':drop ', 't') | for i in range(1,500) | call 
> feedkeys('1234567890 
> ', 't') | endfor | call feedkeys("\<CR>", 't')
> :args

I see the problem.  I think the patch below fixes it properly.


*** ../vim-7.1.314/src/ex_getln.c       Thu May 29 15:33:13 2008
--- src/ex_getln.c      Mon Jun  9 20:10:51 2008
***************
*** 2829,2838 ****
                if (has_mbyte)
                    correct_cmdspos(ccline.cmdpos, c);
  #endif
!               /* Stop cursor at the end of the screen */
!               if (ccline.cmdspos + c >= m)
!                   break;
!               ccline.cmdspos += c;
  #ifdef FEAT_MBYTE
                if (has_mbyte)
                {
--- 2829,2839 ----
                if (has_mbyte)
                    correct_cmdspos(ccline.cmdpos, c);
  #endif
!               /* Stop cursor at the end of the screen, but do increment the
!                * insert position, so that entering a very long command
!                * works, even though you can't see it. */
!               if (ccline.cmdspos + c < m)
!                   ccline.cmdspos += c;
  #ifdef FEAT_MBYTE
                if (has_mbyte)
                {

-- 
Bypasses are devices that allow some people to dash from point A to
point B very fast while other people dash from point B to point A very
fast.  People living at point C, being a point directly in between, are
often given to wonder what's so great about point A that so many people
from point B are so keen to get there and what's so great about point B
that so many people from point A are so keen to get there.  They often
wish that people would just once and for all work out where the hell
they wanted to be.
                -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui