Compare commits

...

9 Commits

5 changed files with 32 additions and 13 deletions

View File

@ -1 +1 @@
2.2.0
2.2.1

View File

@ -59,7 +59,7 @@ Displaying web content directly in \fBbombadillo\fP requires lynx, w3m or elinks
These commands work as a single keypress anytime \fBbombadillo\fP is not taking in a line based command or when the user is being prompted for action. This is the default command mode of \fBbombadillo\fP.
.TP
.B
b
b, h
Navigate back one place in your document history.
.TP
.B
@ -71,7 +71,7 @@ d
Scroll down an amount corresponding to 75% of your terminal window height in the current document.
.TP
.B
f
f, l
Navigate forward one place in your document history.
.TP
.B
@ -95,6 +95,7 @@ n
Jump to next found text item.
.TP
.B
N
Jump to previous found text item.
.TP
.B
@ -106,6 +107,10 @@ R
Reload the current page (does not destroy forward history).
.TP
.B
1, 2, 3, 4, 5, 6, 7, 8, 9, 0
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
.B
u
Scroll up an amount corresponding to 75% of your terminal window height in the current document.
.TP

View File

@ -162,15 +162,21 @@ func (c *client) TakeControlInput() {
input := cui.Getch()
switch input {
case 'j', 'J':
case '1', '2', '3', '4', '5', '6', '7', '8', '9', '0':
if input == '0' {
c.goToLink("10")
} else {
c.goToLink(string(input))
}
case 'j':
// scroll down one line
c.ClearMessage()
c.Scroll(1)
case 'k', 'K':
case 'k':
// scroll up one line
c.ClearMessage()
c.Scroll(-1)
case 'q', 'Q':
case 'q':
// quit bombadillo
cui.Exit(0, "")
case 'g':
@ -191,7 +197,7 @@ func (c *client) TakeControlInput() {
c.ClearMessage()
distance := c.Height - c.Height/4
c.Scroll(-distance)
case 'b':
case 'b', 'h':
// go back
c.ClearMessage()
err := c.PageState.NavigateHistory(-1)
@ -216,7 +222,7 @@ func (c *client) TakeControlInput() {
// open the bookmarks browser
c.BookMarks.ToggleOpen()
c.Draw()
case 'f', 'F':
case 'f', 'l':
// go forward
c.ClearMessage()
err := c.PageState.NavigateHistory(1)
@ -705,11 +711,11 @@ func (c *client) search(query, url, question string) {
}
switch u.Scheme {
case "gopher":
go c.Visit(fmt.Sprintf("%s\t%s", u.Full, entry))
c.Visit(fmt.Sprintf("%s\t%s", u.Full, entry))
case "gemini":
// TODO url escape the entry variable
escapedEntry := entry
go c.Visit(fmt.Sprintf("%s?%s", u.Full, escapedEntry))
c.Visit(fmt.Sprintf("%s?%s", u.Full, escapedEntry))
case "http", "https":
c.Visit(u.Full)
default:
@ -990,7 +996,7 @@ func (c *client) handleGemini(u Url) {
c.saveFileFromData(capsule.Content, filename)
}
case 3:
c.SetMessage(fmt.Sprintf("Follow redirect (y/n): %s?", capsule.Content), false)
c.SetMessage(fmt.Sprintf("Follow redirect? (y/n): %s", capsule.Content), false)
c.DrawMessage()
ch := cui.Getch()
if ch == 'y' || ch == 'Y' {

View File

@ -56,8 +56,8 @@ func Exit(exitCode int, msg string) {
// InitTerm sets the terminal modes appropriate for Bombadillo
func InitTerm() {
SetCharMode()
Tput("rmam") // turn off line wrapping
Tput("smcup") // use alternate screen
Tput("rmam") // turn off line wrapping
}
// CleanupTerm reverts changs to terminal mode made by InitTerm

10
page.go
View File

@ -66,11 +66,13 @@ func (p *Page) RenderImage(width int) {
// of the Page struct width a string slice
// of the wrapped data
func (p *Page) WrapContent(width int, color bool) {
width = min(width, 100)
if p.FileType == "image" {
p.RenderImage(width)
return
}
counter := 0
spacer := " "
var content strings.Builder
var esc strings.Builder
escape := false
@ -124,7 +126,6 @@ func (p *Page) WrapContent(width int, color bool) {
content.WriteRune('\n')
counter = 0
if p.Location.Mime == "1" {
spacer := " "
content.WriteString(spacer)
counter += len(spacer)
}
@ -188,3 +189,10 @@ func MakePage(url Url, content string, links []string) Page {
p := Page{make([]string, 0), content, links, url, 0, make([]int, 0), "", 0, "", 40, false}
return p
}
func min(a, b int) int {
if a < b {
return a
}
return b
}