new build
Some checks failed
/ mirror_to_github (push) Failing after 4m24s
/ test (push) Successful in 9s

This commit is contained in:
Leon van Kammen 2025-04-10 16:58:28 +02:00
parent 0ab3eadcf0
commit 2565aa3a70
4 changed files with 17 additions and 5 deletions

@ -1 +1 @@
Subproject commit 6f0481830bbc880ba2210aa61aa752a184717b77
Subproject commit 6cfeaefe01b66e6329f8636af63128533861be89

BIN
xrsh.com

Binary file not shown.

View file

@ -1 +1 @@
d88d0d16b60fb002694b7d31118c877e960d398c6bc19dfc1cd6d90e542d13e8 xrsh.com
d25cabf0091a73f78e13c6a3135aad6178dc4708c02733446ab659b018cdfe96 xrsh.com

18
xrsh.js
View file

@ -2532,6 +2532,7 @@ function Term(options)
{
}
this.options = options
width = options.cols ? options.cols : 80;
height = options.rows ? options.rows : 25;
scrollback = options.scrollback ? options.scrollback : 0;
@ -2602,6 +2603,9 @@ function Term(options)
this.linux_console = true;
this.textarea_has_focus = false;
// remember last data (to help WebXRKeyboard decide whether onblur should imply 'enter')
this.last = { keydown: '', input: '', inputValue: ''}
}
Term.prototype.setKeyHandler = function(handler)
@ -3655,6 +3659,7 @@ Term.prototype.keyDownHandler = function (ev)
}
break;
}
this.last.keydown = str
// console.log("keydown: keycode=" + ev.keyCode + " charcode=" + ev.charCode + " str=" + str + " ctrl=" + ev.ctrlKey + " alt=" + ev.altKey + " meta=" + ev.metaKey);
if (str) {
if (ev.stopPropagation)
@ -3705,7 +3710,13 @@ Term.prototype.to_utf8 = function(s)
Term.prototype.inputHandler = function (ev)
{
var str;
str = this.textarea_el.value;
// edge-case: Meta's WebXRKeyboard implementation requires us to use .value
str = this.last.input = this.textarea_el.value.split("").pop();
// edge-case: detect backspace based on length-change [Meta's WebXRKeyboard]
if( (this.textarea_el.value.length + 1) == this.last.inputValue.length ){
str = '\b'
}
this.last.inputValue = this.textarea_el.value
if (str) {
this.textarea_el.value = "";
this.show_cursor();
@ -3744,6 +3755,7 @@ Term.prototype.blurHandler = function (ev)
/* allow unloading the page */
window.onbeforeunload = null;
this.textarea_has_focus = false;
if( this.last.keydown != "\n" && this.last.input && this.options.isWebXRKeyboard() ) this.handler("\n")
};
Term.prototype.pasteHandler = function (ev)
@ -4156,9 +4168,9 @@ ISOTerminal.prototype.TermInit = function(){
rows: aEntity.rows,
el_or_id: el,
scrollback: aEntity.rows*3,
fontSize: null //
fontSize: null,
//rainbow: [Term.COLOR_MAGENTA, Term.COLOR_CYAN ],
//xr: AFRAME.scenes[0].renderer.xr,
isWebXRKeyboard: () => AFRAME.scenes[0].renderer.xr.isPresenting && AFRAME.scenes[0].renderer.xr.getSession().isSystemKeyboardSupported, // naive way
//map: {
// 'ArrowRight': { ch: false, ctrl: '\x1b\x66' }, // this triggers ash-shell forward-word
// 'ArrowLeft': { ch: false, ctrl: '\x1b\x62' } // backward-word