Fixes for viewdata input redisplay and bottom line clearing, viewdata input_fields and dynamic_fields added *98#

This commit is contained in:
2024-12-08 18:00:24 +11:00
parent e72ffdc8a4
commit e15012965c
11 changed files with 76 additions and 23 deletions

View File

@@ -297,8 +297,8 @@ function rawtoattrs(contents,width,yoffset,xoffset,debug) {
// @todo remove the trailing ESC \ to end the field, just use a control code ^B \x02 (Start of Text) and ^C \x03
var m = line.match(/^\x1b_(([A-Z]+;[0-9a-z]+)([;]?.+)?)\x1b\\/);
if (m !== null) {
log(LOG_DEBUG,'Got input field: '+JSON.stringify(m));
log(LOG_DEBUG,'ansi:'+JSON.stringify(ansi));
log(LOG_DEBUG,'|-- Got input field: '+JSON.stringify(m));
//log(LOG_DEBUG,'|-- + ansi:'+JSON.stringify(ansi));
// full string that matched
match = m.shift();
@@ -356,7 +356,7 @@ function rawtoattrs(contents,width,yoffset,xoffset,debug) {
value: '',
});
log(LOG_DEBUG,'input_field:'+JSON.stringify(frame.input_fields.last));
log(LOG_DEBUG,'|-- * IF found at ['+x+'x'+y+'], Type: '+fieldtype+', Name: '+field+', Char: '+fieldchar+', Length: '+fieldlen+', Attribute: '+JSON.stringify(ansi));
}
/* parse dynamic value field */
@@ -373,7 +373,7 @@ function rawtoattrs(contents,width,yoffset,xoffset,debug) {
// We are interested in our field match
var df = m.shift().split(';');
log(LOG_DEBUG,'|--* DF found at ['+x+'x'+y+'], Field: '+df[0]+', Length: '+df[1]+', Pad:'+df[2]);
log(LOG_DEBUG,'|-- * DF found at ['+x+'x'+y+'], Field: '+df[0]+', Length: '+df[1]+', Pad:'+df[2]);
// If we are padding our field with a char, we need to add that back to line
// @todo validate if this goes beyond our width (and if scrolling not enabled)
line = (df[2] ? df[2] : '_').repeat(Math.abs(df[1]))+line;

View File

@@ -482,7 +482,7 @@ function SessionProtocol() {
write_raw(VIEWDATA_HOME+VIEWDATA_UP+msg+
((blp > msg.length)
? (' '.repeat(blp-msg.length)+(reposition ? VIEWDATA_HOME+VIEWDATA_UP+VIEWDATA_RIGHT.repeat(msg.length) : ''))
? (' '.repeat(2+blp-msg.length)+(reposition ? VIEWDATA_HOME+VIEWDATA_UP+VIEWDATA_RIGHT.repeat(msg.length) : ''))
: '')
);
@@ -542,10 +542,10 @@ function SessionProtocol() {
write_raw(VIEWDATA_HOME);
if (x > 0)
write_raw(VIEWDATA_RIGHT.repeat(x));
write_raw(VIEWDATA_RIGHT.repeat(x-1));
if (y > 0)
write_raw(VIEWDATA_DOWN.repeat(y));
write_raw(VIEWDATA_DOWN.repeat(y-1));
}
this.strlen = function(str) {