Skip to content

Commit

Permalink
[#74] support exiting ci view with ESC and "q"
Browse files Browse the repository at this point in the history
  • Loading branch information
zaquestion committed Apr 23, 2018
1 parent 4be87ac commit acd7fa2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/ciView.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ Feedback Welcome!: https://github.com/zaquestion/lab/issues/74`,
boxes = make(map[string]*tview.TextView)
jobsCh := make(chan []*gitlab.Job)

a.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
if event.Key() == tcell.KeyEscape || event.Rune() == 'q' {
a.Stop()
return nil
}
return event
})
go updateJobs(a, jobsCh, project.ID, branch)
go refreshScreen(a)
if err := a.SetRoot(root, true).SetBeforeDrawFunc(jobsView(a, jobsCh, root)).SetAfterDrawFunc(connectJobsView(a)).Run(); err != nil {
Expand Down

0 comments on commit acd7fa2

Please sign in to comment.