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

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

Expand Messages
  • 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 1 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.