diff --git a/src/cg/10-os.cg b/src/cg/10-os.cg index 3ccb020..228bc62 100644 --- a/src/cg/10-os.cg +++ b/src/cg/10-os.cg @@ -32,6 +32,7 @@ os = focusWindow = index \ batch [ + osState.palette.visible := False, osState.wm.focusedIndex := index, osState.wm.scrollOffset := scrollToWindow index ]; @@ -167,13 +168,20 @@ os = Item { label = q } ]; + openOrFocus = title content \ + index title (map (w \ w.title) osState.windows) + | Some i \ focusWindow i + | None \ openWindow title content; + onSelect = input \ result = eval input; - _ = debug "onSelect eval result" result; result + | Defined name \ openOrFocus name (size \ inspector { name = name, w = size.w, h = size.h }) + | Value v \ (getSource input == "" - | True \ openWindow input (_ \ ui.text { content = show v, color = "white" }) - | False \ openWindow input (size \ inspector { name = input, w = size.w, h = size.h })); + | True \ openOrFocus input (_ \ ui.text { content = show v, color = "white" }) + | False \ openOrFocus input (size \ inspector { name = input, w = size.w, h = size.h })) + | Err msg \ (_ = debug "Error" msg; noOp); handleFocusLeftEvent = state \ newIndex = max 0 (osState.wm.focusedIndex - 1);