Restore output navigation hotkeys
This commit is contained in:
committed by
Brandon McGinty
parent
95c7394b01
commit
3ba5e03208
@@ -89,8 +89,11 @@ func (c *Config) LoadConfig() {
|
||||
Exit: key(uiterm.KeyF10),
|
||||
ToggleTimestamps: key(uiterm.KeyF3),
|
||||
SwitchViews: key(uiterm.KeyTab),
|
||||
ClearOutput: key(uiterm.KeyCtrlL),
|
||||
ScrollUp: key(uiterm.KeyPgup),
|
||||
ScrollDown: key(uiterm.KeyPgdn),
|
||||
ScrollToTop: key(uiterm.KeyHome),
|
||||
ScrollToBottom: key(uiterm.KeyEnd),
|
||||
AdminMenu: key(uiterm.KeyF11),
|
||||
NoiseSuppressionToggle: key(uiterm.KeyF9),
|
||||
}
|
||||
@@ -167,8 +170,11 @@ func (c *Config) ensureHotkeys() {
|
||||
Exit: key(uiterm.KeyF10),
|
||||
ToggleTimestamps: key(uiterm.KeyF3),
|
||||
SwitchViews: key(uiterm.KeyTab),
|
||||
ClearOutput: key(uiterm.KeyCtrlL),
|
||||
ScrollUp: key(uiterm.KeyPgup),
|
||||
ScrollDown: key(uiterm.KeyPgdn),
|
||||
ScrollToTop: key(uiterm.KeyHome),
|
||||
ScrollToBottom: key(uiterm.KeyEnd),
|
||||
AdminMenu: key(uiterm.KeyF11),
|
||||
NoiseSuppressionToggle: key(uiterm.KeyF9),
|
||||
}
|
||||
@@ -200,12 +206,21 @@ func (c *Config) ensureHotkeys() {
|
||||
if hotkeys.SwitchViews == nil {
|
||||
hotkeys.SwitchViews = defaults.SwitchViews
|
||||
}
|
||||
if hotkeys.ClearOutput == nil {
|
||||
hotkeys.ClearOutput = defaults.ClearOutput
|
||||
}
|
||||
if hotkeys.ScrollUp == nil {
|
||||
hotkeys.ScrollUp = defaults.ScrollUp
|
||||
}
|
||||
if hotkeys.ScrollDown == nil {
|
||||
hotkeys.ScrollDown = defaults.ScrollDown
|
||||
}
|
||||
if hotkeys.ScrollToTop == nil {
|
||||
hotkeys.ScrollToTop = defaults.ScrollToTop
|
||||
}
|
||||
if hotkeys.ScrollToBottom == nil {
|
||||
hotkeys.ScrollToBottom = defaults.ScrollToBottom
|
||||
}
|
||||
if hotkeys.AdminMenu == nil {
|
||||
hotkeys.AdminMenu = defaults.AdminMenu
|
||||
}
|
||||
|
||||
@@ -54,6 +54,24 @@ func TestConfigBackfillsRecordingDefaults(t *testing.T) {
|
||||
if got := *cfg.GetHotkeys().AdminMenu; got != uiterm.KeyF11 {
|
||||
t.Fatalf("expected admin menu f11, got %s", got)
|
||||
}
|
||||
for name, got := range map[string]*uiterm.Key{
|
||||
"clear output": cfg.GetHotkeys().ClearOutput,
|
||||
"scroll to top": cfg.GetHotkeys().ScrollToTop,
|
||||
"scroll to bottom": cfg.GetHotkeys().ScrollToBottom,
|
||||
} {
|
||||
if got == nil {
|
||||
t.Fatalf("expected %s hotkey to be backfilled", name)
|
||||
}
|
||||
}
|
||||
if got := *cfg.GetHotkeys().ClearOutput; got != uiterm.KeyCtrlL {
|
||||
t.Fatalf("expected clear output ctrl_l, got %s", got)
|
||||
}
|
||||
if got := *cfg.GetHotkeys().ScrollToTop; got != uiterm.KeyHome {
|
||||
t.Fatalf("expected scroll to top home, got %s", got)
|
||||
}
|
||||
if got := *cfg.GetHotkeys().ScrollToBottom; got != uiterm.KeyEnd {
|
||||
t.Fatalf("expected scroll to bottom end, got %s", got)
|
||||
}
|
||||
}
|
||||
|
||||
// Regression: malformed and IPv6 addresses were split at every colon and
|
||||
|
||||
@@ -582,6 +582,7 @@ func (b *Barnard) OnUiInitialize(ui *uiterm.Ui) {
|
||||
b.Ui.AddKeyListener(b.OnTimestampToggle, b.Hotkeys.ToggleTimestamps)
|
||||
b.Ui.AddKeyListener(b.OnNoiseSuppressionToggle, b.Hotkeys.NoiseSuppressionToggle)
|
||||
b.Ui.AddKeyListener(b.OnRecordingToggle, b.Hotkeys.RecordToggle)
|
||||
b.Ui.AddKeyListener(b.OnClearPress, b.Hotkeys.ClearOutput)
|
||||
b.Ui.AddKeyListener(b.OnQuitPress, b.Hotkeys.Exit)
|
||||
b.Ui.AddKeyListener(b.OnScrollOutputUp, b.Hotkeys.ScrollUp)
|
||||
b.Ui.AddKeyListener(b.OnScrollOutputDown, b.Hotkeys.ScrollDown)
|
||||
|
||||
Reference in New Issue
Block a user