scoop:scoop.surface:0.1.0
src/shared/input/menu_commands.scoop
Selected production source · src/shared/input/menu_commands.scoop
1
package scoop.surface3
import scoop.window.TextCommandAvailability5
internal fun InputRouter.changeTextCommands(value: TextCommandAvailability?) {6
if (publishedTextCommands != value) {7
publishTextCommands(value)8
publishedTextCommands = value9
}10
}12
internal 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 ?: break20
when (current.textCommandAvailability) {21
case Some(val commands) -> {22
value = commands;23
break24
}25
case None -> {}26
}27
if (current === focusRoot)28
break29
cursor = current.parent30
}31
}32
case None -> {}33
}34
}35
changeTextCommands(Some(value))36
}