Ensure that command usage information always ends with a newline

develop
lethosor 2015-02-16 20:17:47 -05:00
parent b7f15ef2d6
commit c399377f08
1 changed files with 8 additions and 0 deletions

@ -98,6 +98,7 @@ namespace DFHack
function(function_), interactive(interactive_), function(function_), interactive(interactive_),
guard(NULL), usage(usage_) guard(NULL), usage(usage_)
{ {
fix_usage();
} }
PluginCommand(const char * _name, PluginCommand(const char * _name,
@ -109,6 +110,13 @@ namespace DFHack
function(function_), interactive(false), function(function_), interactive(false),
guard(guard_), usage(usage_) guard(guard_), usage(usage_)
{ {
fix_usage();
}
void fix_usage()
{
if (usage.size() && usage[usage.size() - 1] != '\n')
usage.push_back('\n');
} }
bool isHotkeyCommand() const { return guard != NULL; } bool isHotkeyCommand() const { return guard != NULL; }