From: Benno Schulenberg Date: Sun, 22 Mar 2015 11:42:29 +0000 (+0000) Subject: Stepping backward or forward not simply one byte X-Git-Tag: v2.4.0~2 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=a44cf41d3773b313ae17eff3b8aa56c7ad2a5f95;p=nano.git Stepping backward or forward not simply one byte but one character (possibly multibyte). This fixes Savannah bug #42175. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5148 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 6f646e0b..7c86e3a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,10 @@ * src/chars.c (move_mbleft): Start looking for a multibyte char not at the start of the string, but only as far back as such a char can possibly be. Change suggested by Mark Majeres. + * src/search.c (findnextstr): Step backward or forward not simply + one byte but one character (possibly multibyte). Fixes Savannah + bug #42175, reported by myself, and the finding of ghosts seen in + https://lists.gnu.org/archive/html/nano-devel/2015-03/msg00055.html. 2015-03-21 Benno Schulenberg * src/text.c (do_alt_speller): Remove some leftovers. diff --git a/src/search.c b/src/search.c index d0656972..a5233b5b 100644 --- a/src/search.c +++ b/src/search.c @@ -286,9 +286,9 @@ bool findnextstr( rev_start += #ifndef NANO_TINY ISSET(BACKWARDS_SEARCH) ? - openfile->current_x - 1 : + ((openfile->current_x == 0) ? -1 : move_mbleft(fileptr->data, openfile->current_x)) : #endif - openfile->current_x + 1; + move_mbright(fileptr->data, openfile->current_x); /* Look for needle in the current line we're searching. */ enable_nodelay();