Simplify input capture
Instead of "injecting" characters into the input stream, the input stream is now forwarded to the `musicplayer`. It has will have to decide what to do with the stream, e.g. by setting the "mode" to something that captures the input stream and acts upon it
This commit is contained in:
1 parent
35d331a753
commit
dd9468938d
7 files changed
+98
-105
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import gleam/list
|
||||
import gleeunit
|
||||
|
||||
import musicplayer/input/key.{type Key, Char, csi, esc, input_introducer as ii}
|
||||
import musicplayer/input/key.{type Key, Char, backspace, csi, esc, return}
|
||||
|
||||
pub fn main() -> Nil {
|
||||
gleeunit.main()
|
||||
@@ -27,11 +27,8 @@ pub fn key_from_list_test() {
|
||||
]
|
||||
|
||||
let input_tests = [
|
||||
TestCase([ii], key.Continue([ii])),
|
||||
TestCase([ii, "a"], key.Continue([ii, "a"])),
|
||||
TestCase([ii, "a", "b"], key.Continue([ii, "ab"])),
|
||||
TestCase([ii, "ab", "\u{007F}"], key.Continue([ii, "a"])),
|
||||
TestCase([ii, "ab", "\r"], key.Input("ab")),
|
||||
TestCase([return], key.Return),
|
||||
TestCase([backspace], key.Backspace),
|
||||
]
|
||||
|
||||
let test_cases = [base_tests, char_tests, escape_tests, input_tests]
|
||||
|
||||
Reference in new issue
Block a user