From 5fbef47dde0dad6b058c39bc16d3ff8f093dd228 Mon Sep 17 00:00:00 2001 From: lordwelch Date: Mon, 5 Nov 2018 11:47:11 -0800 Subject: [PATCH] remove unused const and ignore single newline directly after delay --- ghid/keyboard.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ghid/keyboard.go b/ghid/keyboard.go index 7e52d81..ddfc115 100644 --- a/ghid/keyboard.go +++ b/ghid/keyboard.go @@ -46,8 +46,6 @@ const ( NONE = 0 ) -const delayDelimiter = "⏲" - var ( PressDelay time.Duration // PressDelay is the time in ms to delay befor sending a press event ReleaseDelay time.Duration // ReleaseDelay is the time in ms to wait before sending the release event @@ -179,6 +177,13 @@ func parseDelay(buffer []byte) (count int, delay time.Duration) { sb.WriteRune(r) index += s } else { + if r == '\r' { + index += s + r, s = utf8.DecodeRune(buffer[index:]) + } + if r == '\n' { + index += s + } break } }