]> code.delx.au - gnu-emacs/commitdiff
(compute_motion): Call strwidth only when necessary.
authorKenichi Handa <handa@m17n.org>
Wed, 25 Mar 1998 10:45:59 +0000 (10:45 +0000)
committerKenichi Handa <handa@m17n.org>
Wed, 25 Mar 1998 10:45:59 +0000 (10:45 +0000)
Set wide_column_end_hpos only when MULTIBYTE_BYTES_WIDTH set
nonzero to wide_column.

src/indent.c

index bd09008104ca19c788d480ee50194b2547315bdc..2811fbde7b7cda96592a8c9e8a537036e2480c34 100644 (file)
@@ -1104,7 +1104,8 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
            {
              unsigned char *ovstr;
              int ovlen = overlay_strings (pos, win, &ovstr);
-             hpos += (multibyte ? strwidth (ovstr, ovlen) : ovlen);
+             hpos += ((multibyte && ovlen > 0)
+                      ? strwidth (ovstr, ovlen) : ovlen);
            }
          did_motion = 0;
 
@@ -1450,7 +1451,8 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
              ptr = BYTE_POS_ADDR (pos_byte);
              MULTIBYTE_BYTES_WIDTH (ptr, c, dp);
              pos_byte += bytes;
-             wide_column_end_hpos = hpos + wide_column;
+             if (wide_column)
+               wide_column_end_hpos = hpos + wide_column;
              hpos += width;
            }
          else