fixing some bugs

master
Dustin Swan 2 weeks ago
parent 80cd8d6c7b
commit 5fc9d13f80
Signed by: dustinswan
GPG Key ID: 30D46587E2100467

@ -51,6 +51,14 @@ palette = config \
| True \ y + h - listHeight | True \ y + h - listHeight
| False \ offset)); | False \ offset));
onSelect = text \
batch [
paletteState.query := "",
paletteState.focusedIndex := 0,
paletteState.scrollOffset := 0,
config.onSelect text,
];
paletteRow = config \ paletteRow = config \
color = (config.selected | True \ "rgba(255,255,255,0.2)" | False \ "transparent"); color = (config.selected | True \ "rgba(255,255,255,0.2)" | False \ "transparent");
@ -85,8 +93,8 @@ palette = config \
newIndex = nextSelectable results effectiveIndex 1; newIndex = nextSelectable results effectiveIndex 1;
{ state = state, emit = [paletteState.focusedIndex := newIndex, paletteState.scrollOffset := scrollTo newIndex] }) { state = state, emit = [paletteState.focusedIndex := newIndex, paletteState.scrollOffset := scrollTo newIndex] })
| Key { key = "Enter" } \ | Key { key = "Enter" } \
(nth paletteState.focusedIndex results (nth effectiveIndex results
| Some (Item data) \ { state = state, emit = [paletteState.focusedIndex := 0, config.onSelect data.label] } | Some (Item data) \ { state = state, emit = [onSelect data.label] }
| _ \ { state = state, emit = [] }) | _ \ { state = state, emit = [] })
| _ \ { state = state, emit = [] }, | _ \ { state = state, emit = [] },
@ -138,7 +146,7 @@ palette = config \
w = contentWidth, w = contentWidth,
h = textInputHeight, h = textInputHeight,
selected = (effectiveIndex == i), selected = (effectiveIndex == i),
onClick = _ \ config.onSelect data.label onClick = _ \ onSelect data.label
} }
| _ \ empty | _ \ empty
) results) ) results)

@ -27,7 +27,7 @@ openWindow = title content \
fullWidth = False fullWidth = False
}], }],
osState.palette.visible := False, osState.palette.visible := False,
focusWindow id focusWindow (len osState.windows)
]; ];
closeWindowByIndex = i \ closeWindowByIndex = i \

Loading…
Cancel
Save