Release to master 2.4.0 #217
|
@ -111,6 +111,10 @@ Reload the current page (does not destroy forward history).
|
||||||
Quick navigation to the first 10 links on a page. The 0 key will navigate to the link numbered '10', all other numbers navigate to their matching link number.
|
Quick navigation to the first 10 links on a page. The 0 key will navigate to the link numbered '10', all other numbers navigate to their matching link number.
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
|
U
|
||||||
|
Move up a level in the current url path. \fI/mydir/mysubdir/myfile.txt\fP would become \fI/mydir/mysubdir/\fP, and so on.
|
||||||
|
.TP
|
||||||
|
.B
|
||||||
u
|
u
|
||||||
Scroll up an amount corresponding to 75% of your terminal window height in the current document.
|
Scroll up an amount corresponding to 75% of your terminal window height in the current document.
|
||||||
.TP
|
.TP
|
||||||
|
|
28
client.go
28
client.go
|
@ -146,42 +146,47 @@ func (c *client) TakeControlInput() {
|
||||||
|
|
||||||
switch input {
|
switch input {
|
||||||
case '1', '2', '3', '4', '5', '6', '7', '8', '9', '0':
|
case '1', '2', '3', '4', '5', '6', '7', '8', '9', '0':
|
||||||
|
// Quick link
|
||||||
if input == '0' {
|
if input == '0' {
|
||||||
c.goToLink("10")
|
c.goToLink("10")
|
||||||
} else {
|
} else {
|
||||||
c.goToLink(string(input))
|
c.goToLink(string(input))
|
||||||
}
|
}
|
||||||
case 'j':
|
case 'j':
|
||||||
// scroll down one line
|
// Scroll down one line
|
||||||
c.ClearMessage()
|
c.ClearMessage()
|
||||||
c.Scroll(1)
|
c.Scroll(1)
|
||||||
case 'k':
|
case 'k':
|
||||||
// scroll up one line
|
// Scroll up one line
|
||||||
c.ClearMessage()
|
c.ClearMessage()
|
||||||
c.Scroll(-1)
|
c.Scroll(-1)
|
||||||
case 'q':
|
case 'q':
|
||||||
// quit bombadillo
|
// Quit
|
||||||
cui.Exit(0, "")
|
cui.Exit(0, "")
|
||||||
case 'g':
|
case 'g':
|
||||||
// scroll to top
|
// Scroll to top
|
||||||
c.ClearMessage()
|
c.ClearMessage()
|
||||||
c.Scroll(-len(c.PageState.History[c.PageState.Position].WrappedContent))
|
c.Scroll(-len(c.PageState.History[c.PageState.Position].WrappedContent))
|
||||||
case 'G':
|
case 'G':
|
||||||
// scroll to bottom
|
// Scroll to bottom
|
||||||
c.ClearMessage()
|
c.ClearMessage()
|
||||||
c.Scroll(len(c.PageState.History[c.PageState.Position].WrappedContent))
|
c.Scroll(len(c.PageState.History[c.PageState.Position].WrappedContent))
|
||||||
case 'd':
|
case 'd':
|
||||||
// scroll down 75%
|
// Scroll down 75%
|
||||||
c.ClearMessage()
|
c.ClearMessage()
|
||||||
distance := c.Height - c.Height/4
|
distance := c.Height - c.Height/4
|
||||||
c.Scroll(distance)
|
c.Scroll(distance)
|
||||||
case 'u':
|
case 'u':
|
||||||
// scroll up 75%
|
// Scroll up 75%
|
||||||
c.ClearMessage()
|
c.ClearMessage()
|
||||||
distance := c.Height - c.Height/4
|
distance := c.Height - c.Height/4
|
||||||
c.Scroll(-distance)
|
c.Scroll(-distance)
|
||||||
|
case 'U':
|
||||||
|
// Move up a directory for the current host
|
||||||
|
url := c.PageState.History[c.PageState.Position].Location.Full
|
||||||
|
c.Visit(UpOneDir(url))
|
||||||
case 'b', 'h':
|
case 'b', 'h':
|
||||||
// go back
|
// Go back
|
||||||
c.ClearMessage()
|
c.ClearMessage()
|
||||||
err := c.PageState.NavigateHistory(-1)
|
err := c.PageState.NavigateHistory(-1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -193,6 +198,7 @@ func (c *client) TakeControlInput() {
|
||||||
c.Draw()
|
c.Draw()
|
||||||
}
|
}
|
||||||
case 'R':
|
case 'R':
|
||||||
|
// Refresh the current page
|
||||||
c.ClearMessage()
|
c.ClearMessage()
|
||||||
err := c.ReloadPage()
|
err := c.ReloadPage()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -202,11 +208,11 @@ func (c *client) TakeControlInput() {
|
||||||
c.Draw()
|
c.Draw()
|
||||||
}
|
}
|
||||||
case 'B':
|
case 'B':
|
||||||
// open the bookmarks browser
|
// Toggle the bookmark browser
|
||||||
c.BookMarks.ToggleOpen()
|
c.BookMarks.ToggleOpen()
|
||||||
c.Draw()
|
c.Draw()
|
||||||
case 'f', 'l':
|
case 'f', 'l':
|
||||||
// go forward
|
// Go forward
|
||||||
c.ClearMessage()
|
c.ClearMessage()
|
||||||
err := c.PageState.NavigateHistory(1)
|
err := c.PageState.NavigateHistory(1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -218,7 +224,7 @@ func (c *client) TakeControlInput() {
|
||||||
c.Draw()
|
c.Draw()
|
||||||
}
|
}
|
||||||
case '\t':
|
case '\t':
|
||||||
// Toggle bookmark browser focus on/off
|
// Toggle bookmark browser focus
|
||||||
c.BookMarks.ToggleFocused()
|
c.BookMarks.ToggleFocused()
|
||||||
c.Draw()
|
c.Draw()
|
||||||
case 'n':
|
case 'n':
|
||||||
|
|
19
url.go
19
url.go
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os/user"
|
"os/user"
|
||||||
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -145,6 +146,24 @@ func MakeUrl(u string) (Url, error) {
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func UpOneDir(u string) string {
|
||||||
|
url, err := MakeUrl(u)
|
||||||
|
if len(url.Resource) < 1 || err != nil {
|
||||||
|
return u
|
||||||
|
}
|
||||||
|
if strings.HasSuffix(url.Resource, "/") {
|
||||||
|
url.Resource = url.Resource[:len(url.Resource)-1]
|
||||||
|
}
|
||||||
|
url.Resource, _ = path.Split(url.Resource)
|
||||||
|
if url.Scheme == "gopher" {
|
||||||
|
url.Mime = "1"
|
||||||
|
}
|
||||||
|
|
||||||
|
url.Full = url.Scheme + "://" + url.Host + ":" + url.Port + "/" + url.Mime + url.Resource
|
||||||
|
|
||||||
|
return url.Full
|
||||||
|
}
|
||||||
|
|
||||||
func parseFinger(u string) (Url, error) {
|
func parseFinger(u string) (Url, error) {
|
||||||
var out Url
|
var out Url
|
||||||
out.Scheme = "finger"
|
out.Scheme = "finger"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user