diff -ur w3m-0.1.11-pre-orig/fm.h w3m-0.1.11-pre/fm.h --- w3m-0.1.11-pre-orig/fm.h Mon Jul 3 18:28:54 2000 +++ w3m-0.1.11-pre/fm.h Mon Jul 3 18:30:08 2000 @@ -191,6 +191,7 @@ #define IN_FILENAME 0x20 #define IN_PASSWORD 0x40 #define IN_COMMAND 0x80 +#define IN_URL 0x100 /* * Macros. @@ -199,6 +200,7 @@ #define inputLine(p,d,f) inputLineHist(p,d,f,NULL) #define inputStr(p,d) inputLine(p,d,IN_STRING) #define inputStrHist(p,d,h) inputLineHist(p,d,IN_STRING,h) +#define inputURLHist(p,d,h) inputLineHist(p,d,IN_URL,h) #define inputFilename(p,d) inputLine(p,d,IN_FILENAME) #define inputFilenameHist(p,d,h) inputLineHist(p,d,IN_FILENAME,h) diff -ur w3m-0.1.11-pre-orig/linein.c w3m-0.1.11-pre/linein.c --- w3m-0.1.11-pre-orig/linein.c Wed Jun 14 15:26:09 2000 +++ w3m-0.1.11-pre/linein.c Mon Jul 3 18:55:07 2000 @@ -33,11 +33,13 @@ static int NCFileOffset; static -void insertself(char c), _mvR(void), _mvL(void), delC(void), insC(void), - _mvB(void), _mvE(void), _enter(void), _quo(void), _bs(void), killn(void), +void insertself(char c), _mvR(void), _mvL(void), _mvRw(void), _mvLw(void), delC(void), insC(void), + _mvB(void), _mvE(void), _enter(void), _quo(void), _bs(void), _bsw(void), killn(void), killb(void), _inbrk(void), _esc(void), _prev(void), _next(void), _compl(void), _rcompl(void), _tcompl(void); +static int terminated(unsigned char c); + #define iself ((void(*)())insertself) static @@ -51,9 +53,9 @@ /* C-h C-i C-j C-k C-l C-m C-n C-o */ _bs, iself, _enter, killn, iself, _enter, _next, iself, /* C-p C-q C-r C-s C-t C-u C-v C-w */ - _prev, _quo, iself, iself, iself, killb, _quo, iself, + _prev, _quo, _bsw, iself, _mvLw, killb, _quo, iself, /* C-x C-y C-z C-[ C-\ C-] C-^ C-_ */ - _tcompl, iself, iself, _esc, iself, iself, iself, iself, + _tcompl, _mvRw, iself, _esc, iself, iself, iself, iself, }; static void setStrType(Str str, Lineprop * prop); @@ -61,6 +63,7 @@ static int CPos, CLen; static int i_cont, i_broken, i_quote; static int cm_mode, cm_next, cm_clear; +static int move_word; static Hist *CurrentHist; static int use_hist; @@ -79,15 +82,20 @@ mode = PC_ASCII; in_kanji = FALSE; + move_word = FALSE; CurrentHist = hist; if (hist != NULL) use_hist = TRUE; else use_hist = FALSE; - if (flag & IN_FILENAME) + if (flag & IN_FILENAME){ cm_mode = CPL_ALWAYS; - else if (flag & IN_PASSWORD) + move_word = TRUE; + }else if (flag & IN_URL){ + cm_mode = CPL_OFF; + move_word = TRUE; + }else if (flag & IN_PASSWORD) cm_mode = CPL_NEVER; else if (flag & IN_COMMAND) cm_mode = CPL_ON; @@ -361,6 +369,42 @@ } static void +_mvLw(void) +{ + int first = 1; + while(CPos > 0 + && ( first || terminated(strBuf->ptr[CPos]))) + { + CPos--; + first = 0; +#ifdef JP_CHARSET + if (strProp[CPos] == PC_KANJI2) + CPos--; +#endif /* JP_CHARSET */ + if(!move_word) + break; + } +} + +static void +_mvRw(void) +{ + int first = 1; + while(CPos < CLen + && ( first || terminated(strBuf->ptr[CPos]))) + { + CPos++; + first = 0; +#ifdef JP_CHARSET + if (strProp[CPos] == PC_KANJI2) + CPos++; +#endif /* JP_CHARSET */ + if(!move_word) + break; + } +} + +static void _mvR(void) { if (CPos < CLen) @@ -381,6 +425,17 @@ } static void +_bsw(void) +{ + int t = 0; + while(CPos > 0 && !t) { + _mvL(); + t = (move_word && terminated(strBuf->ptr[CPos-1])); + delC(); + } +} + +static void _enter(void) { i_cont = FALSE; @@ -640,4 +695,18 @@ prop[i - 1] = PC_ASCII; #endif /* JP_CHARSET */ } +} + +static int +terminated(unsigned char c){ + int termchar[] = {'/', '&', '?', -1}; + int *tp; + + for(tp = termchar; *tp > 0; tp++){ + if(c == *tp){ + return 1; + } + } + + return 0; } diff -ur w3m-0.1.11-pre-orig/main.c w3m-0.1.11-pre/main.c --- w3m-0.1.11-pre-orig/main.c Mon Jul 3 18:30:16 2000 +++ w3m-0.1.11-pre/main.c Mon Jul 3 18:30:21 2000 @@ -2708,7 +2708,7 @@ else { if (!(Currentbuf->bufferprop & BP_INTERNAL)) addUniqHist(URLHist, parsedURL2Str(&Currentbuf->currentURL)->ptr); - url = inputStrHist("Goto URL: ", NULL, URLHist); + url = inputURLHist("Goto URL: ", NULL, URLHist); } if (url == NULL || *url == '\0') { displayBuffer(Currentbuf, B_FORCE_REDRAW);