Re: bug in confirm() and default option
Hari Krishna Dara wrote: 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 know for sure Windows native UI supports dialogs without a default button, and Motif also should support this as well. I will in fact be surprised if GUIs always force the programmer to specify a default button, as there should be a choice not to have one (especially when there is a complex interface). On MS-Windows it works to avoid Enter selecting a default button, but Space still does. I doubt it is possible to disable this, it seems there always must be a button with the dashed line in it. In my case, I was trying to set no default button when I know there is some important information to read, but the user might routinely press Space or Enter to get rid off it. If the dialog doesn't get hidden, the user will more likely read it. Right now I resorted to doing an echohl with WarningMsg followed by an input(), but this introduces a drastic difference from the routine case where the user still sees a dialog. Using a zero default is supposed to do this, but there are implementation problems. Hopefully someone who knows the specific GUI library can find a solution. I don't work on these unusual GUI things, it takes too much of my time. -- MORTICIAN:What? CUSTOMER: Nothing -- here's your nine pence. DEAD PERSON: I'm not dead! MORTICIAN:Here -- he says he's not dead! CUSTOMER: Yes, he is. DEAD PERSON: I'm not! The Quest for the Holy Grail (Monty Python) /// 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: bug in confirm() and default option
Benji Fisher wrote: $ vim :echo confirm(Save changes?, Yes\nNo\nCancel, 0) user types CR 0 :gui :echo confirm(Save changes?, Yes\nNo\nCancel, 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). Adding a Cancel button completely goes against what the user specifies. If you want a default to cancel you can specify it. 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.) I see this too. -- Veni, Vidi, Video -- I came, I saw, I taped what I saw. /// 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: bug in confirm() and default option
On Tue, 5 Sep 2006 at 3:38pm, Bram Moolenaar wrote: Benji Fisher wrote: On Sun, Sep 03, 2006 at 11:54:11AM -0700, Hari Krishna Dara wrote: On Sun, 3 Sep 2006 at 8:21pm, Bram Moolenaar wrote: I have tried the win32 console version and it works properly there. Do you mean the GUI version? Please be specific, trying all kinds of things to find out what you mean is a waste of time. I reported that the console version works fine in a separate email, so yes, it is the GUI version. Sorry for not being clear. In the original post, Hari did say gvim. On Linux (FC2, GTK-2) I find that it works as expected in vim (with the GUI not running) but shows the same problem in gvim (with the GUI running). $ vim :echo confirm(Save changes?, Yes\nNo\nCancel, 0) user types CR 0 :gui :echo confirm(Save changes?, Yes\nNo\nCancel, 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 know for sure Windows native UI supports dialogs without a default button, and Motif also should support this as well. I will in fact be surprised if GUIs always force the programmer to specify a default button, as there should be a choice not to have one (especially when there is a complex interface). In my case, I was trying to set no default button when I know there is some important information to read, but the user might routinely press Space or Enter to get rid off it. If the dialog doesn't get hidden, the user will more likely read it. Right now I resorted to doing an echohl with WarningMsg followed by an input(), but this introduces a drastic difference from the routine case where the user still sees a dialog. -- Thanks, Hari __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: bug in confirm() and default option
Hari Krishna Dara wrote: According to the help, if you specify a value of 0 for default, none of the choices should be selected, but this is not how it is working. I tried both on win32 and cygwin (X) gvim and both default to 1 instead. Is there another trick to not select any of the choices? Please give information about the GUI you are using. There is at least a known problem with Motif. I don't know what other information you need, but the win32 version is the GA version compiled by you. I don't know what GUI libraries the cygwin X version uses, but neither should be Motif (isn't it used only on solaris?). Motif is supported by all Unix systems. Don't know about Cygwin. I assume Cygwin uses the GTK libraries. I don't have this setup, thus I'll have to leave reproducing and fixing this problem to someone else. -- Never be afraid to tell the world who you are. -- Anonymous /// 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: bug in confirm() and default option
On Sun, 3 Sep 2006 at 12:53pm, Bram Moolenaar wrote: Hari Krishna Dara wrote: According to the help, if you specify a value of 0 for default, none of the choices should be selected, but this is not how it is working. I tried both on win32 and cygwin (X) gvim and both default to 1 instead. Is there another trick to not select any of the choices? Please give information about the GUI you are using. There is at least a known problem with Motif. I don't know what other information you need, but the win32 version is the GA version compiled by you. I don't know what GUI libraries the cygwin X version uses, but neither should be Motif (isn't it used only on solaris?). Motif is supported by all Unix systems. Don't know about Cygwin. I assume Cygwin uses the GTK libraries. I don't have this setup, thus I'll have to leave reproducing and fixing this problem to someone else. But this happens on the vanilla win32 version also, so doesn't that mean this is in some common place above platform specific code? -- Thanks, Hari __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: bug in confirm() and default option
Hari Krishna Dara wrote: According to the help, if you specify a value of 0 for default, none of the choices should be selected, but this is not how it is working. I tried both on win32 and cygwin (X) gvim and both default to 1 instead. Is there another trick to not select any of the choices? Please give information about the GUI you are using. There is at least a known problem with Motif. I don't know what other information you need, but the win32 version is the GA version compiled by you. I don't know what GUI libraries the cygwin X version uses, but neither should be Motif (isn't it used only on solaris?). Motif is supported by all Unix systems. Don't know about Cygwin. I assume Cygwin uses the GTK libraries. I don't have this setup, thus I'll have to leave reproducing and fixing this problem to someone else. But this happens on the vanilla win32 version also, so doesn't that mean this is in some common place above platform specific code? I have tried the win32 console version and it works properly there. Do you mean the GUI version? Please be specific, trying all kinds of things to find out what you mean is a waste of time. -- You were lucky to have a LAKE! There were a hundred and sixty of us living in a small shoebox in the middle of the road. /// 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: bug in confirm() and default option
On Sun, 3 Sep 2006 at 8:21pm, Bram Moolenaar wrote: Hari Krishna Dara wrote: According to the help, if you specify a value of 0 for default, none of the choices should be selected, but this is not how it is working. I tried both on win32 and cygwin (X) gvim and both default to 1 instead. Is there another trick to not select any of the choices? Please give information about the GUI you are using. There is at least a known problem with Motif. I don't know what other information you need, but the win32 version is the GA version compiled by you. I don't know what GUI libraries the cygwin X version uses, but neither should be Motif (isn't it used only on solaris?). Motif is supported by all Unix systems. Don't know about Cygwin. I assume Cygwin uses the GTK libraries. I don't have this setup, thus I'll have to leave reproducing and fixing this problem to someone else. But this happens on the vanilla win32 version also, so doesn't that mean this is in some common place above platform specific code? I have tried the win32 console version and it works properly there. Do you mean the GUI version? Please be specific, trying all kinds of things to find out what you mean is a waste of time. I reported that the console version works fine in a separate email, so yes, it is the GUI version. Sorry for not being clear. -- Thanks, Hari __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
bug in confirm() and default option
According to the help, if you specify a value of 0 for default, none of the choices should be selected, but this is not how it is working. I tried both on win32 and cygwin (X) gvim and both default to 1 instead. Is there another trick to not select any of the choices? -- Thanks, Hari __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: bug in confirm() and default option
On Sat, Sep 02, 2006 at 12:05:57AM -0700, Hari Krishna Dara wrote: According to the help, if you specify a value of 0 for default, none of the choices should be selected, but this is not how it is working. I tried both on win32 and cygwin (X) gvim and both default to 1 instead. Is there another trick to not select any of the choices? I get the same behavior on Linux (FC2). In vim (not gvim), :echo confirm(Save changes?, Yes\nNo\nCancel, 0) echoes 0 if I hit CR without making a choice. HTH --Benji Fisher
Re: bug in confirm() and default option
On Sat, 2 Sep 2006 at 8:20am, Benji Fisher wrote: On Sat, Sep 02, 2006 at 12:05:57AM -0700, Hari Krishna Dara wrote: According to the help, if you specify a value of 0 for default, none of the choices should be selected, but this is not how it is working. I tried both on win32 and cygwin (X) gvim and both default to 1 instead. Is there another trick to not select any of the choices? I get the same behavior on Linux (FC2). In vim (not gvim), :echo confirm(Save changes?, Yes\nNo\nCancel, 0) echoes 0 if I hit CR without making a choice. HTH --Benji Fisher This is working as expected. The index starts from 1, so 0 is invalid and is right in this case. Interestingly, if you pass an invalid number, say 4, console vim returns 4 back (not 0) but the gui version returns 1. -- Thanks, Hari __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: bug in confirm() and default option
On Sat, 2 Sep 2006 at 2:25pm, Bram Moolenaar wrote: Hari Krishna Dara wrote: According to the help, if you specify a value of 0 for default, none of the choices should be selected, but this is not how it is working. I tried both on win32 and cygwin (X) gvim and both default to 1 instead. Is there another trick to not select any of the choices? Please give information about the GUI you are using. There is at least a known problem with Motif. I don't know what other information you need, but the win32 version is the GA version compiled by you. I don't know what GUI libraries the cygwin X version uses, but neither should be Motif (isn't it used only on solaris?). -- Thanks, Hari __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com