diff options
author | Tatsuya Kinoshita <tats@debian.org> | 2020-01-13 03:26:40 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-13 03:26:40 +0000 |
commit | d2abc086894ed847752b7cdfe412f9bd845b5c4a (patch) | |
tree | 3c35abd44abacaf7a7d855c56a6a8c033e988b39 | |
parent | Update ChangeLog (diff) | |
parent | Add command to go home. (diff) | |
download | w3m-d2abc086894ed847752b7cdfe412f9bd845b5c4a.tar.gz w3m-d2abc086894ed847752b7cdfe412f9bd845b5c4a.zip |
Merge pull request #124 from butwerenotthereyet/go-home
Add command to go home.
-rw-r--r-- | keybind.c | 2 | ||||
-rw-r--r-- | main.c | 17 | ||||
-rw-r--r-- | proto.h | 1 |
3 files changed, 19 insertions, 1 deletions
@@ -13,7 +13,7 @@ unsigned char GlobalKeymap[128] = { /* C-p C-q C-r C-s C-t C-u C-v C-w */ movU, closeT, isrchbak, isrchfor, tabA, prevA, pgFore, wrapToggle, /* C-x C-y C-z C-[ C-\ C-] C-^ C-_ */ - nulcmd, nulcmd, susp, escmap, nulcmd, nulcmd, nulcmd, nulcmd, + nulcmd, nulcmd, susp, escmap, nulcmd, nulcmd, nulcmd, goHome, /* SPC ! " # $ % & ' */ pgFore, execsh, reMark, pipesh, linend, nulcmd, nulcmd, nulcmd, /* ( ) * + , - . / */ @@ -4256,6 +4256,23 @@ DEFUN(goURL, GOTO, "Open specified document in a new buffer") goURL0("Goto URL: ", FALSE); } +DEFUN(goHome, GOTO_HOME, "Open home page in a new buffer") +{ + char *url; + if ((url = getenv("HTTP_HOME")) != NULL || + (url = getenv("WWW_HOME")) != NULL) { + ParsedURL p_url; + Buffer *cur_buf = Currentbuf; + SKIP_BLANKS(url); + url = url_encode(url, NULL, 0); + parseURL2(url, &p_url, NULL); + pushHashHist(URLHist, parsedURL2Str(&p_url)->ptr); + cmd_loadURL(url, NULL, NULL, NULL); + if (Currentbuf != cur_buf) /* success */ + pushHashHist(URLHist, parsedURL2Str(&Currentbuf->currentURL)->ptr); + } +} + DEFUN(gorURL, GOTO_RELATIVE, "Go to relative address") { goURL0("Goto relative URL: ", TRUE); @@ -81,6 +81,7 @@ extern void prevBf(void); extern void backBf(void); extern void deletePrevBuf(void); extern void goURL(void); +extern void goHome(void); extern void gorURL(void); extern void ldBmark(void); extern void adBmark(void); |