Loading ...
Sorry, an error occurred while loading the content.
 

confirm("foo", "")

Expand Messages
  • Benji Fisher
    ... On W95, this brings up a dialogue box with an blank button, and returns 1 if I hit or click on the button. On Mac OS X (Carbon), I get a box with no
    Message 1 of 8 , Feb 8, 2002
      :echo confirm("foo", "")

      On W95, this brings up a dialogue box with an blank button, and returns 1 if I
      hit <CR> or click on the button. On Mac OS X (Carbon), I get a box with no
      button, and neither the main vim window nor the alert box accepts any input.

      This may be an OS-specific problem, but it may be easier to fix it in an
      OS-independent way, hence the cross post.

      --Benji Fisher
    • Tomas Zellerin
      ... Oddly enough, gtk version seems to crash (SEGV) on it.
      Message 2 of 8 , Feb 8, 2002
        On Fri, Feb 08, 2002 at 07:46:30AM -0500, Benji Fisher wrote:
        > :echo confirm("foo", "")
        >
        > On W95, this brings up a dialogue box with an blank button, and returns 1 if I
        > hit <CR> or click on the button. On Mac OS X (Carbon), I get a box with no
        > button, and neither the main vim window nor the alert box accepts any input.
        >
        > This may be an OS-specific problem, but it may be easier to fix it in an
        > OS-independent way, hence the cross post.
        >
        > --Benji Fisher

        Oddly enough, gtk version seems to crash (SEGV) on it.
      • Tomas Zellerin
        ... More details on crash - gui_gtk.c line 1370, debug: comments added: --butcount; // debug: here, butcount is -1 --def_but; /* 1 is first button */ if
        Message 3 of 8 , Feb 8, 2002
          On Fri, Feb 08, 2002 at 01:50:06PM +0100, Tomas Zellerin wrote:
          > On Fri, Feb 08, 2002 at 07:46:30AM -0500, Benji Fisher wrote:
          > > :echo confirm("foo", "")
          > >
          >
          > Oddly enough, gtk version seems to crash (SEGV) on it.

          More details on crash - gui_gtk.c line 1370, debug: comments added:

          --butcount; // debug: here, butcount is -1
          --def_but; /* 1 is first button */
          if (def_but < 0)
          def_but = 0;
          if (def_but > butcount)
          def_but = butcount; // debug: here, def_but is -1, too

          gtk_widget_grab_focus(button[def_but]); // debug: this crashes
        • Bram Moolenaar
          ... If you pass wrong arguments you get a wrong dialog. What else did you expect? On the Mac do you get completely stuck, or can you quit the dialog somehow?
          Message 4 of 8 , Feb 8, 2002
            Benji Fisher wrote:

            > :echo confirm("foo", "")
            >
            > On W95, this brings up a dialogue box with an blank button, and
            > returns 1 if I hit <CR> or click on the button. On Mac OS X (Carbon),
            > I get a box with no button, and neither the main vim window nor the
            > alert box accepts any input.
            >
            > This may be an OS-specific problem, but it may be easier to fix
            > it in an OS-independent way, hence the cross post.

            If you pass wrong arguments you get a wrong dialog. What else did you
            expect?

            On the Mac do you get completely stuck, or can you quit the dialog
            somehow? If you get stuck we might have to do something to avoid this.

            --
            GALAHAD: No, please. Please! I can defeat them! There's only a hundred.
            GIRLS: He will beat us easily. We haven't a chance.
            "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

            /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
            ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim )))
            \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
          • Bram Moolenaar
            ... Yep. The patch below should fix that. Any other systems for which there are problems? Another solution would be to add an OK button by default. ...
            Message 5 of 8 , Feb 8, 2002
              Tomas Zellerin wrote:

              > On Fri, Feb 08, 2002 at 07:46:30AM -0500, Benji Fisher wrote:
              > > :echo confirm("foo", "")
              > >
              > > On W95, this brings up a dialogue box with an blank button, and
              > > returns 1 if I hit <CR> or click on the button. On Mac OS X
              > > (Carbon), I get a box with no button, and neither the main vim
              > > window nor the alert box accepts any input.
              > >
              > > This may be an OS-specific problem, but it may be easier to fix
              > > it in an OS-independent way, hence the cross post.
              > >
              > > --Benji Fisher
              >
              > Oddly enough, gtk version seems to crash (SEGV) on it.

              Yep. The patch below should fix that. Any other systems for which
              there are problems? Another solution would be to add an "OK" button by
              default.

              *** ../../vim60.203/src/gui_gtk.c Fri Feb 8 10:29:45 2002
              --- gui_gtk.c Fri Feb 8 15:01:03 2002
              ***************
              *** 1386,1400 ****

              vim_free(names);

              ! --butcount;
              ! --def_but; /* 1 is first button */
              ! if (def_but < 0)
              ! def_but = 0;
              ! if (def_but > butcount)
              ! def_but = butcount;

              - gtk_widget_grab_focus(button[def_but]);
              - gtk_widget_grab_default(button[def_but]);
              if (textfield != NULL)
              gtk_window_set_focus(GTK_WINDOW(dialog), dialog_textentry);

              --- 1386,1403 ----

              vim_free(names);

              ! if (butcount > 0)
              ! {
              ! --def_but; /* 1 is first button */
              ! if (def_but < 0)
              ! def_but = 0;
              ! if (def_but >= butcount)
              ! def_but = butcount - 1;
              !
              ! gtk_widget_grab_focus(button[def_but]);
              ! gtk_widget_grab_default(button[def_but]);
              ! }

              if (textfield != NULL)
              gtk_window_set_focus(GTK_WINDOW(dialog), dialog_textentry);


              --
              "My particular problem is with registry entries, which seem to just accumulate
              like plastic coffee cups..." -- Paul Moore

              /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
              ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim )))
              \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
            • Benji Fisher
              ... In answer to your other question: I really get stuck on Mac OS X (Carbon). I got out using the GUI thing that invokes kill -9. Since there are problems
              Message 6 of 8 , Feb 8, 2002
                On Friday, February 8, 2002, at 09:05 AM, Bram Moolenaar wrote:

                >
                > Tomas Zellerin wrote:
                >
                >> On Fri, Feb 08, 2002 at 07:46:30AM -0500, Benji Fisher wrote:
                >>> :echo confirm("foo", "")
                >>>
                >>> On W95, this brings up a dialogue box with an blank button, and
                >>> returns 1 if I hit <CR> or click on the button. On Mac OS X
                >>> (Carbon), I get a box with no button, and neither the main vim
                >>> window nor the alert box accepts any input.
                >>>
                >>> This may be an OS-specific problem, but it may be easier to fix
                >>> it in an OS-independent way, hence the cross post.
                >>>
                >>> --Benji Fisher
                >>
                >> Oddly enough, gtk version seems to crash (SEGV) on it.
                >
                > Yep. The patch below should fix that. Any other systems for which
                > there are problems? Another solution would be to add an "OK" button by
                > default.[snip]

                In answer to your other question: I really get stuck on Mac OS X
                (Carbon). I got out using the GUI thing that invokes kill -9.

                Since there are problems on two systems, I suggest again a general
                solution. Adding an "OK" button when passed an empty string seems like
                a good idea to me.

                --Benji Fisher
              • Christian J. Robinson
                ... Hash: SHA1 ... For me, it stops the crash, but there s no way to dismiss the window. If I tell the window manager to close/delete the window, Vim gets
                Message 7 of 8 , Feb 8, 2002
                  -----BEGIN PGP SIGNED MESSAGE-----
                  Hash: SHA1

                  Today, Bram Moolenaar wrote:

                  > Tomas Zellerin wrote:
                  >
                  >> On Fri, Feb 08, 2002 at 07:46:30AM -0500, Benji Fisher wrote:
                  >>
                  >>> :echo confirm("foo", "")
                  >>>
                  >>> On W95, this brings up a dialogue box with an blank button, and
                  >>> returns 1 if I hit <CR> or click on the button. On Mac OS X
                  >>> (Carbon), I get a box with no button, and neither the main vim
                  >>> window nor the alert box accepts any input.
                  >>
                  >> Oddly enough, gtk version seems to crash (SEGV) on it.
                  >
                  > Yep. The patch below should fix that.

                  For me, it stops the crash, but there's no way to dismiss the window.

                  If I tell the window manager to close/delete the window, Vim gets stuck
                  in an infinite loop printing the following to stderr repeatedly:

                  Gtk-WARNING **: invalid cast from `(unknown)' to `GtkObject'

                  (gtk+ 1.2.10)

                  Hmm, actually, if I have the window manager close/delete a confirm()
                  window even when I have specified buttons, I get this behavior. A new
                  bug? I get the same problem with inputdialog(), the dialog for an
                  already existing swap file, the file changed dialog... Any I've missed?
                  The browse() widget doesn't do this to me.

                  > Another solution would be to add an "OK" button by default.

                  ...Or have vim issue an error when the buttons string is null?

                  If you make it provide a default button, perhaps the second argument to
                  confirm() should be optional?

                  Just my $0.02.


                  - - Christian

                  - --
                  Press any key... NO!... except that one.
                  Christian J. Robinson <infynity@...> ICQ: 15869262
                  http://infynity.spodzone.com/ GPG key: hkp://pgpkeys.mit.edu/0x893B0EAF
                  -----BEGIN PGP SIGNATURE-----
                  Version: GnuPG v1.0.6 (GNU/Linux)
                  Comment: For info see http://www.gnupg.org

                  iD8DBQE8ZHtKNCSthIk7Dq8RAnTdAKCBCafXf9FtBVditilsHjxYseId+QCfeXD8
                  LDdZJOc7rpki6bTZtkb2cvk=
                  =QKk1
                  -----END PGP SIGNATURE-----
                • Tomas Zellerin
                  ... The particular patch allows for the dialog to appear, but one can not get vim back to working after that. I would prefer either vim throwing an error
                  Message 8 of 8 , Feb 10, 2002
                    On Fri, Feb 08, 2002 at 03:05:26PM +0100, Bram Moolenaar wrote:
                    > > > :echo confirm("foo", "")
                    > > >
                    > >
                    > > Oddly enough, gtk version seems to crash (SEGV) on it.
                    >
                    > Yep. The patch below should fix that. Any other systems for which
                    > there are problems? Another solution would be to add an "OK" button by
                    > default.
                    >
                    > (...)

                    The particular patch allows for the dialog to appear, but one can not
                    get vim back to working after that. I would prefer either vim throwing
                    an error message in that case, or using OK button as default. (I hope you
                    did mean this, not add "OK" button by default to every string.)

                    Regards
                    Tomas Zellerin
                  Your message has been successfully submitted and would be delivered to recipients shortly.