Skip to content
Snippets Groups Projects
Commit 3470d723 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

"center" feature/option added and text.dat section header suppression

Add support for modopts.ini "center=true" option to center single-column
program listing in the terminal.

When a custom section header files (xtrn<sec>_head.*) is displayed, don't
print the XtrnProgLstHdr string from the text.dat.
parent b5626f85
Branches
Tags
1 merge request!463MRC mods by Codefenix (2024-10-20)
......@@ -121,12 +121,15 @@ function external_program_menu(xsec)
if(options.clear_screen)
console.clear(LIGHTGRAY);
var show_header = true;
var secnum = xtrn_area.sec_list[xsec].number+1;
var seccode = xtrn_area.sec_list[xsec].code;
if(!bbs.menu("xtrn" + secnum + "_head", P_NOERROR) &&
!bbs.menu("xtrn" + seccode + "_head", P_NOERROR)) {
bbs.menu("xtrn_head", P_NOERROR);
show_header = !bbs.menu("xtrn_head", P_NOERROR);
}
else
show_header = false;
if(bbs.menu("xtrn" + secnum, P_NOERROR) || bbs.menu("xtrn" + seccode, P_NOERROR)) {
if(!bbs.menu("xtrn" + secnum + "_tail", P_NOERROR) &&
!bbs.menu("xtrn" + seccode + "_tail", P_NOERROR)) {
......@@ -135,11 +138,14 @@ function external_program_menu(xsec)
}
else {
var multicolumn = options.multicolumn && prog_list.length > options.singlecolumn_height;
var center = options.center && !multicolumn;
var margin = center ? format("%*s", (console.screen_columns * 0.25) - 1, "") : "";
if(options.sort)
prog_list.sort(sort_by_name);
printf(options.header_fmt, xtrn_area.sec_list[xsec].name);
if(show_header)
write(margin, format(options.header_fmt, xtrn_area.sec_list[xsec].name));
if(options.titles.trimRight() != '')
write(options.titles);
write(margin, options.titles);
if(multicolumn) {
write(options.multicolumn_separator);
if (options.titles.trimRight() != '')
......@@ -147,7 +153,7 @@ function external_program_menu(xsec)
}
if(options.underline.trimRight() != '') {
console.crlf();
write(options.underline);
write(margin, options.underline);
}
if(multicolumn) {
write(options.multicolumn_separator);
......@@ -162,6 +168,7 @@ function external_program_menu(xsec)
n=prog_list.length;
for(i=0;i<n && !console.aborted;i++) {
write(margin);
console.add_hotspot(i+1);
printf(multicolumn ? options.multicolumn_fmt : options.singlecolumn_fmt
,i+1
......@@ -185,6 +192,12 @@ function external_program_menu(xsec)
bbs.menu("xtrn_tail", P_NOERROR);
}
bbs.node_sync();
if(margin) {
console.crlf();
write(margin);
console.mnemonics(options.which.trimLeft());
}
else
console.mnemonics(options.which);
}
system.node_list[bbs.node_num-1].aux=0; /* aux is 0, only if at menu */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment