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

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

Expand Messages
  • Erik Falor
    ... r n results in two boxes. -- Registered Linux User #445632 http://counter.li.org --~--~---------~--~----~------------~-------~--~----~ You received this
    Message 1 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 2 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 3 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 4 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.