diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-11-08 15:54:46 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-11-08 15:54:46 +0000 |
commit | 885e5cad27e126f6761eefd0d460e0b374d2e4d1 (patch) | |
tree | 0fc77f170b704bef8c43ab180a17b42a2687c80a | |
parent | [w3m-dev 03386] Re: Interrupt in no_proxy_check() (diff) | |
download | w3m-885e5cad27e126f6761eefd0d460e0b374d2e4d1.tar.gz w3m-885e5cad27e126f6761eefd0d460e0b374d2e4d1.zip |
[w3m-dev 03387] Re: tab browser
* buffer.c (newBuffer): buf->LINES initialize
(gotoLine): use buf->LINES
(gotoRealLine): use buf->LINES
* display.c (displayBuffer): check by buf->LINES
(redrawNLine): buf->LINES
(redrawLine): buf->LINES
(redrawLineImage): no need buf->rootY
(cursorDown): buf->LINES
(arrangeCursor): buf->LINES
* etc.c (columnSkip): buf->LINES
(lineSkip): buf->LINES
(currentLineSkip): buf->LINES
* fm.h (Buffer): add LINES
* main.c (nscroll): Currentbuf->LINES
(pgFore): Currentbuf->LINES
(pgBack): Currentbuf->LINES
(ctrCsrV): Currentbuf->LINES
(movD): Currentbuf->LINES
(movU): Currentbuf->LINES
(_goLine): Currentbuf->LINES
(drawAnchorCursor): Currentbuf->LINES
(setOpt): B_REDRAW_IMAGE
(newT): B_REDRAW_IMAGE
(closeT): B_REDRAW_IMAGE
(nextT): B_REDRAW_IMAGE
(prevT): B_REDRAW_IMAGE
(moveTab): B_NORMAL
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to '')
-rw-r--r-- | ChangeLog | 33 | ||||
-rw-r--r-- | buffer.c | 17 | ||||
-rw-r--r-- | display.c | 43 | ||||
-rw-r--r-- | etc.c | 9 | ||||
-rw-r--r-- | fm.h | 3 | ||||
-rw-r--r-- | main.c | 42 |
6 files changed, 87 insertions, 60 deletions
@@ -1,5 +1,36 @@ 2002-11-09 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + * [w3m-dev 03387] Re: tab browser + * buffer.c (newBuffer): buf->LINES initialize + (gotoLine): use buf->LINES + (gotoRealLine): use buf->LINES + * display.c (displayBuffer): check by buf->LINES + (redrawNLine): buf->LINES + (redrawLine): buf->LINES + (redrawLineImage): no need buf->rootY + (cursorDown): buf->LINES + (arrangeCursor): buf->LINES + * etc.c (columnSkip): buf->LINES + (lineSkip): buf->LINES + (currentLineSkip): buf->LINES + * fm.h (Buffer): add LINES + * main.c (nscroll): Currentbuf->LINES + (pgFore): Currentbuf->LINES + (pgBack): Currentbuf->LINES + (ctrCsrV): Currentbuf->LINES + (movD): Currentbuf->LINES + (movU): Currentbuf->LINES + (_goLine): Currentbuf->LINES + (drawAnchorCursor): Currentbuf->LINES + (setOpt): B_REDRAW_IMAGE + (newT): B_REDRAW_IMAGE + (closeT): B_REDRAW_IMAGE + (nextT): B_REDRAW_IMAGE + (prevT): B_REDRAW_IMAGE + (moveTab): B_NORMAL + +2002-11-09 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + * [w3m-dev 03386] Re: Interrupt in no_proxy_check() * file.c (getAuthCookie): term_cbreak() (loadGeneralFile): term_cbreak() @@ -4387,4 +4418,4 @@ a * [w3m-dev 03276] compile error on EWS4800 * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.485 2002/11/08 15:46:05 ukai Exp $ +$Id: ChangeLog,v 1.486 2002/11/08 15:54:46 ukai Exp $ @@ -1,4 +1,4 @@ -/* $Id: buffer.c,v 1.13 2002/03/15 19:02:40 ukai Exp $ */ +/* $Id: buffer.c,v 1.14 2002/11/08 15:54:46 ukai Exp $ */ #include "fm.h" #ifdef USE_MOUSE @@ -32,6 +32,7 @@ newBuffer(int width) bzero((void *)n, sizeof(Buffer)); n->width = width; n->COLS = COLS; + n->LINES = LASTLINE; n->currentURL.scheme = SCM_UNKNOWN; n->baseURL = NULL; n->baseTarget = NULL; @@ -252,15 +253,16 @@ gotoLine(Buffer *buf, int n) sprintf(msg, "Last line is #%ld", buf->lastLine->linenumber); set_delayed_message(msg); buf->currentLine = l; - buf->topLine = lineSkip(buf, buf->currentLine, -(LASTLINE - 1), FALSE); + buf->topLine = lineSkip(buf, buf->currentLine, -(buf->LINES - 1), + FALSE); return; } for (; l != NULL; l = l->next) { if (l->linenumber >= n) { buf->currentLine = l; if (n < buf->topLine->linenumber || - buf->topLine->linenumber + LASTLINE <= n) - buf->topLine = lineSkip(buf, l, -(LASTLINE + 1) / 2, FALSE); + buf->topLine->linenumber + buf->LINES <= n) + buf->topLine = lineSkip(buf, l, -(buf->LINES + 1) / 2, FALSE); break; } } @@ -294,15 +296,16 @@ gotoRealLine(Buffer *buf, int n) sprintf(msg, "Last line is #%ld", buf->lastLine->real_linenumber); set_delayed_message(msg); buf->currentLine = l; - buf->topLine = lineSkip(buf, buf->currentLine, -(LASTLINE - 1), FALSE); + buf->topLine = lineSkip(buf, buf->currentLine, -(buf->LINES - 1), + FALSE); return; } for (; l != NULL; l = l->next) { if (l->real_linenumber >= n) { buf->currentLine = l; if (n < buf->topLine->real_linenumber || - buf->topLine->real_linenumber + LASTLINE <= n) - buf->topLine = lineSkip(buf, l, -(LASTLINE + 1) / 2, FALSE); + buf->topLine->real_linenumber + buf->LINES <= n) + buf->topLine = lineSkip(buf, l, -(buf->LINES + 1) / 2, FALSE); break; } } @@ -1,4 +1,4 @@ -/* $Id: display.c,v 1.28 2002/11/06 03:19:30 ukai Exp $ */ +/* $Id: display.c,v 1.29 2002/11/08 15:54:47 ukai Exp $ */ #include <signal.h> #include "fm.h" @@ -254,16 +254,18 @@ displayBuffer(Buffer *buf, int mode) else buf->rootX = 0; buf->COLS = COLS - buf->rootX; - if (nTab > 1) + if (nTab > 1) { ny = (nTab - 1) / N_TAB + 2; - if (buf->rootY != ny) { + if (ny > LASTLINE) + ny = LASTLINE; + } + if (buf->rootY != ny || buf->LINES != LASTLINE - ny) { buf->rootY = ny; + buf->LINES = LASTLINE - ny; arrangeCursor(buf); + mode = B_REDRAW_IMAGE; } - if (mode == B_FORCE_REDRAW || mode == B_SCROLL || -#ifdef USE_IMAGE - mode == B_REDRAW_IMAGE || -#endif + if (mode == B_FORCE_REDRAW || mode == B_SCROLL || mode == B_REDRAW_IMAGE || cline != buf->topLine || ccolumn != buf->currentColumn) { if ( #ifdef USE_IMAGE @@ -271,15 +273,15 @@ displayBuffer(Buffer *buf, int mode) #endif mode == B_SCROLL && cline && buf->currentColumn == ccolumn) { int n = buf->topLine->linenumber - cline->linenumber; - if (n > 0 && n < LASTLINE) { + if (n > 0 && n < buf->LINES) { move(LASTLINE, 0); clrtoeolx(); refresh(); scroll(n); } - else if (n < 0 && n > -LASTLINE) { + else if (n < 0 && n > -buf->LINES) { #if defined(__CYGWIN__) && LANG == JA - move(LASTLINE + n + 1, 0); + move(buf->LINES + n + 1, 0); clrtoeolx(); refresh(); #endif /* defined(__CYGWIN__) && LANG == JA */ @@ -468,9 +470,9 @@ redrawNLine(Buffer *buf, int n) for (i = 0; i < COLS; i++) addch('~'); } - for (i = buf->rootY, l = buf->topLine; i < LASTLINE; i++) { - if (i >= LASTLINE - n || (i - buf->rootY) < -n) - l0 = redrawLine(buf, l, i); + for (i = 0, l = buf->topLine; i < buf->LINES; i++) { + if (i >= buf->LINES - n || i < -n) + l0 = redrawLine(buf, l, i + buf->rootY); else { l0 = (l) ? l->next : NULL; } @@ -485,9 +487,9 @@ redrawNLine(Buffer *buf, int n) if (!(activeImage && displayImage && buf->img)) return; move(buf->cursorY + buf->rootY, buf->cursorX + buf->rootX); - for (i = 0, l = buf->topLine; i < LASTLINE; i++) { - if (i >= LASTLINE - n || i < -n) - l0 = redrawLineImage(buf, l, i); + for (i = 0, l = buf->topLine; i < buf->LINES; i++) { + if (i >= buf->LINES - n || i < -n) + l0 = redrawLineImage(buf, l, i + buf->rootY); else { l0 = (l) ? l->next : NULL; } @@ -519,7 +521,7 @@ redrawLine(Buffer *buf, Line *l, int i) if (l == NULL) { if (buf->pagerSource) { - l = getNextPage(buf, LASTLINE - i); + l = getNextPage(buf, buf->LINES - i); if (l == NULL) return NULL; } @@ -706,7 +708,7 @@ redrawLineImage(Buffer *buf, Line *l, int i) buf->need_reshape = TRUE; } x = (int)((rcol - column + buf->rootX) * pixel_per_char); - y = (int)((i + buf->rootY) * pixel_per_line); + y = (int)(i * pixel_per_line); sx = (int)((rcol - COLPOS(l, a->start.pos)) * pixel_per_char); sy = (int)((l->linenumber - image->y) * pixel_per_line); if (sx == 0 && x + image->xoffset >= 0) @@ -1105,7 +1107,7 @@ cursorDown(Buffer *buf, int n) { if (buf->firstLine == NULL) return; - if (buf->cursorY + buf->rootY < LASTLINE - 1) + if (buf->cursorY < buf->LINES - 1) cursorUpDown(buf, 1); else { buf->topLine = lineSkip(buf, buf->topLine, n, FALSE); @@ -1220,8 +1222,7 @@ arrangeCursor(Buffer *buf) if (buf == NULL || buf->currentLine == NULL) return; /* Arrange line */ - if (buf->currentLine->linenumber - buf->topLine->linenumber >= LASTLINE - - buf->rootY + if (buf->currentLine->linenumber - buf->topLine->linenumber >= buf->LINES || buf->currentLine->linenumber < buf->topLine->linenumber) { /* * buf->topLine = buf->currentLine; @@ -1,4 +1,4 @@ -/* $Id: etc.c,v 1.36 2002/11/06 15:05:34 ukai Exp $ */ +/* $Id: etc.c,v 1.37 2002/11/08 15:54:47 ukai Exp $ */ #include "fm.h" #include <pwd.h> #include "myctype.h" @@ -42,7 +42,7 @@ columnSkip(Buffer *buf, int offset) { int i, maxColumn; int column = buf->currentColumn + offset; - int nlines = LASTLINE + 1 - buf->rootY; + int nlines = buf->LINES + 1; Line *l; maxColumn = 0; @@ -91,8 +91,7 @@ lineSkip(Buffer *buf, Line *line, int offset, int last) #ifdef NEXTPAGE_TOPLINE if (!nextpage_topline) #endif - for (i = (LASTLINE - 1 - buf->rootY) - (buf->lastLine->linenumber - - l->linenumber); + for (i = buf->LINES - 1 - (buf->lastLine->linenumber - l->linenumber); i > 0 && l->prev != NULL; i--, l = l->prev) ; return l; } @@ -104,7 +103,7 @@ currentLineSkip(Buffer *buf, Line *line, int offset, int last) Line *l = line; if (buf->pagerSource && !(buf->bufferprop & BP_CLOSE)) { - n = line->linenumber + offset + LASTLINE - buf->rootY; + n = line->linenumber + offset + buf->LINES; if (buf->lastLine->linenumber < n) getNextPage(buf, n - buf->lastLine->linenumber); while ((last || (buf->lastLine->linenumber < n)) && @@ -1,4 +1,4 @@ -/* $Id: fm.h,v 1.71 2002/11/06 15:07:40 ukai Exp $ */ +/* $Id: fm.h,v 1.72 2002/11/08 15:54:47 ukai Exp $ */ /* * w3m: WWW wo Miru utility * @@ -406,6 +406,7 @@ typedef struct _Buffer { short rootX; short rootY; short COLS; + short LINES; InputStream pagerSource; AnchorList *href; AnchorList *name; @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.120 2002/11/06 03:27:04 ukai Exp $ */ +/* $Id: main.c,v 1.121 2002/11/08 15:54:47 ukai Exp $ */ #define MAINPROGRAM #include "fm.h" #include <signal.h> @@ -1307,8 +1307,7 @@ nscroll(int n, int mode) } else { tlnum = Currentbuf->topLine->linenumber; - llnum = Currentbuf->topLine->linenumber + LASTLINE - Currentbuf->rootY - - 1; + llnum = Currentbuf->topLine->linenumber + Currentbuf->LINES - 1; #ifdef NEXTPAGE_TOPLINE if (nextpage_topline) diff_n = 0; @@ -1331,12 +1330,11 @@ pgFore(void) { #ifdef VI_PREC_NUM if (vi_prec_num) - nscroll(searchKeyNum() * (LASTLINE - Currentbuf->rootY - 1), B_NORMAL); + nscroll(searchKeyNum() * (Currentbuf->LINES - 1), B_NORMAL); else #endif nscroll(prec_num ? searchKeyNum() : searchKeyNum() - * (LASTLINE - Currentbuf->rootY - 1), - prec_num ? B_SCROLL : B_NORMAL); + * (Currentbuf->LINES - 1), prec_num ? B_SCROLL : B_NORMAL); } /* Move page backward */ @@ -1345,13 +1343,11 @@ pgBack(void) { #ifdef VI_PREC_NUM if (vi_prec_num) - nscroll(-searchKeyNum() * (LASTLINE - Currentbuf->rootY - 1), - B_NORMAL); + nscroll(-searchKeyNum() * (Currentbuf->LINES - 1), B_NORMAL); else #endif nscroll(-(prec_num ? searchKeyNum() : searchKeyNum() - * (LASTLINE - Currentbuf->rootY - 1)), - prec_num ? B_SCROLL : B_NORMAL); + * (Currentbuf->LINES - 1)), prec_num ? B_SCROLL : B_NORMAL); } /* 1 line up */ @@ -1375,7 +1371,7 @@ ctrCsrV(void) int offsety; if (Currentbuf->firstLine == NULL) return; - offsety = (LASTLINE - Currentbuf->rootY) / 2 - Currentbuf->cursorY; + offsety = Currentbuf->LINES / 2 - Currentbuf->cursorY; if (offsety != 0) { #if 0 Currentbuf->currentLine = lineSkip(Currentbuf, @@ -1969,7 +1965,7 @@ _movD(int n) void movD(void) { - _movD((LASTLINE - Currentbuf->rootY + 1) / 2); + _movD((Currentbuf->LINES + 1) / 2); } void @@ -1993,7 +1989,7 @@ _movU(int n) void movU(void) { - _movU((LASTLINE - Currentbuf->rootY + 1) / 2); + _movU((Currentbuf->LINES + 1) / 2); } void @@ -2284,7 +2280,7 @@ _goLine(char *l) else if (*l == '$') { Currentbuf->topLine = lineSkip(Currentbuf, Currentbuf->lastLine, - -(LASTLINE - Currentbuf->rootY + 1) / 2, TRUE); + -(Currentbuf->LINES + 1) / 2, TRUE); Currentbuf->currentLine = Currentbuf->lastLine; } else @@ -3285,7 +3281,7 @@ drawAnchorCursor(Buffer *buf) else hseq = -1; tline = buf->topLine->linenumber; - eline = tline + LASTLINE - buf->rootY; + eline = tline + buf->LINES; prevhseq = buf->hmarklist->prevhseq; drawAnchorCursor0(buf, hseq, prevhseq, tline, eline, 1); @@ -3918,11 +3914,7 @@ setOpt(void) } if (set_param_option(opt)) sync_with_option(); -#ifdef USE_IMAGE - if (activeImage) - displayBuffer(Currentbuf, B_REDRAW_IMAGE); -#endif - displayBuffer(Currentbuf, B_FORCE_REDRAW); + displayBuffer(Currentbuf, B_REDRAW_IMAGE); } /* error message list */ @@ -5418,7 +5410,7 @@ void newT(void) { _newT(); - displayBuffer(Currentbuf, B_FORCE_REDRAW); + displayBuffer(Currentbuf, B_REDRAW_IMAGE); } TabBuffer * @@ -5482,7 +5474,7 @@ closeT(void) tab = CurrentTab; if (tab) deleteTab(tab); - displayBuffer(Currentbuf, B_FORCE_REDRAW); + displayBuffer(Currentbuf, B_REDRAW_IMAGE); } void @@ -5498,7 +5490,7 @@ nextT(void) else CurrentTab = FirstTab; } - displayBuffer(Currentbuf, B_FORCE_REDRAW); + displayBuffer(Currentbuf, B_REDRAW_IMAGE); } void @@ -5514,7 +5506,7 @@ prevT(void) else CurrentTab = LastTab; } - displayBuffer(Currentbuf, B_FORCE_REDRAW); + displayBuffer(Currentbuf, B_REDRAW_IMAGE); } void @@ -5656,7 +5648,7 @@ moveTab(TabBuffer * t, TabBuffer * t2, int right) FirstTab = t; t2->prevTab = t; } - displayBuffer(Currentbuf, B_FORCE_REDRAW); + displayBuffer(Currentbuf, B_NORMAL); } void |