[PATCH] backward searching off-by-one indexing error



Hello mc-devel,

there's an error while backward searching in mcview.

To reproduce:
1) echo -e "foo\nbar\nbar\n" > /tmp/sample.tmp
2) mcedit /tmp/sample.tmp
3) regexp search by '/' -> type "bar"
4) press 'n' for the next occurence
5) backward search '?' and press enter ("bar" is prefilled)

Results:
You see that the line on the top of the screen is shrunk (one character
is missing).

Reference:
 http://bugzilla.redhat.com/169823

Jindrich

-- 
Jindrich Novy <jnovy redhat com>, http://people.redhat.com/jnovy/
(o_                                                           _o)
//\      The worst evil in the world is refusal to think.     //\
V_/_                                                         _\_V

--- mc/src/view.c.searchfix	2005-09-01 22:49:17.000000000 +0200
+++ mc/src/view.c	2005-10-04 17:08:39.000000000 +0200
@@ -2396,7 +2396,7 @@ search (WView *view, char *text,
 	if (view->direction == 1)
 	    t += forward_line_start;
 	else
-	    t = reverse_line_start ? reverse_line_start + 3 : 0;
+	    t = reverse_line_start ? reverse_line_start + 2 : 0;
 	view->search_start += t;
 
 	if (t != beginning) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]