Hi Bram, and Vim developers.

Related with this patch, 
https://groups.google.com/d/msg/vim_dev/VUQPZjdIeW4/YlgaTVGs4pEJ

I guess the document of getchar() should have reference to <CursorHold> and
warning because the user cannot understand what's happening with getchar()
catches <CursorHold> in expression mappings and getchar() prompt unexpectedly 
quit without typing any characters.

I attached a patch reviewd by mattn and h_east.

Best regards

--
Toshiki Shima

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git runtime/doc/eval.txt runtime/doc/eval.txt
index 4e349a6..f287c49 100644
--- runtime/doc/eval.txt
+++ runtime/doc/eval.txt
@@ -3305,6 +3305,16 @@ getchar([expr])						*getchar()*
 			:  endwhile
 			:endfunction
 
+<		WARNING: When calling getchar() in a mapping with <expr>, you
+		need to handle |<CursorHold>|. Example: >
+			:function! s:getchar()
+			:  let c = getchar()
+			:  while c == "\<CursorHold>"
+			:    let c = getchar()
+			:  endwhile
+			:  return c
+			:endfunction
+
 getcharmod()						*getcharmod()*
 		The result is a Number which is the state of the modifiers for
 		the last obtained character with getchar() or in another way.

Raspunde prin e-mail lui