Skip to content
Snippets Groups Projects
Commit 051cf24f authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Some more mnemonics() and do theoretical 40-col support

parent 89feb588
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,7 @@ var pos = 0; ...@@ -8,6 +8,7 @@ var pos = 0;
var len = 0; var len = 0;
var msglens = []; var msglens = [];
var displaywith = 0; var displaywith = 0;
var inprow = (console.screen_columns < 80) ? 18 : 17;
// TODO: This should be in a separate (JSON) file... // TODO: This should be in a separate (JSON) file...
var details = { var details = {
...@@ -17,9 +18,18 @@ var details = { ...@@ -17,9 +18,18 @@ var details = {
'DirLibOrAll': { 'DirLibOrAll': {
'displaywith': 1, 'displaywith': 1,
}, },
'DoYouMeanThisUserQ': {
'displaywith': 1,
},
'ExtractFilesPrompt': {
'displaywith': 1,
},
'FileInfoEditPrompt': { 'FileInfoEditPrompt': {
'displaywith': 1, 'displaywith': 1,
}, },
'FileInfoPrompt': {
'displaywith': 1,
},
'JoinWhichDir': { 'JoinWhichDir': {
'displaywith': 1, 'displaywith': 1,
}, },
...@@ -62,6 +72,12 @@ var details = { ...@@ -62,6 +72,12 @@ var details = {
'QuitOrNext': { 'QuitOrNext': {
'displaywith': 1, 'displaywith': 1,
}, },
'QuoteLinesPrompt': {
'displaywith': 1,
},
'QWKCtrlACodes': {
'displaywith': 1,
},
'RExemptRemoveFilePrompt': { 'RExemptRemoveFilePrompt': {
'displaywith': 1, 'displaywith': 1,
}, },
...@@ -117,7 +133,7 @@ function format_entry(str) ...@@ -117,7 +133,7 @@ function format_entry(str)
{ {
// bbs.command_str = '@'; // bbs.command_str = '@';
// .replace(/@/g, "@U+40:@@") // .replace(/@/g, "@U+40:@@")
return str.replace(/[\x00-\x1F]/g, function(match) { return str.replace(/[\x00-\x1F\x80-\x9F]/g, function(match) {
switch(match) { switch(match) {
case '\n': case '\n':
return "\\n"; return "\\n";
...@@ -132,7 +148,9 @@ function format_entry(str) ...@@ -132,7 +148,9 @@ function format_entry(str)
case '\f': case '\f':
return "\\f"; return "\\f";
default: default:
return '\x01'+'7\x01'+'B^' + String.fromCharCode(match.charCodeAt(0)+64) + "\x01"+'0\x01'+'w'; if (match < ' ')
return '\x01'+'7\x01'+'B^' + String.fromCharCode(match.charCodeAt(0)+64) + "\x01"+'0\x01'+'w';
return '\x01'+'7\x01'+'B^' + format("%02X", match.charCodeAt(0)) + "\x01"+'0\x01'+'w';
} }
}); });
} }
...@@ -243,6 +261,8 @@ function redraw(str, num) ...@@ -243,6 +261,8 @@ function redraw(str, num)
console.print("Example text\r\nbefore message.\r\n"); console.print("Example text\r\nbefore message.\r\n");
console.question = "Example question"; console.question = "Example question";
// Stuff in a CTRL-C for things like @EXEC:yesnobar@ // Stuff in a CTRL-C for things like @EXEC:yesnobar@
// TODO: This doesn't work for some reason after the input fix
// in terminal-abstraction branch.
console.ungetkeys(ctrl('C'), true); console.ungetkeys(ctrl('C'), true);
switch (displaywith) { switch (displaywith) {
case 0: case 0:
...@@ -261,9 +281,18 @@ function redraw(str, num) ...@@ -261,9 +281,18 @@ function redraw(str, num)
// Pull out the CTRL-C // Pull out the CTRL-C
console.inkey(); console.inkey();
console.print("Example text after message.\r\n"); console.print("Example text after message.\r\n");
console.gotoxy(0,16); if (console.screen_columns < 80) {
console.print(a + "h" + a + "w" + a + "4" + " " + df + " ^^ As seen on BBS ^^" + " vv " + tnames[num] + " (" + num + ") vv" + a + ">"); console.gotoxy(0, inprow - 2);
console.gotoxy(0,17); console.print(a + "h" + a + "w" + a + "4" + " " + df + " ^^ As seen on BBS ^^" + a + ">");
console.gotoxy(0, inprow - 1);
console.print(a + "h" + a + "w" + a + "4" + " vv " + tnames[num] + " (" + num + ") vv" + a + ">");
console.gotoxy(0, inprow);
}
else {
console.gotoxy(0, inprow - 1);
console.print(a + "h" + a + "w" + a + "4" + " " + df + " ^^ As seen on BBS ^^" + " vv " + tnames[num] + " (" + num + ") vv" + a + ">");
console.gotoxy(0, inprow);
}
console.cleartoeos(7); console.cleartoeos(7);
console.print(format_entry(bbs.text(msg))); console.print(format_entry(bbs.text(msg)));
place_cursor(); place_cursor();
...@@ -289,8 +318,11 @@ function newmsg() ...@@ -289,8 +318,11 @@ function newmsg()
msglens = []; msglens = [];
for (i = 0; i < rmsg.length; i++) { for (i = 0; i < rmsg.length; i++) {
msglens.push({'tpos': tpos, 'spos': spos}); msglens.push({'tpos': tpos, 'spos': spos});
// TODO: 0x80-0x9f should be escaped as well.
if (rmsg[i] < ' ') if (rmsg[i] < ' ')
tpos++; tpos++;
else if (rmsg[i] >= '\x80' && rmsg[i] <= '\x9F')
tpos++;
tpos++; tpos++;
spos++; spos++;
} }
...@@ -306,7 +338,7 @@ function newmsg() ...@@ -306,7 +338,7 @@ function newmsg()
function place_cursor() function place_cursor()
{ {
console.gotoxy(0, 17); console.gotoxy(0, inprow);
var np = msglens[pos].tpos; var np = msglens[pos].tpos;
while (np >= console.screen_columns) { while (np >= console.screen_columns) {
console.linefeed(); console.linefeed();
...@@ -318,7 +350,10 @@ function place_cursor() ...@@ -318,7 +350,10 @@ function place_cursor()
function get_msgnum() function get_msgnum()
{ {
console.gotoxy(42, 16); if (console.screen_columns < 80)
console.gotoxy(1, inprow - 1);
else
console.gotoxy(42, inprow - 1);
console.attributes = 0x1F; console.attributes = 0x1F;
console.cleartoeol(); console.cleartoeol();
var ret = console.getnum(last_entry, msg); var ret = console.getnum(last_entry, msg);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment