Skip to content

Commit

Permalink
Add keyhandler for Tasks screen
Browse files Browse the repository at this point in the history
  • Loading branch information
moncho committed Apr 23, 2017
1 parent 3f6fced commit 177c671
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ func (eh *eventHandlerFactory) handlerFor(view viewMode) eventHandler {
nHandler.initialize(eh.dry, eh.screen, eh.keyboardQueueForView, eh.viewClosed, eh.renderChan)
eh.handlers[Nodes] = nHandler

tHandler := &taskScreenEventHandler{}
tHandler.initialize(eh.dry, eh.screen, eh.keyboardQueueForView, eh.viewClosed, eh.renderChan)
eh.handlers[Tasks] = tHandler

})
if handler, ok := eh.handlers[view]; ok {
return handler
Expand Down
15 changes: 15 additions & 0 deletions app/node_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,18 @@ func (h *nodesScreenEventHandler) handle(event termbox.Event) {
h.setFocus(true)
}
}

type taskScreenEventHandler struct {
baseEventHandler
}

func (h *taskScreenEventHandler) handle(event termbox.Event) {

switch event.Key {
case termbox.KeyEsc:
h.dry.ShowNodes()
}

h.baseEventHandler.handle(event)

}

0 comments on commit 177c671

Please sign in to comment.