home *** CD-ROM | disk | FTP | other *** search
- To: vim-dev@vim.org
- Subject: Patch 6.2.388
- Fcc: outbox
- From: Bram Moolenaar <Bram@moolenaar.net>
- Mime-Version: 1.0
- Content-Type: text/plain; charset=ISO-8859-1
- Content-Transfer-Encoding: 8bit
- ------------
-
- Patch 6.2.388
- Problem: GTK: When displaying some double-width characters they are drawn
- as single-width, because of conversion to UTF-8.
- Solution: Check the width that GTK uses and add a space if it's one instead
- of two.
- Files: src/gui_gtk_x11.c
-
-
- *** ../vim-6.2.387/src/gui_gtk_x11.c Mon Feb 9 18:45:58 2004
- --- src/gui_gtk_x11.c Sat Mar 20 13:21:41 2004
- ***************
- *** 5038,5047 ****
- gui_gtk2_draw_string(int row, int col, char_u *s, int len, int flags)
- {
- GdkRectangle area; /* area for clip mask */
- - char_u *conv_buf = NULL; /* result of UTF-8 conversion */
- PangoGlyphString *glyphs; /* glyphs of current item */
- int column_offset = 0; /* column offset in cells */
- int i;
-
- if (gui.text_context == NULL || gui.drawarea->window == NULL)
- return len;
- --- 5045,5058 ----
- gui_gtk2_draw_string(int row, int col, char_u *s, int len, int flags)
- {
- GdkRectangle area; /* area for clip mask */
- PangoGlyphString *glyphs; /* glyphs of current item */
- int column_offset = 0; /* column offset in cells */
- int i;
- + char_u *conv_buf = NULL; /* result of UTF-8 conversion */
- + char_u *new_conv_buf;
- + int convlen;
- + char_u *sp, *bp;
- + int plen;
-
- if (gui.text_context == NULL || gui.drawarea->window == NULL)
- return len;
- ***************
- *** 5054,5063 ****
- * prohibits changing this to something else than UTF-8 if the GUI is
- * in use.
- */
- ! conv_buf = string_convert(&output_conv, s, &len);
- ! s = conv_buf;
- !
- g_return_val_if_fail(conv_buf != NULL, len);
- }
-
- /*
- --- 5065,5101 ----
- * prohibits changing this to something else than UTF-8 if the GUI is
- * in use.
- */
- ! convlen = len;
- ! conv_buf = string_convert(&output_conv, s, &convlen);
- g_return_val_if_fail(conv_buf != NULL, len);
- +
- + /* Correct for differences in char width: some chars are
- + * double-wide in 'encoding' but single-wide in utf-8. Add a space to
- + * compensate for that. */
- + for (sp = s, bp = conv_buf; sp < s + len && bp < conv_buf + convlen; )
- + {
- + plen = utf_ptr2len_check(bp);
- + if ((*mb_ptr2cells)(sp) == 2 && utf_ptr2cells(bp) == 1)
- + {
- + new_conv_buf = alloc(convlen + 2);
- + if (new_conv_buf == NULL)
- + return len;
- + plen += bp - conv_buf;
- + mch_memmove(new_conv_buf, conv_buf, plen);
- + new_conv_buf[plen] = ' ';
- + mch_memmove(new_conv_buf + plen + 1, conv_buf + plen,
- + convlen - plen + 1);
- + vim_free(conv_buf);
- + conv_buf = new_conv_buf;
- + ++convlen;
- + bp = conv_buf + plen;
- + plen = 1;
- + }
- + sp += (*mb_ptr2len_check)(sp);
- + bp += plen;
- + }
- + s = conv_buf;
- + len = convlen;
- }
-
- /*
- *** ../vim-6.2.387/src/version.c Mon Mar 22 14:33:28 2004
- --- src/version.c Mon Mar 22 14:38:38 2004
- ***************
- *** 639,640 ****
- --- 639,642 ----
- { /* Add new patch number below this line */
- + /**/
- + 388,
- /**/
-
- --
- hundred-and-one symptoms of being an internet addict:
- 92. It takes you two hours to check all 14 of your mailboxes.
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
- /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
- \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
- \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
-