Release 2.2.0 #140
5
page.go
5
page.go
|
@ -24,6 +24,7 @@ type Page struct {
|
||||||
SearchTerm string
|
SearchTerm string
|
||||||
SearchIndex int
|
SearchIndex int
|
||||||
FileType string
|
FileType string
|
||||||
|
WrapWidth int
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------\\
|
//------------------------------------------------\\
|
||||||
|
@ -56,6 +57,7 @@ func (p *Page) RenderImage(width int) {
|
||||||
w = 300
|
w = 300
|
||||||
}
|
}
|
||||||
p.WrappedContent = tdiv.Render([]byte(p.RawContent), w)
|
p.WrappedContent = tdiv.Render([]byte(p.RawContent), w)
|
||||||
|
p.WrapWidth = width
|
||||||
}
|
}
|
||||||
|
|
||||||
// WrapContent performs a hard wrap to the requested
|
// WrapContent performs a hard wrap to the requested
|
||||||
|
@ -131,6 +133,7 @@ func (p *Page) WrapContent(width int, color bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
p.WrappedContent = strings.Split(content.String(), "\n")
|
p.WrappedContent = strings.Split(content.String(), "\n")
|
||||||
|
p.WrapWidth = width
|
||||||
p.HighlightFoundText()
|
p.HighlightFoundText()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,6 +183,6 @@ func (p *Page) FindText() {
|
||||||
|
|
||||||
// MakePage returns a Page struct with default values
|
// MakePage returns a Page struct with default values
|
||||||
func MakePage(url Url, content string, links []string) Page {
|
func MakePage(url Url, content string, links []string) Page {
|
||||||
p := Page{make([]string, 0), content, links, url, 0, make([]int, 0), "", 0, ""}
|
p := Page{make([]string, 0), content, links, url, 0, make([]int, 0), "", 0, "", 40}
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
4
pages.go
4
pages.go
|
@ -75,7 +75,9 @@ func (p *Pages) Render(termHeight, termWidth int, color bool) []string {
|
||||||
// passed in here. If it is different then go through
|
// passed in here. If it is different then go through
|
||||||
// all of that. Otherwise, just send the already wrapped
|
// all of that. Otherwise, just send the already wrapped
|
||||||
// data.
|
// data.
|
||||||
p.History[p.Position].WrapContent(termWidth, color)
|
if termWidth != p.History[p.Position].WrapWidth {
|
||||||
|
p.History[p.Position].WrapContent(termWidth, color)
|
||||||
|
}
|
||||||
|
|
||||||
now := len(p.History[p.Position].WrappedContent)
|
now := len(p.History[p.Position].WrappedContent)
|
||||||
if prev > now {
|
if prev > now {
|
||||||
|
|
Loading…
Reference in New Issue