mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Fix multiple small issues with widget titles
This commit is contained in:
parent
34977f7ffa
commit
3ce6daee71
@ -42,7 +42,12 @@ func (widget *Widget) Refresh() {
|
|||||||
|
|
||||||
func (widget *Widget) String() string {
|
func (widget *Widget) String() string {
|
||||||
args := strings.Join(widget.args, " ")
|
args := strings.Join(widget.args, " ")
|
||||||
|
|
||||||
|
if args != "" {
|
||||||
return fmt.Sprintf(" %s %s ", widget.cmd, args)
|
return fmt.Sprintf(" %s %s ", widget.cmd, args)
|
||||||
|
} else {
|
||||||
|
return fmt.Sprintf(" %s ", widget.cmd)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) execute() {
|
func (widget *Widget) execute() {
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/gdamore/tcell"
|
"github.com/gdamore/tcell"
|
||||||
@ -49,7 +50,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
|
|||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
widget.View.SetTitle(fmt.Sprintf("%s %s", widget.Name, widget.filePath))
|
widget.View.SetTitle(fmt.Sprintf(" %s ", widget.fileName()))
|
||||||
|
|
||||||
filePath, _ := wtf.ExpandHomeDir(widget.filePath)
|
filePath, _ := wtf.ExpandHomeDir(widget.filePath)
|
||||||
|
|
||||||
@ -147,6 +148,10 @@ func (widget *Widget) Refresh() {
|
|||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
|
||||||
|
func (widget *Widget) fileName() string {
|
||||||
|
return filepath.Base(widget.filePath)
|
||||||
|
}
|
||||||
|
|
||||||
func (widget *Widget) keyboardIntercept(event *tcell.EventKey) *tcell.EventKey {
|
func (widget *Widget) keyboardIntercept(event *tcell.EventKey) *tcell.EventKey {
|
||||||
switch string(event.Rune()) {
|
switch string(event.Rune()) {
|
||||||
case "/":
|
case "/":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user