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

71538Re: confirm() getting invalid dialog width in windows.

Expand Messages
  • mattn
    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.
    • Show all 4 messages in this topic