Re: (t)timeout

2006-08-29 Thread Bram Moolenaar

Yakov Lerner wrote:

  When the CursorHold autocommand triggers it puts a keycode in the input
  buffer.  A half-typed command will be ended by this, possibly by with an
  error (beep/flash).
 
 I don't understand your explanation, Bram. If your explanation were
 valid, then *any* 'au CursorHold' would cancel multi-key commands like gg.
 
 But this is not the case. Simple assignmet 'let foo=xyz' in 'au CursorHold'
 does not cause multi-key-commands-cancelation.

Yes it does.  Try :au Cursorhold * let foo = 'xyz' and then typing one
g.  It's cancelled with a beep as soon as the Cursorhold event is
triggered.  But only when you didn't type anything since the last time.
When you set 'updatetime' to 200 and wait more than 0.2 seconds after
moving the cursor before typing the g then the event will already been
triggered and you keep the g.

-- 
hundred-and-one symptoms of being an internet addict:
263. You have more e-mail addresses than shorts.

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


Re: (t)timeout

2006-08-25 Thread A.J.Mechelynck

Max Dyckhoff wrote:

Recently something rather annoying has started happening; key codes have
started occasionally timing, despite my express desire for them to never
time out. notimeout and nottimeout are both set.

If I move to a place in the file and type ^W quickly and then pause
before typing ], then it will timeout after around a second. If I move
to a place in the file and then wait for a small period of time, the ^W
will no longer time out.

It looks like something related to the CursorHold time is happening, but
I can't for the life of me work out what it is. Any ideas?

Cheers!

Max





As your subject hints, try

:verbose set timeout? ttimeout? timeoutlen? ttimeoutlen?

then read the help about these 4 options.

In a nutshell, to have Vim time out after 0.25 second for multibyte 
keycodes (generated by the keyboard driver) and after only 5 seconds 
when you're typing the {lhs} of a mapping, use


:set timeout ttimeoutlen=250 timeoutlen=5000

To time out after 0.1 second for keycodes and never for mappings, use

:set notimeout ttimeout ttimeoutlen=100

etc. The default is one second for both.


Best regards,
Tony.


RE: (t)timeout

2006-08-25 Thread Max Dyckhoff
I'm sorry, perhaps I wasn't being clear enough. I don't want a timeout
to ever occur for a mapping. timeout and ttimeout are both set to no
(or whatever the correct syntax for describing such options is).

Here are two use cases. Again, I apologise for the clumsy syntax.

1)
* Move cursor
* Type ^w
* Wait updatetime from cursor movement
* Observe mapping timeout

2)
* Move cursor
* Wait updatetime
* Type ^w
* Observe no mapping timeout

If I set updatetime=1 then the timeout never occurs, because the second
use case is followed, but I want updatetime to be around 1000. :verbose
au CursorHold shows that the only CursorHold au is one set from
ctags.vim:

autocmd CursorHold *
\   if generate_tags != 0
\ | call s:SetTagDisplay()
\ | endif

Is this au timing out my mapping? Can I make it stop doing so without
removing the au or altering the updatetime?

Thanks!

Max



 -Original Message-
 From: A.J.Mechelynck [mailto:[EMAIL PROTECTED]
 Sent: Friday, August 25, 2006 12:36 PM
 To: Max Dyckhoff
 Cc: vim mailing list
 Subject: Re: (t)timeout
 
 Max Dyckhoff wrote:
  Recently something rather annoying has started happening; key codes
have
  started occasionally timing, despite my express desire for them to
never
  time out. notimeout and nottimeout are both set.
 
  If I move to a place in the file and type ^W quickly and then pause
  before typing ], then it will timeout after around a second. If I
move
  to a place in the file and then wait for a small period of time, the
^W
  will no longer time out.
 
  It looks like something related to the CursorHold time is happening,
but
  I can't for the life of me work out what it is. Any ideas?
 
  Cheers!
 
  Max
 
 
 
 
 As your subject hints, try
 
   :verbose set timeout? ttimeout? timeoutlen? ttimeoutlen?
 
 then read the help about these 4 options.
 
 In a nutshell, to have Vim time out after 0.25 second for multibyte
 keycodes (generated by the keyboard driver) and after only 5 seconds
 when you're typing the {lhs} of a mapping, use
 
   :set timeout ttimeoutlen=250 timeoutlen=5000
 
 To time out after 0.1 second for keycodes and never for mappings, use
 
   :set notimeout ttimeout ttimeoutlen=100
 
 etc. The default is one second for both.
 
 
 Best regards,
 Tony.


Re: (t)timeout

2006-08-25 Thread A.J.Mechelynck

Max Dyckhoff wrote:

I'm sorry, perhaps I wasn't being clear enough. I don't want a timeout
to ever occur for a mapping. timeout and ttimeout are both set to no
(or whatever the correct syntax for describing such options is).

Here are two use cases. Again, I apologise for the clumsy syntax.

1)
* Move cursor
* Type ^w
* Wait updatetime from cursor movement
* Observe mapping timeout

2)
* Move cursor
* Wait updatetime
* Type ^w
* Observe no mapping timeout

If I set updatetime=1 then the timeout never occurs, because the second
use case is followed, but I want updatetime to be around 1000. :verbose
au CursorHold shows that the only CursorHold au is one set from
ctags.vim:

autocmd CursorHold *
\   if generate_tags != 0
\ | call s:SetTagDisplay()
\ | endif

Is this au timing out my mapping? Can I make it stop doing so without
removing the au or altering the updatetime?

Thanks!

Max


Aha! Could be. What is generate_tags set to?

In any case, we might try to work around it; maybe the following would 
work (but you would have to hit the Enter key after the ^W subcommand):


:mapC-W :wincmdSpace



Best regards,
Tony.


RE: (t)timeout

2006-08-25 Thread Max Dyckhoff
generate_tags is set to 1, although I'm not entirely sure why that
function call is guarded by that check, given that SetTagDisplay doesn't
do any tag generation! If I remove that au, the timeout does in fact
stop happening. If I set generate_tags to 0, the timeout still happens.

If I remove the ctags au for CursorHold and just add the au :let
foo=1, then the timeout still happens. Basically when the updatetime
happens, it will time out any pending keystrokes. I am sure there is a
reason for this, but it is annoying as anything :)

That mapping for C-W you suggested (while genius) isn't really a valid
solution, and anyway the timeout happens for all multi-character
mappings like q, g, etc.

Thanks!

Max

 -Original Message-
 From: A.J.Mechelynck [mailto:[EMAIL PROTECTED]
 Sent: Friday, August 25, 2006 1:25 PM
 To: Max Dyckhoff
 Cc: vim mailing list
 Subject: Re: (t)timeout
 
 Max Dyckhoff wrote:
  I'm sorry, perhaps I wasn't being clear enough. I don't want a
timeout
  to ever occur for a mapping. timeout and ttimeout are both set to
no
  (or whatever the correct syntax for describing such options is).
 
  Here are two use cases. Again, I apologise for the clumsy syntax.
 
  1)
  * Move cursor
  * Type ^w
  * Wait updatetime from cursor movement
  * Observe mapping timeout
 
  2)
  * Move cursor
  * Wait updatetime
  * Type ^w
  * Observe no mapping timeout
 
  If I set updatetime=1 then the timeout never occurs, because the
second
  use case is followed, but I want updatetime to be around 1000.
:verbose
  au CursorHold shows that the only CursorHold au is one set from
  ctags.vim:
 
  autocmd CursorHold *
  \   if generate_tags != 0
  \ | call s:SetTagDisplay()
  \ | endif
 
  Is this au timing out my mapping? Can I make it stop doing so
without
  removing the au or altering the updatetime?
 
  Thanks!
 
  Max
 
 Aha! Could be. What is generate_tags set to?
 
 In any case, we might try to work around it; maybe the following would
 work (but you would have to hit the Enter key after the ^W
subcommand):
 
   :mapC-W   :wincmdSpace
 
 
 
 Best regards,
 Tony.


Re: (t)timeout

2006-08-25 Thread Gary Johnson
On 2006-08-25, Max Dyckhoff [EMAIL PROTECTED] wrote:

  From: A.J.Mechelynck [mailto:[EMAIL PROTECTED]
  Sent: Friday, August 25, 2006 12:36 PM

  Max Dyckhoff wrote:
   Recently something rather annoying has started happening; key
   codes have started occasionally timing, despite my express
   desire for them to never time out. notimeout and nottimeout
   are both set.
  
   If I move to a place in the file and type ^W quickly and then
   pause before typing ], then it will timeout after around a
   second. If I move to a place in the file and then wait for a
   small period of time, the ^W will no longer time out.
  
   It looks like something related to the CursorHold time is
   happening, but I can't for the life of me work out what it is.
   Any ideas?

  As your subject hints, try
  
  :verbose set timeout? ttimeout? timeoutlen? ttimeoutlen?
  
  then read the help about these 4 options.
  
  In a nutshell, to have Vim time out after 0.25 second for multibyte
  keycodes (generated by the keyboard driver) and after only 5 seconds
  when you're typing the {lhs} of a mapping, use
  
  :set timeout ttimeoutlen=250 timeoutlen=5000
  
  To time out after 0.1 second for keycodes and never for mappings, use
  
  :set notimeout ttimeout ttimeoutlen=100
  
  etc. The default is one second for both.

 I'm sorry, perhaps I wasn't being clear enough. I don't want a timeout
 to ever occur for a mapping. timeout and ttimeout are both set to no
 (or whatever the correct syntax for describing such options is).
 
 Here are two use cases. Again, I apologise for the clumsy syntax.
 
 1)
 * Move cursor
 * Type ^w
 * Wait updatetime from cursor movement
 * Observe mapping timeout
 
 2)
 * Move cursor
 * Wait updatetime
 * Type ^w
 * Observe no mapping timeout
 
 If I set updatetime=1 then the timeout never occurs, because the second
 use case is followed, but I want updatetime to be around 1000. :verbose
 au CursorHold shows that the only CursorHold au is one set from
 ctags.vim:
 
 autocmd CursorHold *
 \   if generate_tags != 0
 \ | call s:SetTagDisplay()
 \ | endif
 
 Is this au timing out my mapping? Can I make it stop doing so without
 removing the au or altering the updatetime?

I can verify this behavior and that removing the CursorHold
autocommand fixes the problem.  It may be a bug in Vim.  I
reported a similar problem with the 7.0b or 7.0c release that did
turn out to be a bug in the event handler.

It's not just mappings that are affected.  With the following
settings:

showcmd
notimeout
nottimeout
updatetime=500

and the ctags.vim CursorHold autocommand enabled, if I type a
cursor-movement command (such as 'j') immediately followed by a
double-quote to start a register name, the double-quote briefly
appears in the 'showcmd' area, then disappears with a beep.  If I
increase 'updatetime' to 5000 and repeat the experiment, the
double-quote stays for about 5 seconds before disappearing.

It looks to me like an undesirable interaction between processing of
the CursorHold autocommand and processing of commands from the
keyboard.  Bram?

I should mention that I'm using the 7.0 release, unpatched.  I'm
working on bringing it up to the current patch level, but I'm not
done with that yet.

Regards,
Gary

-- 
Gary Johnson | Agilent Technologies
[EMAIL PROTECTED] | Wireless Division
 | Spokane, Washington, USA


Re: (t)timeout

2006-08-25 Thread Bram Moolenaar

Gary Johnson wrote:

 On 2006-08-25, Max Dyckhoff [EMAIL PROTECTED] wrote:
 
   From: A.J.Mechelynck [mailto:[EMAIL PROTECTED]
   Sent: Friday, August 25, 2006 12:36 PM
 
   Max Dyckhoff wrote:
Recently something rather annoying has started happening; key
codes have started occasionally timing, despite my express
desire for them to never time out. notimeout and nottimeout
are both set.
   
If I move to a place in the file and type ^W quickly and then
pause before typing ], then it will timeout after around a
second. If I move to a place in the file and then wait for a
small period of time, the ^W will no longer time out.
   
It looks like something related to the CursorHold time is
happening, but I can't for the life of me work out what it is.
Any ideas?
 
   As your subject hints, try
   
 :verbose set timeout? ttimeout? timeoutlen? ttimeoutlen?
   
   then read the help about these 4 options.
   
   In a nutshell, to have Vim time out after 0.25 second for multibyte
   keycodes (generated by the keyboard driver) and after only 5 seconds
   when you're typing the {lhs} of a mapping, use
   
 :set timeout ttimeoutlen=250 timeoutlen=5000
   
   To time out after 0.1 second for keycodes and never for mappings, use
   
 :set notimeout ttimeout ttimeoutlen=100
   
   etc. The default is one second for both.
 
  I'm sorry, perhaps I wasn't being clear enough. I don't want a timeout
  to ever occur for a mapping. timeout and ttimeout are both set to no
  (or whatever the correct syntax for describing such options is).
  
  Here are two use cases. Again, I apologise for the clumsy syntax.
  
  1)
  * Move cursor
  * Type ^w
  * Wait updatetime from cursor movement
  * Observe mapping timeout
  
  2)
  * Move cursor
  * Wait updatetime
  * Type ^w
  * Observe no mapping timeout
  
  If I set updatetime=1 then the timeout never occurs, because the second
  use case is followed, but I want updatetime to be around 1000. :verbose
  au CursorHold shows that the only CursorHold au is one set from
  ctags.vim:
  
  autocmd CursorHold *
  \   if generate_tags != 0
  \ | call s:SetTagDisplay()
  \ | endif
  
  Is this au timing out my mapping? Can I make it stop doing so without
  removing the au or altering the updatetime?
 
 I can verify this behavior and that removing the CursorHold
 autocommand fixes the problem.  It may be a bug in Vim.  I
 reported a similar problem with the 7.0b or 7.0c release that did
 turn out to be a bug in the event handler.
 
 It's not just mappings that are affected.  With the following
 settings:
 
 showcmd
 notimeout
 nottimeout
 updatetime=500
 
 and the ctags.vim CursorHold autocommand enabled, if I type a
 cursor-movement command (such as 'j') immediately followed by a
 double-quote to start a register name, the double-quote briefly
 appears in the 'showcmd' area, then disappears with a beep.  If I
 increase 'updatetime' to 5000 and repeat the experiment, the
 double-quote stays for about 5 seconds before disappearing.
 
 It looks to me like an undesirable interaction between processing of
 the CursorHold autocommand and processing of commands from the
 keyboard.  Bram?
 
 I should mention that I'm using the 7.0 release, unpatched.  I'm
 working on bringing it up to the current patch level, but I'm not
 done with that yet.

When the CursorHold autocommand triggers it puts a keycode in the input
buffer.  A half-typed command will be ended by this, possibly by with an
error (beep/flash).

Keeping the previously typed key will be very difficult.  A workaround
is to have all two-character commands check for the CursorHold key and
handle it there.  I'll look into this.  I'm not sure this can be done,
it may have other side effects (e.g., not redrawing).

-- 
hundred-and-one symptoms of being an internet addict:
235. You start naming your kids Pascal, COBOL, Algol and Fortran.

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