diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2003-01-23 18:37:18 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2003-01-23 18:37:18 +0000 |
commit | 61c2c2de18d3ef19c321bac335043424c862aba7 (patch) | |
tree | 52b5d72b1c3298f7e12b72daabfff2b37eb37680 /etc.c | |
parent | * etc.c (next_status): after = is R_ST_VALUE (diff) | |
download | w3m-61c2c2de18d3ef19c321bac335043424c862aba7.tar.gz w3m-61c2c2de18d3ef19c321bac335043424c862aba7.zip |
[w3m-dev 03667] fold patch
* anchor.c (reAnchorPos): rewrite
(reAnchorWord): delete reseq_anchor()
(reAnchorAny): use l->size
delete reseq_anchor()
* backend.c (internal_get): pass TRUE to saveBuffer
* buffer.c (newBuffer): delete n->linelen
(reshapeBuffer): rewrite
* display.c (displayBuffer): FoldLine
(redrawLine): l->bpos
(cursorUp0): added
(cursorUp): rewrite
(cursorDown0): added
(cursowDown): rewrite
(cursorRight): check l->next
l->bwidth
(cursorLeft): l->prev && l->bpos
l->bwidth
(arrangeCursor): buf->currentLine->bwidth
buf->cursorX
* etc.c (checkType): **oporp
rewrite
(calcPosition): realColumn allocated by New_reuse
* file.c (addnewline): add nlines arg
(propBuffer): deleted
(colorBuffer): deleted
(readHeader): propBuffer
FOLD_BUFFER_WIDTH
(HTMLlineproc2body): rewrite
(addnewline2): added
(addnewline): rewrite
(loadBuffer): propBuffer, colorBuffer
(saveBuffer): cont arg
(getNextPage): rewrite
* fm.h (LINELEN): 256
(FNLEN): deleted
(Line): add size, bpos, bwidth
(Buffer): delete linelen
(INIT_BUFFER_WIDTH): check showLineNum
(FOLD_BUFFER_WIDTH): added
(FoldLine): added
* funcname.tab (RESHAPE): added
* main.c (do_dump): pass FALSE to saveBuffer
(nscroll): rewrite
(clear_mark): l->size
(shiftvisualpos): rewrite
(pipeBuf): pass TRUE to saveBuffer
(linebeg): check line->prev && line->bpos
(linend): check line->next, line->next->bpos
(editScr): pass TRUE to saveBuffer
(svBuf): pass TRUE to saveBuffer
(vmSrc): pass TRUE to saveBuffer
(reshape): added
(curlno): rewrite
* mimehead.c (LINELEN): deleted
* proto.h (reshape): added
(saveBuffer): add cont arg
(cursorUp0): added
(cursorDown0): added
(checkType): change type oprop, ocolor, delete check_color, len
* rc.c (CMT_FOLD_LINE): added
(params1): add fold_line
(sync_with_option): check PagerMax
* search.c (set_mark): l->size
(forwardSearch): rewrite
(backwardSearch): rewrite
* doc/README.func (RESHAPE): added
* doc-jp/README.func (RESHAPE): added
* scripts/w3mhelp.cgi.in (Buffer operation): add reshape
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to '')
-rw-r--r-- | etc.c | 56 |
1 files changed, 39 insertions, 17 deletions
@@ -1,4 +1,4 @@ -/* $Id: etc.c,v 1.57 2003/01/23 18:01:05 ukai Exp $ */ +/* $Id: etc.c,v 1.58 2003/01/23 18:37:20 ukai Exp $ */ #include "fm.h" #include <pwd.h> #include "myctype.h" @@ -236,50 +236,62 @@ parse_ansi_color(char **str, Lineprop *effect, Linecolor *color) */ Str -checkType(Str s, Lineprop *oprop, +checkType(Str s, Lineprop **oprop #ifdef USE_ANSI_COLOR - Linecolor *ocolor, int *check_color, + , Linecolor **ocolor #endif - int len) + ) { Lineprop mode; Lineprop effect = PE_NORMAL; - Lineprop *prop = oprop; + Lineprop *prop; + static Lineprop *prop_buffer = NULL; + static int prop_size = 0; char *str = s->ptr, *endp = &s->ptr[s->length], *bs = NULL; #ifdef USE_ANSI_COLOR Lineprop ceffect = PE_NORMAL; Linecolor cmode = 0; + int check_color = FALSE; Linecolor *color = NULL; + static Linecolor *color_buffer = NULL; + static int color_size = 0; char *es = NULL; #endif int do_copy = FALSE; - int size = (len < s->length) ? len : s->length; -#ifdef USE_ANSI_COLOR - if (check_color) - *check_color = FALSE; -#endif + if (prop_size < s->length) { + prop_size = (s->length > LINELEN) ? s->length : LINELEN; + prop_buffer = New_Reuse(Lineprop, prop_buffer, prop_size); + } + prop = prop_buffer; + if (ShowEffect) { bs = memchr(str, '\b', s->length); #ifdef USE_ANSI_COLOR if (ocolor) { es = memchr(str, ESC_CODE, s->length); - if (es) - color = ocolor; + if (es) { + if (color_size < s->length) { + color_size = (s->length > LINELEN) ? s->length : LINELEN; + color_buffer = New_Reuse(Linecolor, color_buffer, + color_size); + } + color = color_buffer; + } } #endif - if (s->length > size || (bs != NULL) + if ((bs != NULL) #ifdef USE_ANSI_COLOR || (es != NULL) #endif ) { - s = Strnew_size(size); + s = Strnew_size(s->length); do_copy = TRUE; } } while (str < endp) { - if (prop - oprop >= len) + if (prop - prop_buffer >= prop_size) break; if (bs != NULL) { if (str == bs - 2 && !strncmp(str, "__\b\b", 4)) { @@ -410,7 +422,7 @@ checkType(Str s, Lineprop *oprop, es = memchr(str, ESC_CODE, endp - str); if (ok) { if (cmode) - *check_color = TRUE; + check_color = TRUE; continue; } } @@ -458,13 +470,19 @@ checkType(Str s, Lineprop *oprop, } effect = PE_NORMAL; } + *oprop = prop_buffer; +#ifdef USE_ANSI_COLOR + if (ocolor) + *ocolor = check_color ? color_buffer : NULL; +#endif return s; } int calcPosition(char *l, Lineprop *pr, int len, int pos, int bpos, int mode) { - static short realColumn[LINELEN + 1]; + static short *realColumn = NULL; + static int size = 0; static char *prevl = NULL; int i, j; @@ -474,6 +492,10 @@ calcPosition(char *l, Lineprop *pr, int len, int pos, int bpos, int mode) if (pos <= len) return realColumn[pos]; } + if (size < len + 1) { + size = (len + 1 > LINELEN) ? (len + 1) : LINELEN; + realColumn = New_Reuse(short, realColumn, size); + } prevl = l; j = bpos; for (i = 0;; i++) { |