From 4116deeea850a713bf63abcb90439bacbd5453a2 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Wed, 25 Mar 1998 10:45:59 +0000 Subject: [PATCH] (compute_motion): Call strwidth only when necessary. Set wide_column_end_hpos only when MULTIBYTE_BYTES_WIDTH set nonzero to wide_column. --- src/indent.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 -- 2.39.2