diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2001-11-23 20:50:59 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2001-11-23 20:50:59 +0000 |
commit | 2069fa46f789617f058258a93f8218e382f18b4e (patch) | |
tree | 87837cdf7e237e17b28f4929cfca10662bc35d0b | |
parent | add ftppass_hostnamegen (diff) | |
download | w3m-2069fa46f789617f058258a93f8218e382f18b4e.tar.gz w3m-2069fa46f789617f058258a93f8218e382f18b4e.zip |
add emacs_like_lineedit
Diffstat (limited to '')
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | fm.h | 5 | ||||
-rw-r--r-- | linein.c | 70 | ||||
-rw-r--r-- | rc.c | 11 |
4 files changed, 62 insertions, 31 deletions
@@ -1,5 +1,12 @@ 2001-11-24 Fumitoshi UKAI <ukai@debian.or.jp + * fm.h (emacs_like_lineedit): runtime option emacs_like_lineedit + * linein.c (inputLineHist): ditto + * linein.c (_esc): ditto + * linein.c (next_dcompl): ditto + * rc.c (CMT_EMACS_LIKE_LINEEDIT): ditto + * rc.c (params3): ditto + * fm.h (ftppass_hostnamegen): runtime option ftppass_hostnamegen * ftp.c (FtpLogin): ditto * rc.c (CMT_FTPPASS_HOSTNAMEGEN): ditto @@ -1,4 +1,4 @@ -/* $Id: fm.h,v 1.13 2001/11/23 20:23:41 ukai Exp $ */ +/* $Id: fm.h,v 1.14 2001/11/23 20:50:59 ukai Exp $ */ /* * w3m: WWW wo Miru utility * @@ -703,6 +703,9 @@ global int useVisitedColor init(FALSE); global int visited_color init(5); /* magenta */ #endif /* USE_COLOR */ global int confirm_on_quit init(TRUE); +#ifdef EMACS_LIKE_LINEEDIT +global int emacs_like_lineedit init(FALSE); +#endif global int displayLink init(FALSE); global int retryAsHttp init(TRUE); global int showLineNum init(FALSE); @@ -1,4 +1,4 @@ -/* $Id: linein.c,v 1.6 2001/11/22 15:02:17 ukai Exp $ */ +/* $Id: linein.c,v 1.7 2001/11/23 20:50:59 ukai Exp $ */ #include "fm.h" #include "local.h" #include "myctype.h" @@ -37,10 +37,7 @@ static void insertself(char c), _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), _tcompl(void), - _dcompl(void), _rdcompl(void); -#ifndef EMACS_LIKE_LINEEDIT -static void _rcompl(void); -#endif + _dcompl(void), _rdcompl(void), _rcompl(void); #ifdef __EMX__ static int getcntrl(void); #endif @@ -191,22 +188,27 @@ inputLineHist(char *prompt, char *def_str, int flag, Hist * hist) (((cm_mode & CPL_ALWAYS) && (c == CTRL_I || c == ' ')) || ((cm_mode & CPL_ON) && (c == CTRL_I)))) { #ifdef EMACS_LIKE_LINEEDIT - if (cm_next) { - _dcompl(); - need_redraw = TRUE; - } - else { - _compl(); - cm_disp_next = -1; - } -#else - _compl(); - cm_disp_next = -1; + if (emacs_like_lineedit && cm_next) { + _dcompl(); + need_redraw = TRUE; + } + else { +#endif + _compl(); + cm_disp_next = -1; +#ifdef EMACS_LIKE_LINEEDIT + } +#endif } else if (!i_quote && CLen == CPos && (cm_mode & CPL_ALWAYS || cm_mode & CPL_ON) && c == CTRL_D) { - _dcompl(); - need_redraw = TRUE; +#ifdef EMACS_LIKE_LINEEDIT + if (! emacs_like_lineedit) { +#endif + _dcompl(); + need_redraw = TRUE; +#ifdef EMACS_LIKE_LINEEDIT + } #endif } else if (!i_quote && c == DEL_CODE) { @@ -421,25 +423,35 @@ _esc(void) case CTRL_I: case ' ': #ifdef EMACS_LIKE_LINEEDIT - _rdcompl(); - cm_clear = FALSE; + if (emacs_like_lineedit) { + _rdcompl(); + cm_clear = FALSE; + need_redraw = TRUE; + } else #else - _rcompl(); + _rcompl(); +#endif break; case CTRL_D: - _rdcompl(); +#ifdef EMACS_LIKE_LINEEDIT + if (!emacs_like_lineedit) +#else + _rdcompl(); #endif need_redraw = TRUE; break; #ifdef EMACS_LIKE_LINEEDIT case 'f': - _mvRw(); + if (emacs_like_lineedit) + _mvRw(); break; case 'b': - _mvLw(); + if (emacs_like_lineedit) + _mvLw(); break; case CTRL_H: - _bsw(); + if (emacs_like_lineedit) + _bsw(); break; #endif #ifdef JP_CHARSET @@ -628,13 +640,11 @@ _compl(void) next_compl(1); } -#ifndef EMACS_LIKE_LINEEDIT static void _rcompl(void) { next_compl(-1); } -#endif static void _tcompl(void) @@ -815,9 +825,11 @@ disp_next: clrtoeolx(); bold(); #ifdef EMACS_LIKE_LINEEDIT - addstr("----- Press TAB to continue -----"); + if (emacs_like_lineedit) + addstr("----- Press TAB to continue -----"); + else #else - addstr("----- Press CTRL-D to continue -----"); + addstr("----- Press CTRL-D to continue -----"); #endif boldend(); } @@ -1,4 +1,4 @@ -/* $Id: rc.c,v 1.8 2001/11/23 20:23:41 ukai Exp $ */ +/* $Id: rc.c,v 1.9 2001/11/23 20:50:59 ukai Exp $ */ /* * Initialization file etc. */ @@ -89,6 +89,9 @@ static int rc_initialized = 0; #define CMT_PDROOT "/~user で表されるディレクトリ" #define CMT_CGIBIN "/cgi-bin で表されるディレクトリ" #define CMT_CONFIRM_QQ "q での終了時に確認する" +#ifdef EMACS_LIKE_LINEEDIT +#define CMT_EMACS_LIKE_LINEEDIT "Emacs風の行編集にする" +#endif #define CMT_SHOW_NUM "行番号を表示する" #define CMT_MIMETYPES "利用するmime.types" #define CMT_MAILCAP "利用するmailcap" @@ -187,6 +190,9 @@ static int rc_initialized = 0; #define CMT_PDROOT "Directory corresponds to /~user" #define CMT_CGIBIN "Directory corresponds to /cgi-bin" #define CMT_CONFIRM_QQ "Confirm when quitting with q" +#ifdef EMACS_LIKE_LINEEDIT +#define CMT_EMACS_LIKE_LINEEDIT "Emacs-style line editing" +#endif #define CMT_SHOW_NUM "Show line number" #define CMT_MIMETYPES "mime.types files" #define CMT_MAILCAP "mailcap files" @@ -387,6 +393,9 @@ struct param_ptr params3[] = {"save_hist", P_INT, PI_ONOFF, (void *) &SaveURLHist, CMT_SAVEHIST, NULL}, #endif /* USE_HISTORY */ {"confirm_qq", P_INT, PI_ONOFF, (void *) &confirm_on_quit, CMT_CONFIRM_QQ, NULL}, +#ifdef EMACS_LIKE_LINEEDIT + {"emacs_like_lineedit", P_INT, PI_ONOFF, (void *) &emacs_like_lineedit, CMT_EMACS_LIKE_LINEEDIT, NULL }, +#endif {"wrap_search", P_INT, PI_ONOFF, (void *) &WrapDefault, CMT_WRAP, NULL}, {"ignorecase_search", P_INT, PI_ONOFF, (void *) &IgnoreCase, CMT_IGNORE_CASE, NULL}, #ifdef USE_MOUSE |