- Added ::getLimits, copied from CmdCustom, for more general use.
This commit is contained in:
Paul Beckingham 2014-07-04 11:03:23 -04:00
parent fa58c24c66
commit 0cd56932a5
2 changed files with 27 additions and 0 deletions

View file

@ -593,6 +593,32 @@ const std::vector <std::string> Context::getCommands () const
return output;
}
////////////////////////////////////////////////////////////////////////////////
// A value of zero mean unlimited.
// A value of 'page' means however many screen lines there are.
// A value of a positive integer is a row/task limit.
void Context::getLimits (int& rows, int& lines)
{
rows = 0;
lines = 0;
// This is an integer specified as a filter (limit:10).
std::string limit = parser.getLimit ();
if (limit != "")
{
if (limit == "page")
{
rows = 0;
lines = getHeight ();
}
else
{
rows = (int) strtol (limit.c_str (), NULL, 10);
lines = 0;
}
}
}
////////////////////////////////////////////////////////////////////////////////
// The 'Task' object, among others, is shared between projects. To make this
// easier, it has been decoupled from Context.