diff options
author | einsJannis <einsJannis@gmail.com> | 2021-08-16 16:10:30 +0200 |
---|---|---|
committer | einsJannis <einsJannis@gmail.com> | 2021-08-16 16:10:39 +0200 |
commit | ad7ad4bda991a2e45f81512b56bde71546c53a54 (patch) | |
tree | cb09c5eef16312ef5c34ea8f57cde15c779609f6 | |
parent | c7d1477e3d8e5db7e504c38af7ee0a3113adae43 (diff) | |
download | webos-ad7ad4bda991a2e45f81512b56bde71546c53a54.tar.gz webos-ad7ad4bda991a2e45f81512b56bde71546c53a54.tar.bz2 webos-ad7ad4bda991a2e45f81512b56bde71546c53a54.zip |
Added function keys
-rw-r--r-- | src/jsMain/kotlin/WebOS.kt | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/jsMain/kotlin/WebOS.kt b/src/jsMain/kotlin/WebOS.kt index d908363..680ded7 100644 --- a/src/jsMain/kotlin/WebOS.kt +++ b/src/jsMain/kotlin/WebOS.kt @@ -91,6 +91,7 @@ sealed class Key { object Finish : Key() object Help : Key() class Printable(val char: Char) : Key() + class FunctionN(val n: Int) : Key() companion object { fun from(string: String) = when (string) { "Alt" -> Alt @@ -138,7 +139,11 @@ sealed class Key { "Find" -> Find "Finish" -> Finish "Help" -> Help - else -> if (string.length == 1) Printable(string.first()) else throw TODO() + else -> if (string.length == 1) + Printable(string.first()) + else if (string.first() == 'F') + FunctionN(string.substring(1).toInt()) + else throw TODO() } } } |