From ad7ad4bda991a2e45f81512b56bde71546c53a54 Mon Sep 17 00:00:00 2001 From: einsJannis Date: Mon, 16 Aug 2021 16:10:30 +0200 Subject: Added function keys --- src/jsMain/kotlin/WebOS.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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() } } } -- cgit