commit 6ae927aba45eaabc24cc535242e73099286f1bab
parent 6e0a44553366051c6c0d52a04cbf7f0fc09232be
Author: ukai <ukai>
Date: Wed, 18 Dec 2002 16:33:19 +0000
[w3m-dev 03579] Re: clean up displayBuffer()
* display.c (displayBuffer): re calcTabPos() when force or image redraw
* main.c (_mark): force redraw
(reinit): redraw image
* search.c (backwardSearch): found_last
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat:
4 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,11 @@
+2002-12-19 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+
+ * [w3m-dev 03579] Re: clean up displayBuffer()
+ * display.c (displayBuffer): re calcTabPos() when force or image redraw
+ * main.c (_mark): force redraw
+ (reinit): redraw image
+ * search.c (backwardSearch): found_last
+
2002-12-19 Fumitoshi UKAI <ukai@debian.or.jp>
* main.c (DefaultAlarm): fix initialize value
diff --git a/display.c b/display.c
@@ -385,6 +385,8 @@ displayBuffer(Buffer *buf, int mode)
|| mouse_action.menu_str
#endif
) {
+ if (mode == B_FORCE_REDRAW || mode == B_REDRAW_IMAGE)
+ calcTabPos();
ny = LastTab->y + 2;
if (ny > LASTLINE)
ny = LASTLINE;
@@ -578,7 +580,6 @@ redrawNLine(Buffer *buf, int n)
TabBuffer *t;
int l;
- calcTabPos();
move(0, 0);
#ifdef USE_MOUSE
if (mouse_action.menu_str)
diff --git a/main.c b/main.c
@@ -2543,7 +2543,7 @@ _mark(void)
return;
l = Currentbuf->currentLine;
l->propBuf[Currentbuf->pos] ^= PE_MARK;
- displayBuffer(Currentbuf, B_NORMAL);
+ displayBuffer(Currentbuf, B_FORCE_REDRAW);
}
/* Go to next mark */
@@ -5609,7 +5609,7 @@ reinit()
#ifdef USE_MOUSE
if (!strcasecmp(resource, "MOUSE")) {
initMouseAction();
- displayBuffer(Currentbuf, B_NORMAL);
+ displayBuffer(Currentbuf, B_REDRAW_IMAGE);
return;
}
#endif
diff --git a/search.c b/search.c
@@ -189,7 +189,7 @@ forwardSearch(Buffer *buf, char *str)
int
backwardSearch(Buffer *buf, char *str)
{
- char *p, *q, *found, *first, *last;
+ char *p, *q, *found, *found_last, *first, *last;
Line *l, *begin;
int wrapped = FALSE;
int pos;
@@ -220,11 +220,14 @@ backwardSearch(Buffer *buf, char *str)
#endif
p = &l->lineBuf[pos];
found = NULL;
+ found_last = NULL;
q = l->lineBuf;
while (regexMatch(q, &l->lineBuf[l->len] - q, q == l->lineBuf) == 1) {
matchedPosition(&first, &last);
- if (first <= p)
+ if (first <= p) {
found = first;
+ found_last = last;
+ }
#ifdef JP_CHARSET
if (l->propBuf[q - l->lineBuf] & PC_KANJI1)
q += 2;
@@ -237,7 +240,7 @@ backwardSearch(Buffer *buf, char *str)
if (found) {
buf->pos = found - l->lineBuf;
arrangeCursor(buf);
- set_mark(l, buf->pos, last - l->lineBuf);
+ set_mark(l, buf->pos, found_last - l->lineBuf);
return SR_FOUND;
}
}
@@ -252,14 +255,17 @@ backwardSearch(Buffer *buf, char *str)
}
}
found = NULL;
+ found_last = NULL;
q = l->lineBuf;
while (regexMatch(q, &l->lineBuf[l->len] - q, q == l->lineBuf) == 1) {
matchedPosition(&first, &last);
if (wrapped && l == begin && buf->pos == first - l->lineBuf)
/* exactly same match */
;
- else
+ else {
found = first;
+ found_last = last;
+ }
#ifdef JP_CHARSET
if (l->propBuf[q - l->lineBuf] & PC_KANJI1)
q += 2;
@@ -272,7 +278,7 @@ backwardSearch(Buffer *buf, char *str)
buf->currentLine = l;
gotoLine(buf, l->linenumber);
arrangeCursor(buf);
- set_mark(l, buf->pos, last - l->lineBuf);
+ set_mark(l, buf->pos, found_last - l->lineBuf);
return SR_FOUND | (wrapped ? SR_WRAPPED : 0);
}
if (wrapped && l == begin) /* no match */