ListStyle (compact) replacement for two-column tables

by calling CTable::SetStyle(CTable::ListStyle) one can switch from the
bulky and unreadable-on-narrow-devices-or-nonmonospaced-fonts tables to
a more compact list style of output. The first "column" will be bolded
for better visibility and seperated with a colon from the second.

This is currently designed to replace two column tables only.
This commit is contained in:
girst
2019-04-21 17:21:24 +02:00
parent 09a514ba02
commit 3988cfef98
3 changed files with 59 additions and 3 deletions

View File

@@ -1658,6 +1658,7 @@ void CClient::HelpUser(const CString& sFilter) {
CTable Table;
Table.AddColumn(t_s("Command", "helpcmd"));
Table.AddColumn(t_s("Description", "helpcmd"));
Table.SetStyle(CTable::ListStyle);
if (sFilter.empty()) {
PutStatus(
@@ -1670,7 +1671,8 @@ void CClient::HelpUser(const CString& sFilter) {
if (sFilter.empty() || sCmd.StartsWith(sFilter) ||
sCmd.AsLower().WildCmp(sFilter.AsLower())) {
Table.AddRow();
Table.SetCell(t_s("Command", "helpcmd"), sCmd + " " + sArgs);
Table.SetCell(t_s("Command", "helpcmd"),
sCmd + (sArgs.empty() ? "" : " ") + sArgs);
Table.SetCell(t_s("Description", "helpcmd"), sDesc);
}
};