fix shift-up focus issue and enter-key always clearing focus

This commit is contained in:
Brenden Tuck 2019-08-18 19:49:58 -04:00
parent 792b52a77c
commit e14b09c904
2 changed files with 15 additions and 2 deletions

View file

@ -34,8 +34,18 @@ let defaultin_plugin = (function () {
}
inputfield.val(""); // Clear this inputfield
event.preventDefault();
}
inputfield.blur();
// enter key by itself should toggle focus
if( inputfield.length < 1 ) {
inputfield = $(".inputfield:last");
inputfield.focus();
if( inputfield.length < 1 ) { // non-goldenlayout backwards compatibility
$("#inputfield").focus();
}
} else {
inputfield.blur();
}
} // else allow building a multi-line input command
break;
// Anything else, focus() a textarea if needed, and allow the default event

View file

@ -63,6 +63,9 @@ let history = (function () {
// Doing a history navigation; replace the text in the input and
// move the cursor to the end of the new value
var inputfield = $(".inputfield:focus");
if( inputfield.length < 1 ) { // focus the default (last), if nothing focused
inputfield = $(".inputfield:last");
}
if( inputfield.length < 1 ) { // pre-goldenlayout backwards compatibility
inputfield = $("#inputfield");
}