[w3m-dev 01602] Re: first body with -m (Re: w3m-m17n-0.7)

From: Hironori Sakamoto (h-saka@lsi.nec.co.jp)
Date: Wed Dec 27 2000 - 22:31:13 CST

  • Next message: Okabe Katsuya: "[w3m-dev 01603] Re: ANSI color support (was Re: w3m-m17n-0.4)"

    $B:dK\$G$9!#(B

    >> $B$d$^$F$G$9!#$9$G$K(Bless$B$+$i(Bw3m$B$X>h$j49$($F$$$^$9!#(B
    >> > $B:dK\$G$9!#(B
    >> > -E $B%*%W%7%g%s(B(exit at end-of-line)$BM_$7$/$J$$$G$9$+!)(B
    >> more$B$N:G=*9T$G>!<j$KH4$1$k5sF0$,Bg7y$$$J$N$G!"<+J,$OMW$i$J$$$G$9!#$^(B
    >> $B$:%a!<%k$r:G=*9T$^$GN.$7FI$_$9$k$H$-$KH4$1$F$7$^$&$N$,$+$C$?$k$/$F!#$`(B
    >> $B$7$m!"(Bexit without clear-screan$B$,$[$7$$$+$J!"$H$+!#6HL3>e!"$d$?$i9T$N(B

    $B$=$&$G$9$+!#(B
    # $B$^!";d$b%a!<%k$h$j$b(B alias ll "ls -l !* | w3m -E" $B$H$7$?$$$N$,Bg$-$$$7!#(B
    $B$?$@!"(B-X $B$@$1$@$H%9%/%m!<%k$GN.$l$F$7$^$&$N$,7y$J$s$G$9$h$M!#(B
    # $B@N!"2<DE$5$s$b$*$7$c$C$F$^$7$?$M!#(B

    $B$I$3$+$K!"(B
      buf->lastLine->linenumber - buf->topLine->linenumber < LASTLINE - 1
    $B$H$$$&G{$j$r2C$($k$H$$$$$N$+$J!#(B
    $B$H$$$&$o$1$G(B patch $B$r:n$C$F$_$?$N$G$9$,!"$A$g$C$H<+?.L5$7$G$9!#(B
    $B$J$*!"(BpgFore, pgBack $B$N%+!<%=%k0LCV$N@_Dj$r!"%9%/%m!<%k(B('J', 'K')
    $B$HF1$8F0:n$K$7$F$$$^$9!#$9$J$o$A(B $B!X?t(B SPC$B!Y$H!X?t(B J$B!Y(B $B$OF1$8!#(B
    vi $B$NF0:n$H$O$3$C$A$,9g$C$F$k$O$:$G$9$,!"$I$&$G$7$g$&!#(B
    # $B$3$&$7$J$$$H>e<j$/2r7h$G$-$J$+$C$?!D(B

    $B$D$$$G$K!"(Breload, edit $B;~$K%+!<%=%k0LCV$rJ]B8$9$k<BAu$r2~NI$7$F$$$^$9!#(B
    # $B$+$J$j(B"$B$^$7(B"$B$K$J$C$?$H;W$&$N$G$9$,!"<j85$N%^%7%s$,B.$9$.$FJ,$+$i$J$$!D!#(B
    -----------------------------------
    $B:dK\(B $B9@B'(B <hsaka@mth.biglobe.ne.jp>
     http://www2u.biglobe.ne.jp/~hsaka/

    --- main.c.orig Fri Dec 22 14:49:21 2000
    +++ main.c Thu Dec 28 13:24:46 2000
    @@ -865,54 +865,15 @@
     }
     #endif /* SIGWINCH */
     
    -static void
    -curHome(void)
    -{
    - Currentbuf->currentLine = Currentbuf->topLine;
    - Currentbuf->pos = columnPos(Currentbuf->topLine, Currentbuf->currentColumn);
    - cursorHome(Currentbuf);
    - displayBuffer(Currentbuf, B_NORMAL);
    -}
    -
     /*
      * Command functions: These functions are called with a keystroke.
      */
     
    -/* Move page forward */
    -void
    -pgFore(void)
    -{
    - int skip_linenum;
    - if (Currentbuf->firstLine == NULL)
    - return;
    -#ifdef VI_PREC_NUM
    - skip_linenum = PREC_NUM * (LASTLINE - 1);
    -#else /* not VI_PREC_NUM */
    - skip_linenum = prec_num ? prec_num : LASTLINE - 1;
    -#endif /* not VI_PREC_NUM */
    - Currentbuf->topLine = lineSkip(Currentbuf, Currentbuf->topLine, skip_linenum, FALSE);
    - curHome();
    -}
    -
    -/* Move page backward */
    -void
    -pgBack(void)
    -{
    - if (Currentbuf->firstLine == NULL)
    - return;
    -#ifdef VI_PREC_NUM
    - Currentbuf->topLine = lineSkip(Currentbuf, Currentbuf->topLine, PREC_NUM * (-LASTLINE + 1), FALSE);
    -#else /* not VI_PREC_NUM */
    - Currentbuf->topLine = lineSkip(Currentbuf, Currentbuf->topLine, prec_num ? -prec_num : -LASTLINE + 1, FALSE);
    -#endif /* not VI_PREC_NUM */
    - curHome();
    -}
    -
     #define MAX(a, b) ((a) > (b) ? (a) : (b))
     #define MIN(a, b) ((a) < (b) ? (a) : (b))
     
     static void
    -nscroll(int n)
    +nscroll(int n, int mode)
     {
         Line *curtop = Currentbuf->topLine;
         int lnum, tlnum, llnum;
    @@ -932,21 +893,45 @@
             lnum = llnum;
         gotoLine(Currentbuf, lnum);
         arrangeLine(Currentbuf);
    - displayBuffer(Currentbuf, B_SCROLL);
    + displayBuffer(Currentbuf, mode);
    +}
    +
    +/* Move page forward */
    +void
    +pgFore(void)
    +{
    +#ifdef VI_PREC_NUM
    + nscroll(PREC_NUM * (LASTLINE - 1), B_NORMAL);
    +#else /* not VI_PREC_NUM */
    + nscroll(prec_num ? prec_num : (LASTLINE - 1),
    + prec_num ? B_SCROLL : B_NORMAL);
    +#endif /* not VI_PREC_NUM */
    +}
    +
    +/* Move page backward */
    +void
    +pgBack(void)
    +{
    +#ifdef VI_PREC_NUM
    + nscroll(- PREC_NUM * (LASTLINE - 1), B_NORMAL);
    +#else /* not VI_PREC_NUM */
    + nscroll(- (prec_num ? prec_num : (LASTLINE - 1)),
    + prec_num ? B_SCROLL : B_NORMAL);
    +#endif /* not VI_PREC_NUM */
     }
     
     /* 1 line up */
     void
     lup1(void)
     {
    - nscroll(PREC_NUM);
    + nscroll(PREC_NUM, B_SCROLL);
     }
     
     /* 1 line down */
     void
     ldown1(void)
     {
    - nscroll(-PREC_NUM);
    + nscroll(-PREC_NUM, B_SCROLL);
     }
     
     /* move cursor position to the center of screen */
    @@ -1670,7 +1655,7 @@
     {
         char *fn = Currentbuf->filename;
         char *type = Currentbuf->type;
    - int linenum, cursorY, pos, currentColumn;
    + int top, linenum, cursorY, pos, currentColumn;
         Buffer *buf, *fbuf = NULL;
         Str cmd = Strnew();
     
    @@ -1687,10 +1672,13 @@
         }
         if (Currentbuf->frameset != NULL)
             fbuf = Currentbuf->linkBuffer[LB_FRAME];
    - if (Currentbuf->firstLine == NULL)
    + if (Currentbuf->firstLine == NULL) {
    + top = 1;
             linenum = 1;
    - else
    + } else {
    + top = Currentbuf->topLine->linenumber;
             linenum = Currentbuf->currentLine->linenumber;
    + }
         cursorY = Currentbuf->cursorY;
         pos = Currentbuf->pos;
         currentColumn = Currentbuf->currentColumn;
    @@ -1729,12 +1717,16 @@
             if (Currentbuf != buf)
                 Firstbuf = deleteBuffer(Firstbuf, buf);
         }
    + if (Currentbuf->firstLine == NULL) {
    + displayBuffer(Currentbuf, B_FORCE_REDRAW);
    + return;
    + }
    + Currentbuf->topLine = lineSkip(Currentbuf, Currentbuf->topLine, top - 1, FALSE);
         gotoLine(Currentbuf, linenum);
         Currentbuf->pos = pos;
         Currentbuf->currentColumn = currentColumn;
         arrangeCursor(Currentbuf);
    - displayBuffer(Currentbuf, B_NORMAL);
    - nscroll(Currentbuf->cursorY - cursorY);
    + displayBuffer(Currentbuf, B_FORCE_REDRAW);
     }
     
     /* Run editor on the current screen */
    @@ -3184,7 +3176,7 @@
         Buffer *buf, *fbuf = NULL;
         char *type = Currentbuf->type;
         Str url;
    - int linenum, cursorY, pos, currentColumn;
    + int top, linenum, cursorY, pos, currentColumn;
         FormList *request;
         int multipart;
     
    @@ -3198,10 +3190,13 @@
             disp_message("Can't reload stdin", TRUE);
             return;
         }
    - if (Currentbuf->firstLine == NULL)
    + if (Currentbuf->firstLine == NULL) {
    + top = 1;
             linenum = 1;
    - else
    + } else {
    + top = Currentbuf->topLine->linenumber;
             linenum = Currentbuf->currentLine->linenumber;
    + }
         cursorY = Currentbuf->cursorY;
         pos = Currentbuf->pos;
         currentColumn = Currentbuf->currentColumn;
    @@ -3225,7 +3220,13 @@
             buf->linkBuffer[LB_N_FRAME] = fbuf;
             pushBuffer(buf);
             Currentbuf = buf;
    + if (Currentbuf->firstLine == NULL) {
    + displayBuffer(Currentbuf, B_FORCE_REDRAW);
    + return;
    + }
             gotoLine(Currentbuf, linenum);
    + Currentbuf->pos = pos;
    + Currentbuf->currentColumn = currentColumn;
             arrangeCursor(Currentbuf);
             displayBuffer(Currentbuf, B_FORCE_REDRAW);
             return;
    @@ -3274,12 +3275,16 @@
             if (Currentbuf != buf)
                 Firstbuf = deleteBuffer(Firstbuf, buf);
         }
    + if (Currentbuf->firstLine == NULL) {
    + displayBuffer(Currentbuf, B_FORCE_REDRAW);
    + return;
    + }
    + Currentbuf->topLine = lineSkip(Currentbuf, Currentbuf->topLine, top - 1, FALSE);
         gotoLine(Currentbuf, linenum);
         Currentbuf->pos = pos;
         Currentbuf->currentColumn = currentColumn;
         arrangeCursor(Currentbuf);
    - displayBuffer(Currentbuf, B_NORMAL);
    - nscroll(Currentbuf->cursorY - cursorY);
    + displayBuffer(Currentbuf, B_FORCE_REDRAW);
     }
     
     /* mark URL-like patterns as anchors */
    --- etc.c.orig Thu Dec 28 11:41:04 2000
    +++ etc.c Thu Dec 28 11:41:44 2000
    @@ -118,6 +118,19 @@
     Line *
     lineSkip(Buffer * buf, Line * line, int offset, int last)
     {
    + int i;
    + Line *l;
    +
    + l = currentLineSkip(buf, line, offset, last);
    + for (i = (LASTLINE - 1) - (buf->lastLine->linenumber - l->linenumber);
    + i > 0 && l->prev != NULL;
    + i--, l = l->prev);
    + return l;
    +}
    +
    +Line *
    +currentLineSkip(Buffer * buf, Line * line, int offset, int last)
    +{
         int i, n;
         Line *l = line;
     
    --- display.c.orig Thu Dec 28 11:41:24 2000
    +++ display.c Thu Dec 28 11:33:18 2000
    @@ -736,7 +736,7 @@
     
         if (buf->firstLine == NULL)
             return;
    - if ((buf->currentLine = lineSkip(buf, cl, n, FALSE)) == cl)
    + if ((buf->currentLine = currentLineSkip(buf, cl, n, FALSE)) == cl)
             return;
         arrangeLine(buf);
     }
    --- buffer.c.orig Thu Dec 21 12:19:37 2000
    +++ buffer.c Thu Dec 28 13:23:26 2000
    @@ -242,7 +242,8 @@
             l = buf->lastLine;
             sprintf(msg, "Last line is #%ld", buf->lastLine->linenumber);
             disp_message(msg, FALSE);
    - buf->topLine = buf->currentLine = l;
    + buf->currentLine = l;
    + buf->topLine = lineSkip(buf, buf->currentLine, - (LASTLINE - 1), FALSE);
             return;
         }
         for (; l != NULL; l = l->next) {
    @@ -283,7 +284,8 @@
             l = buf->lastLine;
             sprintf(msg, "Last line is #%ld", buf->lastLine->real_linenumber);
             disp_message(msg, FALSE);
    - buf->topLine = buf->currentLine = l;
    + buf->currentLine = l;
    + buf->topLine = lineSkip(buf, buf->currentLine, - (LASTLINE - 1), FALSE);
             return;
         }
         for (; l != NULL; l = l->next) {
    --- proto.h.orig Thu Dec 28 11:40:40 2000
    +++ proto.h Thu Dec 28 11:33:41 2000
    @@ -195,6 +195,7 @@
     extern int columnSkip(Buffer * buf, int offset);
     extern int columnPos(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, int *status);
     extern char *getAnchor(char *arg, char **arg_return);
     extern Str checkType(Str s, Lineprop * oprop, Linecolor * ocolor, int *need_color, int len);



    This archive was generated by hypermail 2b29 : Wed Dec 27 2000 - 22:39:56 CST