Skip to content

Commit

Permalink
backspace support in bootmenu
Browse files Browse the repository at this point in the history
  • Loading branch information
coderofsalvation committed Jan 24, 2025
1 parent c537b49 commit f49b457
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion com/isoterminal/feat/term.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,16 @@ ISOTerminal.prototype.TermInit = function(){
this.term.el = el


// this is the default REPL
// please do not edit or replace this
// but instead extend/override ISOTerminal.prototype.boot.menu
// as demonstrated in index.html
this.term.setKeyHandler( (ch) => {
let erase = false
if( ch == '\x7F' ){
ch = "\b \b" // why does write() not just support \x7F ?
erase = true
}
if( this.boot.menu.selected ){
this.boot.menu.selected.keyHandler.call(this,ch)
}else if( (ch == "\n" || ch == "\r") ){
Expand All @@ -83,7 +92,7 @@ ISOTerminal.prototype.TermInit = function(){
}else{
this.term.write(ch)
}
this.lastChar = ch
if( !erase ) this.lastChar = ch
})
aEntity.el.addEventListener('focus', () => el.querySelector("textarea").focus() )
aEntity.el.addEventListener('serial-output-string', (e) => {
Expand Down

0 comments on commit f49b457

Please sign in to comment.