Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web: handle query string input line by line #206

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions numbat-wasm/www/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ function interpret(input) {
output = result.output;

if (!result.is_error) {
combined_input += input + "\n";
updateUrlQuery(combined_input.trim());
combined_input += input.trim() + "";
updateUrlQuery(combined_input);
}
}

Expand Down Expand Up @@ -87,7 +87,12 @@ function main() {
if (location.search) {
var queryParams = new URLSearchParams(location.search);
if (queryParams.has("q")) {
term.exec(queryParams.get("q"));
// feed in the query line by line, as if the user typed it in
for (const line of queryParams.get("q").split("⏎")) {
if (line.trim().length > 0) {
term.exec(line.trim() + "\n");
}
}
}
}
});
Expand Down