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3525QPNL3QYLNBAC
DF5LOTJFSXOT7UBDHLBDLGA22OY4L7ZF6CVFP6H3KL4N5CHB5C5QC
VRFQK6S2TXOFFO5K5HRDXPR7QEKKAZAVCASSIJVPWQ4GE26UOGTQC
GOPBXMJ7EKKPDSDXCANWW6ARWGNLOQ5DK7WI4UPD7K2GCDSK2HXAC
IHOKNI4O7EEW4UBMKHP6XOZNEIQSW4AYOT4O3JXUIXNNR553IQAQC
const unsigned int lineWidth = get_number_of_cols() - 1;
const int height = get_number_of_lines();
std::string desc;
if (title.empty())
desc = d;
else
{
desc = title + "$$";
desc += d;
}
int num_lines = _count_desc_lines(desc, lineWidth) + 1;
const int suffix_lines = _count_desc_lines(suffix, lineWidth);
const int prefix_lines = _count_desc_lines(prefix, lineWidth);
const int footer_lines = _count_desc_lines(footer, lineWidth)
+ (footer.empty() ? 0 : 1);
// Prefer the footer over the suffix
if (num_lines + suffix_lines + footer_lines <= height)
{
desc = desc + suffix;
num_lines += suffix_lines;
}
// Prefer the footer over the prefix
if (num_lines + prefix_lines + footer_lines <= height)
{
desc = prefix + desc;
num_lines += prefix_lines;
}
if (!footer.empty() && num_lines + footer_lines <= height)
{
const int bottom_line = std::min(std::max(24, num_lines + 2),
height - footer_lines + 1);
const int newlines = bottom_line - num_lines;
if (newlines >= 0)
{
desc.append(newlines, '\n');
desc = desc + footer;
}
}
clrscr();
print_description(key + desc);
if (!footer.empty())
{
int num_lines = linebreak_string2(footer, width);
num_lines++;
// So the footer doesn't get lonely on large displays. :)
const int bottom_line = std::min(30, get_number_of_lines());
cgotoxy(1, bottom_line - num_lines);
cprintf(footer.c_str());
}