Organized approach to handle shortcuts based on currently focused panel

This commit is contained in:
Anis Ahmad
2020-05-30 13:17:20 +06:00
parent 9a6d3c6b30
commit 89624edcba
4 changed files with 43 additions and 15 deletions

View File

@@ -146,11 +146,11 @@ func setTaskDate(unixDate int64, update bool) {
if due.Before(time.Now()) {
color = "red"
}
taskDateDisplay.SetText(fmt.Sprintf("Due: [%s]%s", color, humanDate))
taskDateDisplay.SetText(fmt.Sprintf("[::u]D[::-]ue: [%s]%s", color, humanDate))
taskDate.SetText(due.Format(dateLayoutISO))
} else {
taskDate.SetText("")
taskDateDisplay.SetText("Due: [::d]Not Set")
taskDateDisplay.SetText("[::u]D[::-]ue: [::d]Not Set")
}
}
@@ -210,3 +210,14 @@ func deactivateEditor() {
taskDetailView.SetBorderColor(tcell.ColorLightSlateGray)
app.SetFocus(detailPane)
}
func handleDetailPaneShortcuts(event *tcell.EventKey) *tcell.EventKey {
switch event.Rune() {
case 'e':
activateEditor()
case 'd':
app.SetFocus(taskDate)
}
return event
}