Skip to content

Commit

Permalink
Merge branch 'main' into persist-history
Browse files Browse the repository at this point in the history
  • Loading branch information
printfn authored Oct 25, 2024
2 parents bb01296 + 78e97fa commit 1408c62
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
## Changelog

## Next
* Add `text` as a synonym for `string`
* Keep history after reloading the web UI
* Add `text` as a synonym for `string` (e.g. `5 to text`)
* Add `Cmd`+`k` / `Ctrl`+`k` or `Ctrl`+`l` to clear the web UI output
* Fix multiline input not being visible in the web UI
* Persist command history in the browser's local storage when using the web UI

### v1.5.3 (2024-10-06)

Expand Down
12 changes: 10 additions & 2 deletions web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default function App({ widget = false }: { widget?: boolean }) {
(async () => {
// allow multiple lines to be entered if shift, ctrl
// or meta is held, otherwise evaluate the expression
if (!(event.key === 'Enter' && !event.shiftKey && !event.ctrlKey && !event.metaKey)) {
if (!(event.key === 'Enter' && !event.shiftKey && !event.ctrlKey && !event.metaKey && !event.altKey)) {
return;
}
event.preventDefault();
Expand Down Expand Up @@ -123,6 +123,14 @@ export default function App({ widget = false }: { widget?: boolean }) {
);
const navigate = useCallback(
(event: KeyboardEvent<HTMLTextAreaElement>) => {
if (
(event.key === 'k' && event.metaKey !== event.ctrlKey && !event.altKey) ||
(event.key === 'l' && event.ctrlKey && !event.metaKey && !event.altKey)
) {
// Cmd+K, Ctrl+K or Ctrl+L to clear the buffer
setOutput(null);
return;
}
if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown') {
return;
}
Expand Down Expand Up @@ -169,7 +177,7 @@ export default function App({ widget = false }: { widget?: boolean }) {
autoCapitalize="none"
spellCheck="false"
id="input-text"
rows={1}
rows={currentInput.split('\n').length}
ref={inputText}
value={currentInput}
onInput={update}
Expand Down

0 comments on commit 1408c62

Please sign in to comment.