CmdHistory: Fixed bug where all strategies were rendered in the wrong width

This commit is contained in:
Paul Beckingham 2017-03-23 01:51:22 -04:00
parent 0b4fa9472d
commit 7490663d9e

View file

@ -60,7 +60,7 @@ CmdHistoryBase<HistoryStrategy>::CmdHistoryBase ()
template<class HistoryStrategy> template<class HistoryStrategy>
void CmdHistoryBase<HistoryStrategy>::outputGraphical (std::string &output) void CmdHistoryBase<HistoryStrategy>::outputGraphical (std::string &output)
{ {
auto widthOfBar = context.getWidth () - 15; // 15 == strlen ("2008 September ") auto widthOfBar = context.getWidth () - HistoryStrategy::labelWidth;
// Now build the view. // Now build the view.
Table view; Table view;
@ -319,6 +319,7 @@ public:
static constexpr const char* description = STRING_CMD_HISTORY_USAGE_M; static constexpr const char* description = STRING_CMD_HISTORY_USAGE_M;
static constexpr unsigned int dateFieldCount = 2; static constexpr unsigned int dateFieldCount = 2;
static constexpr bool graphical = false; static constexpr bool graphical = false;
static constexpr unsigned int labelWidth = 0; // unused.
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -420,6 +421,7 @@ public:
static constexpr const char* description = STRING_CMD_GHISTORY_USAGE_M; static constexpr const char* description = STRING_CMD_GHISTORY_USAGE_M;
static constexpr unsigned int dateFieldCount = 2; static constexpr unsigned int dateFieldCount = 2;
static constexpr bool graphical = true; static constexpr bool graphical = true;
static constexpr unsigned int labelWidth = 15; // length '2017 September ' = 15
}; };
////////////////////////////////////////////////////////////////////////////i ////////////////////////////////////////////////////////////////////////////i
@ -459,6 +461,7 @@ public:
static constexpr const char* description = STRING_CMD_GHISTORY_USAGE_A; static constexpr const char* description = STRING_CMD_GHISTORY_USAGE_A;
static constexpr unsigned int dateFieldCount = 1; static constexpr unsigned int dateFieldCount = 1;
static constexpr bool graphical = true; static constexpr bool graphical = true;
static constexpr unsigned int labelWidth = 5; // length '2017 ' = 5
}; };
////////////////////////////////////////////////////////////////////////////i ////////////////////////////////////////////////////////////////////////////i
@ -498,6 +501,7 @@ public:
static constexpr const char* description = STRING_CMD_HISTORY_USAGE_A; static constexpr const char* description = STRING_CMD_HISTORY_USAGE_A;
static constexpr unsigned int dateFieldCount = 1; static constexpr unsigned int dateFieldCount = 1;
static constexpr bool graphical = false; static constexpr bool graphical = false;
static constexpr unsigned int labelWidth = 0; // unused.
}; };
@ -545,6 +549,7 @@ public:
static constexpr const char* description = STRING_CMD_HISTORY_USAGE_D; static constexpr const char* description = STRING_CMD_HISTORY_USAGE_D;
static constexpr unsigned int dateFieldCount = 3; static constexpr unsigned int dateFieldCount = 3;
static constexpr bool graphical = false; static constexpr bool graphical = false;
static constexpr unsigned int labelWidth = 0; // unused.
}; };
////////////////////////////////////////////////////////////////////////////i ////////////////////////////////////////////////////////////////////////////i
@ -591,6 +596,7 @@ public:
static constexpr const char* description = STRING_CMD_GHISTORY_USAGE_D; static constexpr const char* description = STRING_CMD_GHISTORY_USAGE_D;
static constexpr unsigned int dateFieldCount = 3; static constexpr unsigned int dateFieldCount = 3;
static constexpr bool graphical = true; static constexpr bool graphical = true;
static constexpr unsigned int labelWidth = 19; // length '2017 September Day ' = 19
}; };
////////////////////////////////////////////////////////////////////////////i ////////////////////////////////////////////////////////////////////////////i
@ -637,6 +643,7 @@ public:
static constexpr const char* description = STRING_CMD_HISTORY_USAGE_W; static constexpr const char* description = STRING_CMD_HISTORY_USAGE_W;
static constexpr unsigned int dateFieldCount = 3; static constexpr unsigned int dateFieldCount = 3;
static constexpr bool graphical = false; static constexpr bool graphical = false;
static constexpr unsigned int labelWidth = 0; // unused.
}; };
////////////////////////////////////////////////////////////////////////////i ////////////////////////////////////////////////////////////////////////////i
@ -683,6 +690,7 @@ public:
static constexpr const char* description = STRING_CMD_GHISTORY_USAGE_W; static constexpr const char* description = STRING_CMD_GHISTORY_USAGE_W;
static constexpr unsigned int dateFieldCount = 3; static constexpr unsigned int dateFieldCount = 3;
static constexpr bool graphical = true; static constexpr bool graphical = true;
static constexpr unsigned int labelWidth = 19; // length '2017 September Day ' = 19
}; };