diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2003-01-30 16:39:29 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2003-01-30 16:39:29 +0000 |
commit | 0c0438352c1677443670f1348ddc4c014e4a3ffa (patch) | |
tree | 5ca48b97eeea65f7b12ab1b21842b60c702f18f2 | |
parent | [w3m-dev 03717] print newline before exec shell command. (diff) | |
download | w3m-0c0438352c1677443670f1348ddc4c014e4a3ffa.tar.gz w3m-0c0438352c1677443670f1348ddc4c014e4a3ffa.zip |
[w3m-dev 03718] Too slow when loading big file with fold_line=1
* etc.c (nextColumn): added
(calcPosition): use New_N
rewrite with nextColumn
(columnLen): added
* file.c (addnewline): rewrite with columnLen
* proto.h (columnLen): added
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to '')
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | etc.c | 51 | ||||
-rw-r--r-- | file.c | 22 | ||||
-rw-r--r-- | proto.h | 3 |
4 files changed, 54 insertions, 34 deletions
@@ -1,5 +1,15 @@ 2003-01-31 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + * [w3m-dev 03718] Too slow when loading big file with fold_line=1 + * etc.c (nextColumn): added + (calcPosition): use New_N + rewrite with nextColumn + (columnLen): added + * file.c (addnewline): rewrite with columnLen + * proto.h (columnLen): added + +2003-01-31 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + * [w3m-dev 03717] print newline before exec shell command. * main.c (execsh): print newline @@ -6975,4 +6985,4 @@ a * [w3m-dev 03276] compile error on EWS4800 * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.730 2003/01/30 16:35:34 ukai Exp $ +$Id: ChangeLog,v 1.731 2003/01/30 16:39:29 ukai Exp $ @@ -1,4 +1,4 @@ -/* $Id: etc.c,v 1.61 2003/01/29 17:10:30 ukai Exp $ */ +/* $Id: etc.c,v 1.62 2003/01/30 16:39:34 ukai Exp $ */ #include "fm.h" #include <pwd.h> #include "myctype.h" @@ -478,6 +478,22 @@ checkType(Str s, Lineprop **oprop return s; } +static int +nextColumn(int n, char *p, Lineprop *pr) +{ + if (*p == '\t' && *pr == PC_CTRL) + return (n + Tabstop) / Tabstop * Tabstop; +#ifndef KANJI_SYMBOLS + else if (*pr & PC_RULE) + return n + 1; +#endif + else if (IS_UNPRINTABLE_ASCII(*p, *pr)) + return n + 4; + else if (IS_UNPRINTABLE_CONTROL(*p, *pr)) + return n + 2; + return n + 1; +} + int calcPosition(char *l, Lineprop *pr, int len, int pos, int bpos, int mode) { @@ -494,7 +510,7 @@ calcPosition(char *l, Lineprop *pr, int len, int pos, int bpos, int mode) } if (size < len + 1) { size = (len + 1 > LINELEN) ? (len + 1) : LINELEN; - realColumn = New_Reuse(int, realColumn, size); + realColumn = New_N(int, size); } prevl = l; j = bpos; @@ -502,24 +518,31 @@ calcPosition(char *l, Lineprop *pr, int len, int pos, int bpos, int mode) realColumn[i] = j; if (i == len) break; - if (l[i] == '\t' && pr[i] == PC_CTRL) - j = (j + Tabstop) / Tabstop * Tabstop; -#ifndef KANJI_SYMBOLS - else if (pr[i] & PC_RULE) - j++; -#endif - else if (IS_UNPRINTABLE_ASCII(l[i], pr[i])) - j = j + 4; - else if (IS_UNPRINTABLE_CONTROL(l[i], pr[i])) - j = j + 2; - else - j++; + j = nextColumn(j, &l[i], &pr[i]); } if (pos >= i) return j; return realColumn[pos]; } +int +columnLen(Line *line, int column) +{ + int i, j; + + for (i = 0, j = 0; i < line->len; i++) { + j = nextColumn(j, &line->lineBuf[i], &line->propBuf[i]); + if (j > column) { +#ifdef JP_CHARSET + if (CharType(line->propBuf[i]) == PC_KANJI2) + return i - 1; +#endif + return i; + } + } + return line->len; +} + char * lastFileName(char *path) { @@ -1,4 +1,4 @@ -/* $Id: file.c,v 1.215 2003/01/30 16:32:00 ukai Exp $ */ +/* $Id: file.c,v 1.216 2003/01/30 16:39:36 ukai Exp $ */ #include "fm.h" #include <sys/types.h> #include "myctype.h" @@ -6128,23 +6128,9 @@ addnewline(Buffer *buf, char *line, Lineprop *prop, bwidth = 0; while (1) { l = buf->currentLine; - l->width = COLPOS(l, l->len); l->bpos = bpos; l->bwidth = bwidth; - if (l->width <= width) - return; - i = columnPos(l, width); -#ifdef JP_CHARSET - if (CharType(p[i]) == PC_KANJI2) - i--; -#endif - if (i > 0 && COLPOS(l, i) > width) { - i--; -#ifdef JP_CHARSET - if (CharType(p[i]) == PC_KANJI2) - i--; -#endif - } + i = columnLen(l, width); if (i == 0) { i++; #ifdef JP_CHARSET @@ -6152,10 +6138,10 @@ addnewline(Buffer *buf, char *line, Lineprop *prop, i++; #endif } - if (i == l->len) - return; l->len = i; l->width = COLPOS(l, l->len); + if (pos <= i) + return; bpos += l->len; bwidth += l->width; s += i; @@ -1,4 +1,4 @@ -/* $Id: proto.h,v 1.86 2003/01/29 17:38:15 ukai Exp $ */ +/* $Id: proto.h,v 1.87 2003/01/30 16:39:40 ukai Exp $ */ /* * This file was automatically generated by version 1.7 of cextract. * Manual editing not recommended. @@ -302,6 +302,7 @@ extern void cursorXY(Buffer *buf, int x, int y); extern void restorePosition(Buffer *buf, Buffer *orig); extern int columnSkip(Buffer *buf, int offset); extern int columnPos(Line *line, int column); +extern int columnLen(Line *line, int column); extern Line *lineSkip(Buffer *buf, Line *line, int offset, int last); extern Line *currentLineSkip(Buffer *buf, Line *line, int offset, int last); extern int gethtmlcmd(char **s); |