If the text is given from script by routine, user don't know that CR/LF 
effect this problem.
In unix format text file, you often see ^M in a file. In the case that the 
line include ^M like following,

---------------
1+1=
1+2=^M
1+3=
---------------

If you type following in line:2.

:let answer = input("Answer?: ", getline("."))

Most people expect showing prompt. But answer is not 1+2=3 or else.
Answer will be "1+2=".

You may think that "THIS IS NOT A BUG". But there is difference between 
input() and inputdialog()
inputdialog() show a gui dialog. then it don't appear this problem.
I guess that this should be fixed.
Of course, I don't beleave my patch is BEST. For example, one of solution 
that replace ^M to ^V^M for typeahead.

Thanks.
- Yasuhiro Matsumoto

On Thursday, April 28, 2011 7:53:52 PM UTC+9, Bram Moolenaar wrote:
>
>
> Yasuhiro Matsumoto wrote:
>
> > Hi, all.
> > 
> > input() / inputsecret() accept CR/LF character.
> > 
> > --------------
> > let cr = "I am\nYasuhiro\nMatsumoto"
> > echo inputdialog("Who are you?:", cr)
> > --------------
> > 
> > This script close input area automaticaly.
> > about initstr for input(), we should remove CR/LF characters.
>
> Well, the help for input() says that the text is used as if the user
> typed this.
>
> I wonder why you have any CR or LF in your text, what is the problem you
> are solving?
>
>
> -- 
> This planet has -- or rather had -- a problem, which was this: most
> of the people living on it were unhappy for pretty much of the time.
> Many solutions were suggested for this problem, but most of these
> were largely concerned with the movements of small green pieces of
> paper, which is odd because on the whole it wasn't the small green
> pieces of paper that were unhappy.
> -- 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/\\\
> \\\  an exciting new programming language -- http://www.Zimbu.org       
>  ///
>  \\\            help me help AIDS victims -- http://ICCF-Holland.org   
>  ///
>
>

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

Raspunde prin e-mail lui