mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
23 lines
739 B
Go
23 lines
739 B
Go
package textfile
|
|
|
|
import (
|
|
"github.com/gdamore/tcell"
|
|
"github.com/wtfutil/wtf/utils"
|
|
)
|
|
|
|
func (widget *Widget) initializeKeyboardControls() {
|
|
widget.SetKeyboardChar("/", widget.ShowHelp, "Show/hide this help prompt")
|
|
widget.SetKeyboardChar("l", widget.NextSource, "Select next file")
|
|
widget.SetKeyboardChar("h", widget.PrevSource, "Select previous file")
|
|
widget.SetKeyboardChar("o", widget.openFile, "Open file")
|
|
|
|
widget.SetKeyboardKey(tcell.KeyRight, widget.NextSource, "Select next file")
|
|
widget.SetKeyboardKey(tcell.KeyLeft, widget.PrevSource, "Select previous file")
|
|
widget.SetKeyboardKey(tcell.KeyEnter, widget.openFile, "Open file")
|
|
}
|
|
|
|
func (widget *Widget) openFile() {
|
|
src := widget.CurrentSource()
|
|
utils.OpenFile(src)
|
|
}
|