Skip to content

Commit

Permalink
Merge pull request #81 from coolabhays/quit_viddy
Browse files Browse the repository at this point in the history
Quit viddy
  • Loading branch information
sachaos committed Dec 26, 2022
2 parents a251280 + 9fa4c28 commit df88523
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 @@ -681,7 +697,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 @@ -693,6 +709,7 @@ var helpTemplate = `Press ESC or Q to go back
Toggle diff : [yellow]d[-:-:-]
Toggle header display : [yellow]t[-:-:-]
Toggle help view : [yellow]?[-:-:-]
Quit Viddy : [yellow]Q[-:-:-]
[::u]Pager[-:-:-]
Expand Down

0 comments on commit df88523

Please sign in to comment.