1
0
mirror of https://github.com/makew0rld/amfora.git synced 2024-12-04 14:46:29 -05:00

Make the help page a panel instead of a tab

This commit is contained in:
makeworld 2020-12-27 19:59:43 -05:00
parent a458016ce5
commit 992a824502
3 changed files with 7 additions and 10 deletions

View File

@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Ability to set custom keybindings in config (#135)
### Changed
- Update cview to `1af0da7606b8476944b5740bb4f0b711aaf2a1df` for large perf and feature updates (#107)
- Update cview to `1af0da7606b8476944b5740bb4f0b711aaf2a1df` for large performance and feature updates (#107)
- Update to tcell v2 (dependency of cview)
### Fixed

View File

@ -52,7 +52,7 @@ func main() {
client.Init()
// Initalize lower-level cview app
// Initialize lower-level cview app
if err = display.App.Init(); err != nil {
panic(err)
}

View File

@ -2,7 +2,6 @@ package display
import (
"fmt"
"strconv"
"strings"
"text/tabwriter"
@ -55,12 +54,9 @@ var helpTable = cview.NewTextView()
// Help displays the help and keybindings.
func Help() {
helpTable.ScrollToBeginning()
if !browser.HasTab("help") {
browser.AddTab("help", "Help", helpTable)
}
browser.SetCurrentTab("help")
panels.ShowPanel("help")
panels.SendToFront("help")
App.SetFocus(helpTable)
App.Draw()
}
func helpInit() {
@ -69,7 +65,7 @@ func helpInit() {
helpTable.SetPadding(0, 0, 1, 1)
helpTable.SetDoneFunc(func(key tcell.Key) {
if key == tcell.KeyEsc || key == tcell.KeyEnter {
browser.SetCurrentTab(strconv.Itoa(curTab))
panels.HidePanel("help")
App.SetFocus(tabs[curTab].view)
App.Draw()
}
@ -115,5 +111,6 @@ func helpInit() {
}
w.Flush()
browser.AddTab("help", "Help", helpTable)
panels.AddPanel("help", helpTable, true, false)
}