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) - Ability to set custom keybindings in config (#135)
### Changed ### 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) - Update to tcell v2 (dependency of cview)
### Fixed ### Fixed

View File

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

View File

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