summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjell Wooding <kjell@cvs.openbsd.org>2006-11-18 22:46:17 +0000
committerKjell Wooding <kjell@cvs.openbsd.org>2006-11-18 22:46:17 +0000
commit48d70e184ce809b7fe79cb52ff12704d22b569cb (patch)
tree31ae7a8f4e690c6323f400e637e174c363e0a29c
parentf16e985d6f6f2ddf981b1c39db7c7add2693d150 (diff)
1. Fix line numbering/mark line bug in isearch.
To reproduce, set mark, move, isearch, then swap mark and point. 2. store mark in save structure (to reproduce search on a pattern twice, then backspace to back up the search stack) Both from Peter De Wachter (debian bug#391827) Thanks!
-rw-r--r--usr.bin/mg/search.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/usr.bin/mg/search.c b/usr.bin/mg/search.c
index b3d18401c9e..8b4713e0c1c 100644
--- a/usr.bin/mg/search.c
+++ b/usr.bin/mg/search.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: search.c,v 1.33 2006/11/17 03:24:31 kjell Exp $ */
+/* $OpenBSD: search.c,v 1.34 2006/11/18 22:46:16 kjell Exp $ */
/* This file is in the public domain. */
@@ -26,9 +26,10 @@
#define SRCH_MARK (-5)
struct srchcom {
- int s_code;
+ int s_code;
struct line *s_dotp;
- int s_doto;
+ int s_doto;
+ int s_dotline;
};
static int isearch(int);
@@ -202,6 +203,7 @@ isearch(int dir)
srch_lastdir = dir;
curwp->w_markp = clp;
curwp->w_marko = cbo;
+ curwp->w_markline = cdotline;
ewprintf("Mark set");
return (TRUE);
case CCHR('G'):
@@ -346,6 +348,7 @@ isearch(int dir)
ungetkey(c);
curwp->w_markp = clp;
curwp->w_marko = cbo;
+ curwp->w_markline = cdotline;
ewprintf("Mark set");
curwp->w_flag |= WFMOVE;
return (TRUE);
@@ -400,6 +403,7 @@ is_lpush(void)
cmds[ctp].s_code = SRCH_NOPR;
cmds[ctp].s_doto = curwp->w_doto;
cmds[ctp].s_dotp = curwp->w_dotp;
+ cmds[ctp].s_dotline = curwp->w_dotline;
}
static void
@@ -408,6 +412,7 @@ is_pop(void)
if (cmds[cip].s_code != SRCH_NOPR) {
curwp->w_doto = cmds[cip].s_doto;
curwp->w_dotp = cmds[cip].s_dotp;
+ curwp->w_dotline = cmds[cip].s_dotline;
curwp->w_flag |= WFMOVE;
cmds[cip].s_code = SRCH_NOPR;
}
@@ -458,11 +463,12 @@ is_undo(int *pptr, int *dir)
static int
is_find(int dir)
{
- int plen, odoto;
+ int plen, odoto, odotline;
struct line *odotp;
odoto = curwp->w_doto;
odotp = curwp->w_dotp;
+ odotline = curwp->w_dotline;
plen = strlen(pat);
if (plen != 0) {
if (dir == SRCH_FORW) {
@@ -470,6 +476,7 @@ is_find(int dir)
if (forwsrch() == FALSE) {
curwp->w_doto = odoto;
curwp->w_dotp = odotp;
+ curwp->w_dotline = odotline;
return (FALSE);
}
return (TRUE);
@@ -479,6 +486,7 @@ is_find(int dir)
if (backsrch() == FALSE) {
curwp->w_doto = odoto;
curwp->w_dotp = odotp;
+ curwp->w_dotline = odotline;
return (FALSE);
}
return (TRUE);