[tin-dev] (fwd) Re: Tin issue

Dennis Preiser dennis at d--p.de
Tue Feb 21 18:18:59 CET 2017


On Mon, Feb 20, 2017 at 09:26:22PM +0100, Dennis Preiser wrote:
>>> > > On Sun, Feb 19, 2017 at 11:37:32AM +0100, Walter Alejandro Iglesias wrote:
>>> > > > 1. An issue (bug?) I found.  In the article view, search (/) and 'repeat
>>> > > >    last search' (\) get stalled in the first occurrence.  I have to
>>> > > >    scroll the page till the first finding is hidden off the buffer to be
>>> > > >    able to go forward to the next occurrence.

> I had no time to look into this but I can reproduce it with wildcard=0
> in tinrc. (linked against ncursesw)

In case of 'wildcard=0' we reset both search offsets to zero at the
beginning of wildmat.c:wildmatpos. That's the reason why each subsequent
search starts at the beginning of the current line and finds the same
occurence as the last search.

The attached patch uses the second offset of the previous search to skip
over the already processed part of the current line.

Dennis
-------------- next part --------------
diff -urp tin-2.4.1_r3/src/wildmat.c tin-2.4.1_r4/src/wildmat.c
--- tin-2.4.1_r3/src/wildmat.c	2016-10-12 17:28:02.000000000 +0200
+++ tin-2.4.1_r4/src/wildmat.c	2017-02-21 17:27:28.000000000 +0100
@@ -169,7 +169,7 @@ wildmatpos(
 	int srch_offsets_size)
 {
 	char *txt, *t, *px;
-	int i;
+	int i, prev_offset = srch_offsets[1];
 	t_bool ret = FALSE;
 
 	if (srch_offsets_size >= 2)
@@ -199,7 +199,7 @@ wildmatpos(
 	/* remove the leading '*' */
 	px = my_strdup(p + 1);
 
-	for (t = txt; *t; t++)
+	for (t = txt + prev_offset; *t; t++)
 		if ((ret = (DoMatch(t, px))) == TRUE) {
 			/* remove the trailing '*' */
 			px[strlen(px) - 1] = '\0';


More information about the tin-dev mailing list