Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ for the time being.**

**STILL UNDER DEVELOPMENT; NOT RELEASED YET.**

* Issue #136: Fixed handling of key presses on the web interface so that they
don't interfere with browser shortcuts. This prevents Tab from stealing
focus from the terminal, the arrow keys from doing strange things when
"caret browsing" is enabled, and the slash key in Firefox from triggering a
search on the page.

* Issue #148: Fixed interactive line edits so that moving up and down through
history doesn't leave old characters behind when the cursor is in the middle
of a line (not at the end).
Expand Down
24 changes: 14 additions & 10 deletions web/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,37 +96,41 @@ if (isMobile) {
// https://stackoverflow.com/questions/30743490/capture-keys-typed-on-android-virtual-keyboard-using-javascript

var ignoreLastInput = false;
mobileInput.oninput = function(key) {
mobileInput.addEventListener("input", function(key) {
mobileInput.value = "";
if (!ignoreLastInput && key.data != '') {
osk.inject_input_event(key);
ignoreLastInput = true;
setTimeout(function() { ignoreLastInput = false; }, 5);
key.preventDefault();
}
};
mobileInput.onkeydown = function(key) {
});
mobileInput.addEventListener("keydown", function(key) {
mobileInput.value = "";
if (!ignoreLastInput && key.keyCode != 229) {
osk.inject_keyboard_event(key);
ignoreLastInput = true;
setTimeout(function() { ignoreLastInput = false; }, 5);
key.preventDefault();
}
};
});
} else {
mobileInput.onkeydown = function(key) {
mobileInput.addEventListener("keydown", function(key) {
mobileInput.value = "";
osk.inject_keyboard_event(key);
};
key.preventDefault();
});
}
terminal.onclick = function() {
terminal.addEventListener("click", function() {
mobileInput.focus();
}
});
mobileInput.focus();
} else {
mobileInput.hidden = true;
window.onkeydown = function(key) {
window.addEventListener("keydown", function(key) {
osk.inject_keyboard_event(key);
}
key.preventDefault();
});
terminal.focus();
}

Expand Down