aboutsummaryrefslogtreecommitdiffstats
path: root/search.c
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2002-01-16 15:37:06 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2002-01-16 15:37:06 +0000
commit6877847e22c000400d90023c6575022659fae6a6 (patch)
treeee6ddc1dfcb2f6525f5bff7962a4ea6e0651bb6a /search.c
parent[w3m-dev 02851] (diff)
downloadw3m-6877847e22c000400d90023c6575022659fae6a6.tar.gz
w3m-6877847e22c000400d90023c6575022659fae6a6.zip
[w3m-dev 02854] highlight for incremental search
* display.c (EFFECT_MARK_START): added * display.c (EFFECT_MARK_END): added * display.c (EFFECT_MARK_START_C): added * display.c (EFFECT_MARK_END_C): added * display.c (EFFECT_MARK_START_M): added * display.c (EFFECT_MARK_END_M): added * display.c: define_effect for MARK_{START,END} * display.c (mark_mode): added * display.c (redrawLine): if mark_mode * display.c (do_effects): do_effect2(PE_MARK, ...) * display.c (do_effects): do_effect1(PE_MARK, ...) * fm.h (P_EFFECT): changed to 0x01ff * fm.h (PE_MARK): moved * fm.h (mark_color): added * linein.c (inputLineHistSearch): incrfunc(int ch, Str str) * main.c (clear_mark): added * main.c (dispincsrch): remove arg `x', `y' * main.c (dispincsrch): move SAVE_BUFPOSITION() * main.c (srch): if (result & SR_FOUND) clear_mark() * main.c (cmd_mark): PE_MARK * main.c (nextMk): s/PM_MARK/PE_MARK/ * main.c (prevMk): s/PM_MARK/PE_MARK/ * proto.h (inputLineHistSearch): change prototype incfunc() * rc.c (CMT_MARK_COLOR): added * rc.c (params2): add "mark_color" * search.c (set_mark): added * search.c (forwardSearch): use set_mark() * search.c (backwardSearch): use set_mark() From: Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to 'search.c')
-rw-r--r--search.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/search.c b/search.c
index c5a1829..f9874fe 100644
--- a/search.c
+++ b/search.c
@@ -1,7 +1,14 @@
-/* $Id: search.c,v 1.7 2002/01/11 03:00:16 ukai Exp $ */
+/* $Id: search.c,v 1.8 2002/01/16 15:37:07 ukai Exp $ */
#include "fm.h"
#include "regex.h"
+static void
+set_mark(Line *l, int pos, int epos)
+{
+ for (; pos < epos && pos < l->len; pos++)
+ l->propBuf[pos] |= PE_MARK;
+}
+
int
forwardSearch(Buffer *buf, char *str)
{
@@ -27,6 +34,7 @@ forwardSearch(Buffer *buf, char *str)
matchedPosition(&first, &last);
buf->pos = first - l->lineBuf;
arrangeCursor(buf);
+ set_mark(l, buf->pos, last - l->lineBuf);
return SR_FOUND;
}
for (l = l->next;; l = l->next) {
@@ -60,6 +68,7 @@ forwardSearch(Buffer *buf, char *str)
buf->currentLine = l;
gotoLine(buf, l->linenumber);
arrangeCursor(buf);
+ set_mark(l, buf->pos, last - l->lineBuf);
return SR_FOUND | (wrapped ? SR_WRAPPED : 0);
}
if (wrapped && l == begin) /* no match */
@@ -109,6 +118,7 @@ backwardSearch(Buffer *buf, char *str)
if (found) {
buf->pos = found - l->lineBuf;
arrangeCursor(buf);
+ set_mark(l, buf->pos, last - l->lineBuf);
return SR_FOUND;
}
}
@@ -143,6 +153,7 @@ backwardSearch(Buffer *buf, char *str)
buf->currentLine = l;
gotoLine(buf, l->linenumber);
arrangeCursor(buf);
+ set_mark(l, buf->pos, last - l->lineBuf);
return SR_FOUND | (wrapped ? SR_WRAPPED : 0);
}
if (wrapped && l == begin) /* no match */