[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>
This commit is contained in:
Fumitoshi UKAI
2002-12-18 16:33:19 +00:00
parent 4922417449
commit 22fc4c640a
4 changed files with 27 additions and 12 deletions

View File

@@ -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> 2002-12-19 Fumitoshi UKAI <ukai@debian.or.jp>
* main.c (DefaultAlarm): fix initialize value * main.c (DefaultAlarm): fix initialize value
@@ -5926,4 +5934,4 @@ a * [w3m-dev 03276] compile error on EWS4800
* release-0-2-1 * release-0-2-1
* import w3m-0.2.1 * import w3m-0.2.1
$Id: ChangeLog,v 1.629 2002/12/18 16:25:47 ukai Exp $ $Id: ChangeLog,v 1.630 2002/12/18 16:33:19 ukai Exp $

View File

@@ -1,4 +1,4 @@
/* $Id: display.c,v 1.47 2002/12/14 15:26:44 ukai Exp $ */ /* $Id: display.c,v 1.48 2002/12/18 16:33:19 ukai Exp $ */
#include <signal.h> #include <signal.h>
#include "fm.h" #include "fm.h"
@@ -385,6 +385,8 @@ displayBuffer(Buffer *buf, int mode)
|| mouse_action.menu_str || mouse_action.menu_str
#endif #endif
) { ) {
if (mode == B_FORCE_REDRAW || mode == B_REDRAW_IMAGE)
calcTabPos();
ny = LastTab->y + 2; ny = LastTab->y + 2;
if (ny > LASTLINE) if (ny > LASTLINE)
ny = LASTLINE; ny = LASTLINE;
@@ -578,7 +580,6 @@ redrawNLine(Buffer *buf, int n)
TabBuffer *t; TabBuffer *t;
int l; int l;
calcTabPos();
move(0, 0); move(0, 0);
#ifdef USE_MOUSE #ifdef USE_MOUSE
if (mouse_action.menu_str) if (mouse_action.menu_str)

6
main.c
View File

@@ -1,4 +1,4 @@
/* $Id: main.c,v 1.172 2002/12/18 16:25:47 ukai Exp $ */ /* $Id: main.c,v 1.173 2002/12/18 16:33:19 ukai Exp $ */
#define MAINPROGRAM #define MAINPROGRAM
#include "fm.h" #include "fm.h"
#include <signal.h> #include <signal.h>
@@ -2543,7 +2543,7 @@ _mark(void)
return; return;
l = Currentbuf->currentLine; l = Currentbuf->currentLine;
l->propBuf[Currentbuf->pos] ^= PE_MARK; l->propBuf[Currentbuf->pos] ^= PE_MARK;
displayBuffer(Currentbuf, B_NORMAL); displayBuffer(Currentbuf, B_FORCE_REDRAW);
} }
/* Go to next mark */ /* Go to next mark */
@@ -5609,7 +5609,7 @@ reinit()
#ifdef USE_MOUSE #ifdef USE_MOUSE
if (!strcasecmp(resource, "MOUSE")) { if (!strcasecmp(resource, "MOUSE")) {
initMouseAction(); initMouseAction();
displayBuffer(Currentbuf, B_NORMAL); displayBuffer(Currentbuf, B_REDRAW_IMAGE);
return; return;
} }
#endif #endif

View File

@@ -1,4 +1,4 @@
/* $Id: search.c,v 1.22 2002/11/24 16:02:22 ukai Exp $ */ /* $Id: search.c,v 1.23 2002/12/18 16:33:19 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include "regex.h" #include "regex.h"
#include <signal.h> #include <signal.h>
@@ -189,7 +189,7 @@ forwardSearch(Buffer *buf, char *str)
int int
backwardSearch(Buffer *buf, char *str) backwardSearch(Buffer *buf, char *str)
{ {
char *p, *q, *found, *first, *last; char *p, *q, *found, *found_last, *first, *last;
Line *l, *begin; Line *l, *begin;
int wrapped = FALSE; int wrapped = FALSE;
int pos; int pos;
@@ -220,11 +220,14 @@ backwardSearch(Buffer *buf, char *str)
#endif #endif
p = &l->lineBuf[pos]; p = &l->lineBuf[pos];
found = NULL; found = NULL;
found_last = NULL;
q = l->lineBuf; q = l->lineBuf;
while (regexMatch(q, &l->lineBuf[l->len] - q, q == l->lineBuf) == 1) { while (regexMatch(q, &l->lineBuf[l->len] - q, q == l->lineBuf) == 1) {
matchedPosition(&first, &last); matchedPosition(&first, &last);
if (first <= p) if (first <= p) {
found = first; found = first;
found_last = last;
}
#ifdef JP_CHARSET #ifdef JP_CHARSET
if (l->propBuf[q - l->lineBuf] & PC_KANJI1) if (l->propBuf[q - l->lineBuf] & PC_KANJI1)
q += 2; q += 2;
@@ -237,7 +240,7 @@ backwardSearch(Buffer *buf, char *str)
if (found) { if (found) {
buf->pos = found - l->lineBuf; buf->pos = found - l->lineBuf;
arrangeCursor(buf); arrangeCursor(buf);
set_mark(l, buf->pos, last - l->lineBuf); set_mark(l, buf->pos, found_last - l->lineBuf);
return SR_FOUND; return SR_FOUND;
} }
} }
@@ -252,14 +255,17 @@ backwardSearch(Buffer *buf, char *str)
} }
} }
found = NULL; found = NULL;
found_last = NULL;
q = l->lineBuf; q = l->lineBuf;
while (regexMatch(q, &l->lineBuf[l->len] - q, q == l->lineBuf) == 1) { while (regexMatch(q, &l->lineBuf[l->len] - q, q == l->lineBuf) == 1) {
matchedPosition(&first, &last); matchedPosition(&first, &last);
if (wrapped && l == begin && buf->pos == first - l->lineBuf) if (wrapped && l == begin && buf->pos == first - l->lineBuf)
/* exactly same match */ /* exactly same match */
; ;
else else {
found = first; found = first;
found_last = last;
}
#ifdef JP_CHARSET #ifdef JP_CHARSET
if (l->propBuf[q - l->lineBuf] & PC_KANJI1) if (l->propBuf[q - l->lineBuf] & PC_KANJI1)
q += 2; q += 2;
@@ -272,7 +278,7 @@ backwardSearch(Buffer *buf, char *str)
buf->currentLine = l; buf->currentLine = l;
gotoLine(buf, l->linenumber); gotoLine(buf, l->linenumber);
arrangeCursor(buf); 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); return SR_FOUND | (wrapped ? SR_WRAPPED : 0);
} }
if (wrapped && l == begin) /* no match */ if (wrapped && l == begin) /* no match */