🐛 Wrap new tab text - fixes #31
This commit is contained in:
parent
85e2191a9a
commit
0791079e13
|
@ -69,6 +69,10 @@ var layout = cview.NewFlex().
|
||||||
AddItem(nil, 1, 1, false). // One line of empty space before bottomBar
|
AddItem(nil, 1, 1, false). // One line of empty space before bottomBar
|
||||||
AddItem(bottomBar, 1, 1, false)
|
AddItem(bottomBar, 1, 1, false)
|
||||||
|
|
||||||
|
var renderedNewTabContent string
|
||||||
|
var newTabLinks []string
|
||||||
|
var newTabPage structs.Page
|
||||||
|
|
||||||
var App = cview.NewApplication().
|
var App = cview.NewApplication().
|
||||||
EnableMouse(false).
|
EnableMouse(false).
|
||||||
SetRoot(layout, true).
|
SetRoot(layout, true).
|
||||||
|
@ -81,15 +85,14 @@ var App = cview.NewApplication().
|
||||||
// XXX: This is hacky but works. The biggest issue is that there will sometimes be a tiny flash
|
// XXX: This is hacky but works. The biggest issue is that there will sometimes be a tiny flash
|
||||||
// of the old not shifted tab on startup.
|
// of the old not shifted tab on startup.
|
||||||
if tabMap[curTab] == &newTabPage {
|
if tabMap[curTab] == &newTabPage {
|
||||||
|
renderedNewTabContent, _ = renderer.RenderGemini(newTabContent, textWidth())
|
||||||
|
newTabPage.Content = renderedNewTabContent
|
||||||
|
newTabPage.LeftMargin = 0
|
||||||
setLeftMargin(tabMap[curTab])
|
setLeftMargin(tabMap[curTab])
|
||||||
tabViews[curTab].SetText(tabMap[curTab].Content)
|
tabViews[curTab].SetText(tabMap[curTab].Content)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
var renderedNewTabContent string
|
|
||||||
var newTabLinks []string
|
|
||||||
var newTabPage structs.Page
|
|
||||||
|
|
||||||
func Init() {
|
func Init() {
|
||||||
tabRow.SetChangedFunc(func() {
|
tabRow.SetChangedFunc(func() {
|
||||||
App.Draw()
|
App.Draw()
|
||||||
|
|
|
@ -32,6 +32,7 @@ Ctrl-T|New tab, or if a link is selected,
|
||||||
|this will open the link in a new tab.
|
|this will open the link in a new tab.
|
||||||
Ctrl-W|Close tab. For now, only the right-most tab can be closed.
|
Ctrl-W|Close tab. For now, only the right-most tab can be closed.
|
||||||
Ctrl-R, R|Reload a page, discarding the cached version.
|
Ctrl-R, R|Reload a page, discarding the cached version.
|
||||||
|
|This can also be used if you resize your terminal.
|
||||||
Ctrl-B|View bookmarks
|
Ctrl-B|View bookmarks
|
||||||
Ctrl-D|Add, change, or remove a bookmark for the current page.
|
Ctrl-D|Add, change, or remove a bookmark for the current page.
|
||||||
q, Ctrl-Q, Ctrl-C|Quit
|
q, Ctrl-Q, Ctrl-C|Quit
|
||||||
|
|
|
@ -176,9 +176,7 @@ func setLeftMargin(p *structs.Page) {
|
||||||
// Old margin needs to be removed, new one added
|
// Old margin needs to be removed, new one added
|
||||||
lines := strings.Split(p.Content, "\n")
|
lines := strings.Split(p.Content, "\n")
|
||||||
for i := range lines {
|
for i := range lines {
|
||||||
if lines[i] != "" {
|
shifted += strings.Repeat(" ", lM) + lines[i][p.LeftMargin:] + "\n"
|
||||||
shifted += strings.Repeat(" ", lM) + lines[i][p.LeftMargin:] + "\n"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.Content = shifted
|
p.Content = shifted
|
||||||
|
|
Loading…
Reference in New Issue