xP: make Page Up/Down in editor scroll the buffer
Just like in xW recently. It is unlikely that the user would want to use these keys to move the cursor. Ctrl+Home/End still work, as does holding Up/Down arrows. Also stop using the deprecated and somewhat cryptic keyCode.
This commit is contained in:
parent
8b5ea67aff
commit
c157d3369f
|
@ -1013,10 +1013,23 @@ let Input = {
|
||||||
} else if (!event.altKey && !event.ctrlKey && !event.metaKey &&
|
} else if (!event.altKey && !event.ctrlKey && !event.metaKey &&
|
||||||
!event.shiftKey) {
|
!event.shiftKey) {
|
||||||
handled = true
|
handled = true
|
||||||
switch (event.keyCode) {
|
switch (event.key) {
|
||||||
case 9: success = Input.complete(b, textarea); break
|
case 'PageUp':
|
||||||
case 13: success = Input.submit(b, textarea); break
|
Array.from(document.getElementsByClassName('buffer'))
|
||||||
default: handled = false
|
.forEach(b => b.scrollBy(0, -b.clientHeight))
|
||||||
|
break
|
||||||
|
case 'PageDown':
|
||||||
|
Array.from(document.getElementsByClassName('buffer'))
|
||||||
|
.forEach(b => b.scrollBy(0, +b.clientHeight))
|
||||||
|
break
|
||||||
|
case 'Tab':
|
||||||
|
success = Input.complete(b, textarea);
|
||||||
|
break
|
||||||
|
case 'Enter':
|
||||||
|
success = Input.submit(b, textarea);
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
handled = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!success)
|
if (!success)
|
||||||
|
|
Loading…
Reference in New Issue