Fenrir's emoji ported to cthulhu.
This commit is contained in:
1 parent
3e2429b8a5
commit
01f50c17e8
24 files changed
+1505
-9
No files matched your search
@@ -23,6 +23,7 @@ const (
|
||||
CycleProgressBarOutput Command = "cycle-progress-bar-output"
|
||||
PresentVersion Command = "present-version"
|
||||
ToggleLearnMode Command = "toggle-learn-mode"
|
||||
EmojiMenu Command = "emoji-menu"
|
||||
ShowActions Command = "show-actions"
|
||||
InternalUIKey Command = "internal-ui-key"
|
||||
InternalUIDismiss Command = "internal-ui-dismiss"
|
||||
@@ -202,6 +203,7 @@ func (state LockState) Text() string {
|
||||
|
||||
func DefaultCommandBindings(layout KeyboardLayout) CommandBindings {
|
||||
bindings := CommandBindings{
|
||||
{Symbol: 'e', Modifiers: controlModifier, CthulhuModifier: true}: EmojiMenu,
|
||||
{Symbol: 'a', Modifiers: 1, CthulhuModifier: true}: ShowActions,
|
||||
{Symbol: leftKeySymbol, CthulhuModifier: true}: SelectPreviousSpeechSetting,
|
||||
{Symbol: rightKeySymbol, CthulhuModifier: true}: SelectNextSpeechSetting,
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
// Copyright (c) 2026 Storm Dragon
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
package input
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestEmojiShortcutBothLayoutsAndReleaseOrders(t *testing.T) {
|
||||
for _, layout := range []KeyboardLayout{DesktopKeyboardLayout, LaptopKeyboardLayout} {
|
||||
chord := CommandChord{Symbol: 'e', Modifiers: controlModifier, CthulhuModifier: true}
|
||||
if got := DefaultCommandBindings(layout)[chord]; got != EmojiMenu {
|
||||
t.Fatalf("%v: %s", layout, got)
|
||||
}
|
||||
if got := BrowseCommandBindings(layout)[chord]; got != "" && got != EmojiMenu {
|
||||
t.Fatalf("browse conflict: %s", got)
|
||||
}
|
||||
for _, releaseFirst := range []bool{false, true} {
|
||||
router := NewCommandRouter([]uint32{0xff63}, DefaultCommandBindings(layout))
|
||||
router.Handle(0xff63, 118, 0, true)
|
||||
router.Handle(leftControlKeySymbol, 37, controlModifier, true)
|
||||
if consumed, cmd := router.Handle('e', 26, controlModifier, true); !consumed || cmd != EmojiMenu {
|
||||
t.Fatalf("shortcut: %v %s", consumed, cmd)
|
||||
}
|
||||
if _, cmd := router.Handle('e', 26, controlModifier, true); cmd != "" {
|
||||
t.Fatal("repeat reopened menu")
|
||||
}
|
||||
if releaseFirst {
|
||||
router.Handle(0xff63, 118, controlModifier, false)
|
||||
}
|
||||
router.Handle('e', 26, controlModifier, false)
|
||||
router.Handle(leftControlKeySymbol, 37, 0, false)
|
||||
if !releaseFirst {
|
||||
router.Handle(0xff63, 118, 0, false)
|
||||
}
|
||||
if consumed, cmd := router.Handle('e', 26, 0, true); consumed || cmd != "" {
|
||||
t.Fatal("typing did not resume")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user