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:
parent
5db30c0e8d
commit
9a877b5e04
1
main.go
1
main.go
@ -59,7 +59,6 @@ func keyboardIntercept(event *tcell.EventKey) *tcell.EventKey {
|
|||||||
if !focusTracker.IsFocused {
|
if !focusTracker.IsFocused {
|
||||||
switch string(event.Rune()) {
|
switch string(event.Rune()) {
|
||||||
case "/":
|
case "/":
|
||||||
fmt.Println(">> OUCH")
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,9 +28,10 @@ func NewBillboardModal(text string, closeFunc func()) *tview.Frame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
textView := tview.NewTextView()
|
textView := tview.NewTextView()
|
||||||
|
textView.SetDynamicColors(true)
|
||||||
textView.SetInputCapture(keyboardIntercept)
|
textView.SetInputCapture(keyboardIntercept)
|
||||||
textView.SetWrap(true)
|
|
||||||
textView.SetText(text)
|
textView.SetText(text)
|
||||||
|
textView.SetWrap(true)
|
||||||
|
|
||||||
frame := tview.NewFrame(textView)
|
frame := tview.NewFrame(textView)
|
||||||
frame.SetRect(offscreen, offscreen, modalWidth, modalHeight)
|
frame.SetRect(offscreen, offscreen, modalWidth, modalHeight)
|
||||||
|
@ -2,6 +2,7 @@ package wtf
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/gdamore/tcell"
|
"github.com/gdamore/tcell"
|
||||||
"github.com/rivo/tview"
|
"github.com/rivo/tview"
|
||||||
@ -85,16 +86,15 @@ func (widget *KeyboardWidget) InputCapture(event *tcell.EventKey) *tcell.EventKe
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (widget *KeyboardWidget) HelpText() string {
|
func (widget *KeyboardWidget) HelpText() string {
|
||||||
|
str := " [green::b]Keyboard commands for " + strings.Title(widget.settings.Module.Type) + "[white]\n\n"
|
||||||
str := "Keyboard commands for " + widget.settings.Module.Type + "\n\n"
|
|
||||||
|
|
||||||
for _, item := range widget.charHelp {
|
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"
|
str += "\n\n"
|
||||||
|
|
||||||
for _, item := range widget.keyHelp {
|
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
|
return str
|
||||||
|
Loading…
x
Reference in New Issue
Block a user