diff src/gui_mac.c @ 2338:da6ec32d8d8f vim73

Added strwidth() and strchars() functions.
author Bram Moolenaar <bram@vim.org>
date Sun, 18 Jul 2010 15:31:08 +0200
parents 02cf6d461e3f
children 4b7929dad28a
line wrap: on
line diff
--- a/src/gui_mac.c
+++ b/src/gui_mac.c
@@ -3983,13 +3983,8 @@ draw_string_QD(int row, int col, char_u 
 	/* Multibyte computation taken from gui_w32.c */
 	if (has_mbyte)
 	{
-	    int cell_len = 0;
-	    int n;
-
 	    /* Compute the length in display cells. */
-	    for (n = 0; n < len; n += MB_BYTE2LEN(s[n]))
-		cell_len += (*mb_ptr2cells)(s + n);
-	    rc.right = FILL_X(col + cell_len);
+	    rc.right = FILL_X(col + mb_string2cells(s, len));
 	}
 	else
 #endif
@@ -4087,13 +4082,8 @@ draw_string_ATSUI(int row, int col, char
 	/* Multibyte computation taken from gui_w32.c */
 	if (has_mbyte)
 	{
-	    int cell_len = 0;
-	    int n;
-
 	    /* Compute the length in display cells. */
-	    for (n = 0; n < len; n += MB_BYTE2LEN(s[n]))
-		cell_len += (*mb_ptr2cells)(s + n);
-	    rc.right = FILL_X(col + cell_len);
+	    rc.right = FILL_X(col + mb_string2cells(s, len));
 	}
 	else
 	    rc.right = FILL_X(col + len) + (col + len == Columns);