diff --git a/exec/xtrn_sec.js b/exec/xtrn_sec.js index ab412942a4fb9c2a0580aebf6b0c7bf3d9489d73..e2b7540d2160a126b4b5b3d9c4ac86d43b719aae 100644 --- a/exec/xtrn_sec.js +++ b/exec/xtrn_sec.js @@ -215,6 +215,10 @@ function external_section_menu() { var i,j; var xsec=0; + var longest = 0; + for(i = 0; i < xtrn_area.sec_list.length; i++) + longest = Math.max(xtrn_area.sec_list[i].name.length, longest); + var margin = options.center ? format("%*s", ((console.screen_columns - longest)/2) - 5, "") : ""; while(bbs.online) { @@ -238,7 +242,7 @@ function external_section_menu() if(options.clear_screen) console.clear(LIGHTGRAY); - bbs.menu("xtrn_sec_head", P_NOERROR); + var show_header = !bbs.menu("xtrn_sec_head", P_NOERROR); if(bbs.menu_exists("xtrn_sec")) { bbs.menu("xtrn_sec"); @@ -248,16 +252,23 @@ function external_section_menu() if(options.sort) sec_list.sort(sort_by_name); - printf(options.section_header_fmt.replace('\x01l', ''), options.section_header_title); + if(show_header) + printf(margin + options.section_header_fmt.replace('\x01l', ''), options.section_header_title); for (i = 0; i < sec_list.length; i++) { console.add_hotspot(i+1); - printf(options.section_fmt, i + 1, sec_list[i].name); + printf(margin + options.section_fmt, i + 1, sec_list[i].name); } bbs.menu("xtrn_sec_tail", P_NOERROR); bbs.node_sync(); - console.mnemonics(format(options.section_which, xsec + 1)); + if(options.center) { + console.crlf(); + write(margin); + console.mnemonics(format(options.section_which, xsec + 1).trimLeft()); + } + else + console.mnemonics(format(options.section_which, xsec + 1)); } bbs.node_sync();