1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Improve the look of the help modal a little bit

This commit is contained in:
Chris Cummer 2019-05-23 15:08:03 -07:00
parent 5db30c0e8d
commit 9a877b5e04
3 changed files with 6 additions and 6 deletions

View File

@ -59,7 +59,6 @@ func keyboardIntercept(event *tcell.EventKey) *tcell.EventKey {
if !focusTracker.IsFocused {
switch string(event.Rune()) {
case "/":
fmt.Println(">> OUCH")
return nil
}
}

View File

@ -28,9 +28,10 @@ func NewBillboardModal(text string, closeFunc func()) *tview.Frame {
}
textView := tview.NewTextView()
textView.SetDynamicColors(true)
textView.SetInputCapture(keyboardIntercept)
textView.SetWrap(true)
textView.SetText(text)
textView.SetWrap(true)
frame := tview.NewFrame(textView)
frame.SetRect(offscreen, offscreen, modalWidth, modalHeight)

View File

@ -2,6 +2,7 @@ package wtf
import (
"fmt"
"strings"
"github.com/gdamore/tcell"
"github.com/rivo/tview"
@ -85,16 +86,15 @@ func (widget *KeyboardWidget) InputCapture(event *tcell.EventKey) *tcell.EventKe
}
func (widget *KeyboardWidget) HelpText() string {
str := "Keyboard commands for " + widget.settings.Module.Type + "\n\n"
str := " [green::b]Keyboard commands for " + strings.Title(widget.settings.Module.Type) + "[white]\n\n"
for _, item := range widget.charHelp {
str += fmt.Sprintf(" [%s]: %s\n", item.Key, item.Text)
str += fmt.Sprintf(" %s\t%s\n", item.Key, item.Text)
}
str += "\n\n"
for _, item := range widget.keyHelp {
str += fmt.Sprintf(" [%-*s]: %s\n", widget.maxKey, item.Key, item.Text)
str += fmt.Sprintf(" %-*s\t%s\n", widget.maxKey, item.Key, item.Text)
}
return str