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

confirm() getting invalid dialog width in windows.

Expand Messages
  • mattn
    Hi list. When encoding=utf-8 and call confirm(x) with utf-8 string passed, displaying dialog are wider than expected. Because it call GetTextWidth() instead of
    Message 1 of 4 , Jun 25, 2013
      Hi list.

      When encoding=utf-8 and call confirm(x) with utf-8 string passed, displaying dialog are wider than expected. Because it call GetTextWidth() instead of GetTextWidthEnc().

      https://gist.github.com/mattn/5863733

      diff -r 5759342cde79 src/gui_w32.c
      --- a/src/gui_w32.c Mon Jun 24 22:33:30 2013 +0200
      +++ b/src/gui_w32.c Wed Jun 26 09:28:25 2013 +0900
      @@ -3216,7 +3216,7 @@
      if (l == 1 && vim_iswhite(*pend)
      && textWidth > maxDialogWidth * 3 / 4)
      last_white = pend;
      - textWidth += GetTextWidth(hdc, pend, l);
      + textWidth += GetTextWidthEnc(hdc, pend, l);
      if (textWidth >= maxDialogWidth)
      {
      /* Line will wrap. */

      --
      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • mattn
      There are more points that should be fixed. https://gist.github.com/mattn/5863733 diff -r 5759342cde79 src/gui_w32.c ... +++ b/src/gui_w32.c Wed Jun 26
      Message 2 of 4 , Jun 25, 2013
        There are more points that should be fixed.

        https://gist.github.com/mattn/5863733

        diff -r 5759342cde79 src/gui_w32.c
        --- a/src/gui_w32.c Mon Jun 24 22:33:30 2013 +0200
        +++ b/src/gui_w32.c Wed Jun 26 09:33:45 2013 +0900
        @@ -3216,7 +3216,7 @@
        if (l == 1 && vim_iswhite(*pend)
        && textWidth > maxDialogWidth * 3 / 4)
        last_white = pend;
        - textWidth += GetTextWidth(hdc, pend, l);
        + textWidth += GetTextWidthEnc(hdc, pend, l);
        if (textWidth >= maxDialogWidth)
        {
        /* Line will wrap. */
        @@ -3282,7 +3282,7 @@
        pend = vim_strchr(pstart, DLG_BUTTON_SEP);
        if (pend == NULL)
        pend = pstart + STRLEN(pstart); // Last button name.
        - textWidth = GetTextWidth(hdc, pstart, (int)(pend - pstart));
        + textWidth = GetTextWidthEnc(hdc, pstart, (int)(pend - pstart));
        if (textWidth < minButtonWidth)
        textWidth = minButtonWidth;
        textWidth += dlgPaddingX; /* Padding within button */
        @@ -3307,7 +3307,7 @@
        pend = vim_strchr(pstart, DLG_BUTTON_SEP);
        if (pend == NULL)
        pend = pstart + STRLEN(pstart); // Last button name.
        - textWidth = GetTextWidth(hdc, pstart, (int)(pend - pstart));
        + textWidth = GetTextWidthEnc(hdc, pstart, (int)(pend - pstart));
        textWidth += dlgPaddingX; /* Padding within button */
        textWidth += DLG_VERT_PADDING_X * 2; /* Padding around button */
        if (textWidth > dlgwidth)


        On Wednesday, June 26, 2013 9:32:05 AM UTC+9, mattn wrote:
        > Hi list.
        >
        > When encoding=utf-8 and call confirm(x) with utf-8 string passed, displaying dialog are wider than expected. Because it call GetTextWidth() instead of GetTextWidthEnc().
        >
        > https://gist.github.com/mattn/5863733
        >
        > diff -r 5759342cde79 src/gui_w32.c
        > --- a/src/gui_w32.c Mon Jun 24 22:33:30 2013 +0200
        > +++ b/src/gui_w32.c Wed Jun 26 09:28:25 2013 +0900
        > @@ -3216,7 +3216,7 @@
        > if (l == 1 && vim_iswhite(*pend)
        > && textWidth > maxDialogWidth * 3 / 4)
        > last_white = pend;
        > - textWidth += GetTextWidth(hdc, pend, l);
        > + textWidth += GetTextWidthEnc(hdc, pend, l);
        > if (textWidth >= maxDialogWidth)
        > {
        > /* Line will wrap. */

        --
        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Bram Moolenaar
        ... I ll include it, thanks. -- Intelligence has much less practical application than you d think. -- Scott Adams, Dilbert. /// Bram Moolenaar --
        Message 3 of 4 , Jun 26, 2013
          Yasuhiro Matsumoto wrote:

          > Hi list.
          >
          > When encoding=utf-8 and call confirm(x) with utf-8 string passed,
          > displaying dialog are wider than expected. Because it call
          > GetTextWidth() instead of GetTextWidthEnc().
          >
          > https://gist.github.com/mattn/5863733

          I'll include it, thanks.

          --
          "Intelligence has much less practical application than you'd think."
          -- Scott Adams, Dilbert.

          /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
          /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
          \\\ an exciting new programming language -- http://www.Zimbu.org ///
          \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

          --
          --
          You received this message from the "vim_dev" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php

          ---
          You received this message because you are subscribed to the Google Groups "vim_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        • Bram Moolenaar
          ... Ah, I had already sent out the patch. Will make another one... -- E M A C S s e l o h c t t n i a a t f p r t e o l ///
          Message 4 of 4 , Jun 26, 2013
            Yasuhiro Matsumoto wrote:

            > There are more points that should be fixed.
            >
            > https://gist.github.com/mattn/5863733

            Ah, I had already sent out the patch. Will make another one...


            --
            E M A C S
            s e l o h
            c t t n i
            a a t f
            p r t
            e o
            l

            /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
            /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
            \\\ an exciting new programming language -- http://www.Zimbu.org ///
            \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

            --
            --
            You received this message from the "vim_dev" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php

            ---
            You received this message because you are subscribed to the Google Groups "vim_dev" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
            For more options, visit https://groups.google.com/groups/opt_out.
          Your message has been successfully submitted and would be delivered to recipients shortly.