|
|
@ -38,6 +38,8 @@ import androidx.compose.ui.input.key.Key |
|
|
|
import androidx.compose.ui.input.key.isCtrlPressed |
|
|
|
import androidx.compose.ui.input.key.isCtrlPressed |
|
|
|
import androidx.compose.ui.input.key.key |
|
|
|
import androidx.compose.ui.input.key.key |
|
|
|
import androidx.compose.ui.input.key.onPreviewKeyEvent |
|
|
|
import androidx.compose.ui.input.key.onPreviewKeyEvent |
|
|
|
|
|
|
|
import androidx.compose.ui.input.key.type |
|
|
|
|
|
|
|
import androidx.compose.ui.input.key.KeyEventType |
|
|
|
import androidx.compose.ui.unit.dp |
|
|
|
import androidx.compose.ui.unit.dp |
|
|
|
import androidx.compose.ui.window.singleWindowApplication |
|
|
|
import androidx.compose.ui.window.singleWindowApplication |
|
|
|
|
|
|
|
|
|
|
@ -53,12 +55,12 @@ fun main() = singleWindowApplication { |
|
|
|
onValueChange = { text = it }, |
|
|
|
onValueChange = { text = it }, |
|
|
|
modifier = Modifier.onPreviewKeyEvent { |
|
|
|
modifier = Modifier.onPreviewKeyEvent { |
|
|
|
when { |
|
|
|
when { |
|
|
|
(it.isCtrlPressed && it.key == Key.Minus) -> { |
|
|
|
(it.isCtrlPressed && it.key == Key.Minus && it.type == KeyEventType.KeyUp) -> { |
|
|
|
consumedText -= text.length |
|
|
|
consumedText -= text.length |
|
|
|
text = "" |
|
|
|
text = "" |
|
|
|
true |
|
|
|
true |
|
|
|
} |
|
|
|
} |
|
|
|
(it.isCtrlPressed && it.key == Key.Equals) -> { |
|
|
|
(it.isCtrlPressed && it.key == Key.Equals && it.type == KeyEventType.KeyUp) -> { |
|
|
|
consumedText += text.length |
|
|
|
consumedText += text.length |
|
|
|
text = "" |
|
|
|
text = "" |
|
|
|
true |
|
|
|
true |
|
|
|