From: Kenichi Handa Date: Wed, 25 Mar 1998 10:45:59 +0000 (+0000) Subject: (compute_motion): Call strwidth only when necessary. X-Git-Tag: emacs-20.3~1791 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4116deeea850a713bf63abcb90439bacbd5453a2;p=emacs.git (compute_motion): Call strwidth only when necessary. Set wide_column_end_hpos only when MULTIBYTE_BYTES_WIDTH set nonzero to wide_column. --- diff --git a/src/indent.c b/src/indent.c index bd09008104c..2811fbde7b7 100644 --- a/src/indent.c +++ b/src/indent.c @@ -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