Bjorn Winckler wrote:

> 2009/2/5 Bram Moolenaar:
> >
> > If I do  ":!cat"  then typing CTRL-C does appear to work.  Perhaps it's
> > the flood of output to the screen that stops the CTRL-C check?  No time
> > to investigate further right now.
> 
> Yes, this seems to be the problem.  The difference between ":!cat" and
> ":grep a *.c" is that the former produces no output whereas the latter
> does and consequently Vim gets stuck in the loop on line 4368
> (os_unix.c) starting with
> 
>   while (RealWaitForChar(fromshell_fd, 10L, NULL))
> 
> This loop is where I added the break check since there are no other
> checks for ctrl-c here.  Only when this loop exits is ui_inchar()
> called and in the case of ":grep a *.c" this loop is iterated _many_
> times (up to 60000) before breaking out to call ui_inchar() again.
> 
> Dominique: It is strange that my patch does not fix the problem for
> you...maybe fast_breakcheck() doesn't call gui_mch_update() often
> enough on your system (although that seems unlikely judging from the
> amount of times this loop iterates as I mentioned above)?  It does
> take care of the problem on my machine (Mac OS X 10.5.6, Vim 7.2
> patches 1-102, with MacVim GUI).
> 
> Anyway, I don't know what the proper way to fix this problem is then
> seeing as it's not working for Dominique.  But somehow we have to
> ensure that this problematic loop doesn't get stuck for "too long"
> (whatever metric we may use to measure that) or that we check for
> ctrl-c explicitly during the loop (which was what my patch was
> supposed to do).  Any ideas?

I think we need to break out of the loop now and then to check for a
CTRL-C.  Question is: when?  There is some code in place to avoid
calling ui_inchar(), because it eats typeahead.

Perhaps the "noread_cnt" variable can be extended with something that
keeps track of how long ago ui_inchar() was called.  It should probably
be called every half a second to be responsive to CTRL-C.

-- 
hundred-and-one symptoms of being an internet addict:
58. You turn on your computer and turn off your wife.

 /// 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