Skip to content

Commit

Permalink
Clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
spacez320 committed Jan 26, 2024
1 parent 086ab65 commit a9d63eb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions internal/lib/display_termdash.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,30 @@ func keyboardTermdashHandler(key *terminalapi.Keyboard) {
switch key.Key {
case keyboard.KeyEsc:
// Escape quits the program.
slog.Debug("Quitting ...")
slog.Debug("Quitting.")

currentCtx = context.WithValue(currentCtx, "quit", true)
cancel()
appTermdash.Close()
case keyboard.KeyTab:
// Tab switches display modes.
slog.Debug("Next ...")
slog.Debug("Switching display mode.")

interruptChan <- true
currentCtx = context.WithValue(currentCtx, "advanceDisplayMode", true)
cancel()
appTermdash.Close()
case 'n':
// 'n' switches queries.
slog.Debug("Next query ...")
slog.Debug("Switching query.")

interruptChan <- true
currentCtx = context.WithValue(currentCtx, "advanceQuery", true)
cancel()
appTermdash.Close()
case ' ':
// Space pauses.
slog.Debug("Pausing ...")
slog.Debug("Pausing.")

pauseDisplayChan <- true
pauseQueryChans[currentCtx.Value("query").(string)] <- true
Expand Down
8 changes: 4 additions & 4 deletions internal/lib/display_tview.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ func keyboardTviewHandler(event *tcell.EventKey) *tcell.EventKey {
switch key := event.Key(); key {
case tcell.KeyEscape:
// Escape quits the program.
slog.Debug("Quitting ...")
slog.Debug("Quitting.")

currentCtx = context.WithValue(currentCtx, "quit", true)
appTview.Stop()
case tcell.KeyRune:
switch event.Rune() {
case 'n':
// 'n' switches queries.
slog.Debug("Next query ...")
slog.Debug("Switching query.")

go func() {
// When a user presses Tab, stop the display but continue running.
Expand All @@ -42,7 +42,7 @@ func keyboardTviewHandler(event *tcell.EventKey) *tcell.EventKey {
}()
case ' ':
// Space pauses.
slog.Debug("Pausing ...")
slog.Debug("Pausing.")

go func() {
pauseDisplayChan <- true
Expand All @@ -51,7 +51,7 @@ func keyboardTviewHandler(event *tcell.EventKey) *tcell.EventKey {
}
case tcell.KeyTab:
// Tab switches display modes.
slog.Debug("Next display mode ...")
slog.Debug("Switching display mode.")

go func() {
interruptChan <- true
Expand Down

0 comments on commit a9d63eb

Please sign in to comment.