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

Re: Bug: Win32 guitabtooltip doesn't respect backslash-escaped special chars

Expand Messages
  • Ben Schmidt
    ... I for one would be interested in knowing what actually is expected in this circumstance. I personally think that s quite unclear and am not at all
    Message 1 of 8 , Jan 2, 2008
    • 0 Attachment
      Erik Falor wrote:
      > While writing a guitabtooltip function, I discovered that the
      > tooltips in Win32 don't properly handle backslash-escaped chars.
      > In particular, '\n' comes out as a box, and '\t' appears to terminate
      > the string like '\0'.
      >
      > The GTK gui on Linux, however, works as expected.

      I for one would be interested in knowing what actually is 'expected' in this
      circumstance. I personally think that's quite unclear and am not at all surprised
      there is a difference between platforms.

      I guess it's obvious that \n should be a newline. But should they be left
      justified? Or centered? Or...?

      If tabs are used, should they line up, given the proportional font? What width
      should they be? Etc.?

      Cheers,

      Ben.




      Send instant messages to your online friends http://au.messenger.yahoo.com


      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Tony Mechelynck
      ... On Windows, where the OS-standard line break is r n, shouldn t _that_ also be used to break lines in a tooltip? And what about Mac? Best regards, Tony. --
      Message 2 of 8 , Jan 2, 2008
      • 0 Attachment
        Ben Schmidt wrote:
        > Erik Falor wrote:
        >> While writing a guitabtooltip function, I discovered that the
        >> tooltips in Win32 don't properly handle backslash-escaped chars.
        >> In particular, '\n' comes out as a box, and '\t' appears to terminate
        >> the string like '\0'.
        >>
        >> The GTK gui on Linux, however, works as expected.
        >
        > I for one would be interested in knowing what actually is 'expected' in this
        > circumstance. I personally think that's quite unclear and am not at all surprised
        > there is a difference between platforms.
        >
        > I guess it's obvious that \n should be a newline. But should they be left
        > justified? Or centered? Or...?
        >
        > If tabs are used, should they line up, given the proportional font? What width
        > should they be? Etc.?
        >
        > Cheers,
        >
        > Ben.

        On Windows, where the OS-standard line break is \r\n, shouldn't _that_ also be
        used to break lines in a tooltip? And what about Mac?

        Best regards,
        Tony.
        --
        hundred-and-one symptoms of being an internet addict:
        204. You're being audited because you mailed your tax return to the IRC.


        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_dev" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Erik Falor
        Well, I suppose by works as expected I meant that the string escapes didn t blow up :) What I think should be acceptable behavior is for the guitabtooltips
        Message 3 of 8 , Jan 2, 2008
        • 0 Attachment
          Well, I suppose by 'works as expected' I meant that the string escapes didn't blow up :)

          What I think should be acceptable behavior is for the guitabtooltips to behave the same as the tooltips given by the balloon-eval feature.

          From debugger.txt line 103:

          "The Balloon evaluation functions are also used to show a tooltip for the toolbar."

          Well, if the tooltips on the toolbar are supposed to use the same functions as ballooneval, then why not the guitab tooltips?

          I realize that the 'toolbar' option doesn't apply to Win32, and so the toolbar settings, including "tooltips" maybe don't, either.  I'm sure there is a prefectly reasonable explanation for why they weren't implemented the same way on Windows.  At any rate, it would be nice if the text displayed by 'guitabtooltip' was given the same treatment as 'balloonexpr'  text.

          On 02/01/2008, Ben Schmidt <mail_ben_schmidt@...> wrote:

          Erik Falor wrote:
          > While writing a guitabtooltip function, I discovered that the
          > tooltips in Win32 don't properly handle backslash-escaped chars.
          > In particular, '\n' comes out as a box, and '\t' appears to terminate
          > the string like '\0'.
          >
          > The GTK gui on Linux, however, works as expected.

          I for one would be interested in knowing what actually is 'expected' in this
          circumstance. I personally think that's quite unclear and am not at all surprised
          there is a difference between platforms.

          I guess it's obvious that \n should be a newline. But should they be left
          justified? Or centered? Or...?

          If tabs are used, should they line up, given the proportional font? What width
          should they be? Etc.?

          Cheers,

          Ben.




          Send instant messages to your online friends http://au.messenger.yahoo.com







          --
          Registered Linux User #445632
          http://counter.li.org
          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_dev" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---

        • Erik Falor
          ... r n results in two boxes. -- Registered Linux User #445632 http://counter.li.org --~--~---------~--~----~------------~-------~--~----~ You received this
          Message 4 of 8 , Jan 2, 2008
          • 0 Attachment
            On 02/01/2008, Tony Mechelynck <antoine.mechelynck@...> wrote:

            On Windows, where the OS-standard line break is \r\n, shouldn't _that_ also be
            used to break lines in a tooltip? And what about Mac?

            Best regards,
            Tony.

            "\r\n" results in two boxes.

            --
            Registered Linux User #445632
            http://counter.li.org
            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_dev" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---

          • ap
            I think this information from h balloonexpr applies. To check whether line breaks in the balloon text work use this check: if has( balloon_multiline ) When
            Message 5 of 8 , Jan 2, 2008
            • 0 Attachment
              I think this information from 'h balloonexpr' applies.

              "To check whether line breaks in the balloon text work use this
              check:
              if has("balloon_multiline")
              When they are supported "\n" characters will start a new line."

              I think there are no references in the docs, other than this one,
              about
              evaluating escape-sequences in tooltips.

              -ap



              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_dev" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            • Erik Falor
              ... FWIW, the Win32 build does have balloon_multiline. According to gui_w32.c, George V. Reilly was the original author of the Windows GUI code. Robert Webb
              Message 6 of 8 , Jan 2, 2008
              • 0 Attachment
                On 02/01/2008, ap <politza@...> wrote:

                I think this information from 'h balloonexpr' applies.

                "To check whether line breaks in the balloon text work use this
                check:
                        if has("balloon_multiline")
                When they are supported "\n" characters will start a new line."

                I think there are no references in the docs, other than this one,
                about
                evaluating escape-sequences in tooltips.

                -ap


                FWIW, the Win32 build does have balloon_multiline.

                According to gui_w32.c, George V. Reilly was the original author of the Windows GUI code.  Robert Webb later reworked much of it.
                However, the source file doesn't have Robert's email address.  Does anybody know how to contact Mr. Webb?  Have there been any other maintainers since Mr. Webb worked on it?

                Regards,
                Erik

                --
                Registered Linux User #445632
                http://counter.li.org
                --~--~---------~--~----~------------~-------~--~----~
                You received this message from the "vim_dev" maillist.
                For more information, visit http://www.vim.org/maillist.php
                -~----------~----~----~----~------~----~------~--~---

              • Bram Moolenaar
                ... This was a known problem for some time. It looks like I found a solution, see the patch below. Let me know if this works for you. ... *************** ...
                Message 7 of 8 , Jan 3, 2008
                • 0 Attachment
                  Erik Falor wrote:

                  > While writing a guitabtooltip function, I discovered that the
                  > tooltips in Win32 don't properly handle backslash-escaped chars.
                  > In particular, '\n' comes out as a box, and '\t' appears to terminate the
                  > string like '\0'.
                  >
                  > The GTK gui on Linux, however, works as expected.
                  >
                  > I have attached a sample
                  > .gvimrc-like start-up script which illustrates the problem.
                  > When gvim is invoked like so:
                  >
                  > gvim -u NONE -U guitab.vim
                  >
                  > two unnamed gui tabs
                  > are displayed. When you hover over them, you should see a tooltip
                  > window that looks something like this:
                  >
                  > +------+
                  > |1 |
                  > |2 3|
                  > |4 |
                  > +------+
                  >
                  > In the Win32 gui, it looks like this instead:
                  >
                  > 1<box>2

                  This was a known problem for some time. It looks like I found a
                  solution, see the patch below. Let me know if this works for you.


                  *** ../vim-7.1.188/src/gui_w32.c Thu Aug 30 12:24:21 2007
                  --- src/gui_w32.c Thu Jan 3 12:35:52 2008
                  ***************
                  *** 987,992 ****
                  --- 987,997 ----
                  {
                  LPNMTTDISPINFOW lpdi = (LPNMTTDISPINFOW)lParam;

                  + /* Set the maximum width, this also enables using
                  + * \n for line break. */
                  + SendMessage(lpdi->hdr.hwndFrom, TTM_SETMAXTIPWIDTH,
                  + 0, 500);
                  +
                  tt_text = enc_to_ucs2(str, NULL);
                  lpdi->lpszText = tt_text;
                  /* can't show tooltip if failed */
                  ***************
                  *** 995,1000 ****
                  --- 1000,1010 ----
                  # endif
                  {
                  LPNMTTDISPINFO lpdi = (LPNMTTDISPINFO)lParam;
                  +
                  + /* Set the maximum width, this also enables using
                  + * \n for line break. */
                  + SendMessage(lpdi->hdr.hwndFrom, TTM_SETMAXTIPWIDTH,
                  + 0, 500);

                  if (STRLEN(str) < sizeof(lpdi->szText)
                  || ((tt_text = vim_strsave(str)) == NULL))


                  --
                  FATHER: Did you kill all those guards?
                  LAUNCELOT: Yes ... I'm very sorry ...
                  FATHER: They cost fifty pounds each!
                  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

                  /// Bram Moolenaar -- Bram@... -- 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 ///

                  --~--~---------~--~----~------------~-------~--~----~
                  You received this message from the "vim_dev" maillist.
                  For more information, visit http://www.vim.org/maillist.php
                  -~----------~----~----~----~------~----~------~--~---
                Your message has been successfully submitted and would be delivered to recipients shortly.