From a9d0aa1037d4a9560f2e0fa507a5b7f8a82bffbd Mon Sep 17 00:00:00 2001 From: Leon van Kammen Date: Thu, 28 Nov 2024 06:24:49 +0000 Subject: [PATCH] support pagedown/up --- com/isoterminal/VT100.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/com/isoterminal/VT100.js b/com/isoterminal/VT100.js index 57884c9..2465af8 100644 --- a/com/isoterminal/VT100.js +++ b/com/isoterminal/VT100.js @@ -129,7 +129,7 @@ function VT100(opts) this.key_buf_ = []; this.echo_ = false; this.esc_state_ = 0; - this.log_level_ = VT100.WARN + this.log_level_ = VT100.WARN //VT100.DEBUG this.clear_all(); @@ -262,14 +262,20 @@ VT100.handle_onkeypress_ = function VT100_handle_onkeypress(event,cb) ch = '\x1b'; case "Control": break; + case "PageDown": + ch = '\x1b[6~'; + break; + case "PageUp": + ch = '\x1b[5~'; + break; default: return true break; } - // custom map override - if( vt.opts.map[ event.code ].ch ) ch = vt.opts.map[ event.code ].ch - if( vt.opts.map[ event.code ].ctrl && event.ctrlKey ) ch = vt.opts.map[ event.code ].ctrl } + // custom map override + if( vt.opts.map[ event.code ]?.ch ) ch = vt.opts.map[ event.code ].ch + if( vt.opts.map[ event.code ]?.ctrl && event.ctrlKey ) ch = vt.opts.map[ event.code ].ctrl // Workaround: top the event from doing anything else. // (prevent input from adding characters instead of via VM)