diff options
-rw-r--r-- | src/jsMain/kotlin/moe/nea89/website/KConsole.kt | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/jsMain/kotlin/moe/nea89/website/KConsole.kt b/src/jsMain/kotlin/moe/nea89/website/KConsole.kt index 7cf7d6c..a7b1102 100644 --- a/src/jsMain/kotlin/moe/nea89/website/KConsole.kt +++ b/src/jsMain/kotlin/moe/nea89/website/KConsole.kt @@ -181,7 +181,8 @@ class KConsole( fun keydown(event: KeyboardEvent) { if (event.altKey || event.metaKey) return if (event.ctrlKey) { - handleControlDown(event); return + handleControlDown(event) + return } if (event.isComposing) return if (state != ConsoleState.SHELLPROMPT) return @@ -212,16 +213,16 @@ class KConsole( rerender() scrollDown() } -} -fun handleControlDown(event: KeyboardEvent){ + + + fun handleControlDown(event: KeyboardEvent){ if (event.key == "v"){ - window.navigator.clipboard.readText().then{ + event.preventDefault() + window.navigator.clipboard.readText().then { input += it - event.preventDefault() rerender() scrollDown() } - } } } |