Some echo tests added.

This commit is contained in:
Storm Dragon committed 2026-10-27 00:40:49 -04:00
1 parent 8a32895457
commit eb5b2038d6
38 files changed
+1739 -31

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
// Copyright (c) 2026 Storm Dragon
// Authors: Storm Dragon, Angus Kola
// SPDX-License-Identifier: GPL-3.0-or-later
package input
import "strings"
// Message commands are independent of the physical key. Configured bindings,
// learn mode and both keyboard layouts use the same numbered requests.
func MessageCommand(index int, copyMessage bool) Command {
if index < 0 || index >= 9 {
return ""
}
action := "review"
if copyMessage {
action = "copy"
}
return Command(action + "-chat-message-" + string(rune('1'+index)))
}
func MessageCommandIndex(command Command) (index int, copyMessage, ok bool) {
number, found := strings.CutPrefix(string(command), "review-chat-message-")
if !found {
number, found = strings.CutPrefix(string(command), "copy-chat-message-")
copyMessage = true
}
if !found || len(number) != 1 || number[0] < '1' || number[0] > '9' {
return 0, false, false
}
return int(number[0] - '1'), copyMessage, true
}