On Tue, Sep 05, 2006 at 03:38:52PM +0200, Bram Moolenaar wrote:
> 
> Benji Fisher wrote:
> 
> > $ vim
> > :echo confirm("Save changes?", "&Yes\n&No\n&Cancel", 0)
> > <user types <CR>>
> > 0
> > :gui
> > :echo confirm("Save changes?", "&Yes\n&No\n&Cancel", 0)
> > <user types <CR>>
> > 1
> > 
> > I did it that way to make sure that I was actually using the same binary
> > with and without the GUI running.  The second time I invoked confirm(),
> > a dialogue box popped up with the "Yes" button highlighted.
> 
> Many GUIs don't support a dialog without a button selected.  Disabling
> the use of Enter to select a button isn't a good idea either.  Thus for
> some GUIs it simply won't work to have a dialog without a default.

     I do not like the way it works now, since the GUI is not consistent
with the terminal version.  Would it be possible to add a "Cancel"
button to the GUI dialogue box, and select this button if confirm() is
called with argument 0 as above?  I am not sure how terminal vim
*should* respond to other out-of-range arguments (e.g., 4 instead of 0
in the above example).

     I notice that the GUI confirm() returns 0 if I cancel the dialogue
box with <Esc>.  Ditto for terminal vim, but then I have to type <Esc>
twice, which is odd.  (Yes, I did wait more than 'timeoutlen' ms.)

HTH                                     --Benji Fisher

Reply via email to