Scoop API

scoop:scoop.surface:0.1.0

src/shared/input/menu_commands.scoop

Selected production source · src/shared/input/menu_commands.scoop

1package scoop.surface
3import scoop.window.TextCommandAvailability
5internal fun InputRouter.changeTextCommands(value: TextCommandAvailability?) {
6 if (publishedTextCommands != value) {
7 publishTextCommands(value)
8 publishedTextCommands = value
9 }
12internal fun InputRouter.refreshTextCommands() {
13 var value = TextCommandAvailability()
14 if (osFocused) {
15 when (activeFocus) {
16 case Some(val area) -> if (allowsFocus(area.scope) && allows(area.scope)) {
17 var cursor: InputScope? = Some(area.scope)
18 while (true) {
19 val current = cursor ?: break
20 when (current.textCommandAvailability) {
21 case Some(val commands) -> {
22 value = commands;
23 break
24 }
25 case None -> {}
26 }
27 if (current === focusRoot)
28 break
29 cursor = current.parent
30 }
31 }
32 case None -> {}
33 }
34 }
35 changeTextCommands(Some(value))