From: Neil Brown Date: Thu, 10 May 2012 06:44:10 +0000 (+1000) Subject: Browser: Extend proper cursor tracking to search. X-Git-Tag: v0.9~22 X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=bab52e19a9244f901bd97ea61e40078b8a9a1ecf;p=wiggle.git Browser: Extend proper cursor tracking to search. Record the cursor in search anchors so we can go back to the right location. Signed-off-by: NeilBrown --- diff --git a/vpatch.c b/vpatch.c index 294e9bc..e2f54cd 100644 --- a/vpatch.c +++ b/vpatch.c @@ -1173,8 +1173,9 @@ static void merge_window(struct plist *p, FILE *f, int reverse) struct search_anchor { struct search_anchor *next; struct mpos pos; + struct cursor curs; int notfound; - int row, col; + int row, start; unsigned int searchlen; } *anchor = NULL; @@ -1536,7 +1537,9 @@ static void merge_window(struct plist *p, FILE *f, int reverse) anchor = a->next; pos = a->pos; row = a->row; - curs.col = a->col; + start = a->start; + curs = a->curs; + curs.target = -1; search_notfound = a->notfound; searchlen = a->searchlen; search[searchlen] = 0; @@ -1764,11 +1767,12 @@ static void merge_window(struct plist *p, FILE *f, int reverse) if (anchor == NULL || !same_mpos(anchor->pos, pos) || anchor->searchlen != searchlen || - anchor->col != curs.col) { + !same_mp(anchor->curs.pos, curs.pos)) { struct search_anchor *a = xmalloc(sizeof(*a)); a->pos = pos; a->row = row; - a->col = curs.col; + a->start = start; + a->curs = curs; a->searchlen = searchlen; a->notfound = search_notfound; a->next = anchor;