summaryrefslogtreecommitdiff
path: root/src/jsMain/kotlin
diff options
context:
space:
mode:
authoreinsJannis <einsJannis@gmail.com>2021-08-16 16:10:30 +0200
committereinsJannis <einsJannis@gmail.com>2021-08-16 16:10:39 +0200
commitad7ad4bda991a2e45f81512b56bde71546c53a54 (patch)
treecb09c5eef16312ef5c34ea8f57cde15c779609f6 /src/jsMain/kotlin
parentc7d1477e3d8e5db7e504c38af7ee0a3113adae43 (diff)
downloadwebos-ad7ad4bda991a2e45f81512b56bde71546c53a54.tar.gz
webos-ad7ad4bda991a2e45f81512b56bde71546c53a54.tar.bz2
webos-ad7ad4bda991a2e45f81512b56bde71546c53a54.zip
Added function keys
Diffstat (limited to 'src/jsMain/kotlin')
-rw-r--r--src/jsMain/kotlin/WebOS.kt7
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()
}
}
}