Skip to content

Commit

Permalink
Merge branch 'master' into feature/unfold_hotkey
Browse files Browse the repository at this point in the history
  • Loading branch information
sachaos committed Dec 26, 2022
2 parents 023727f + df88523 commit 96f0f93
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions viddy.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,11 +553,27 @@ func (v *Viddy) Run() error {
any = true
}

if event.Key() == tcell.KeyEsc || event.Rune() == 'q' {
if event.Key() == tcell.KeyEsc {
v.showHelpView = false
v.arrange()
}

if event.Rune() == 'q' {
if (v.showHelpView) { // if it's help mode, just go back
v.showHelpView = false
v.arrange()
} else { // it's not help view, so just quit
v.app.Stop()
os.Exit(0)
}
}

// quit viddy from any view
if event.Rune() == 'Q' {
v.app.Stop()
os.Exit(0)
}

switch event.Rune() {
case 's':
v.isSuspend = !v.isSuspend
Expand Down Expand Up @@ -684,7 +700,7 @@ func (v *Viddy) goToOldestOnTimeMachine() {
}
}

var helpTemplate = `Press ESC or Q to go back
var helpTemplate = `Press ESC or q to go back
[::b]Key Bindings[-:-:-]
Expand All @@ -697,6 +713,7 @@ var helpTemplate = `Press ESC or Q to go back
Toggle header display : [yellow]t[-:-:-]
Toggle help view : [yellow]?[-:-:-]
Toggle unfold : [yellow]u[-:-:-]
Quit Viddy : [yellow]Q[-:-:-]
[::u]Pager[-:-:-]
Expand Down

0 comments on commit 96f0f93

Please sign in to comment.