mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
View
- Implemented View::lines.
This commit is contained in:
parent
4dca2a5a2d
commit
683a269991
3 changed files with 7 additions and 8 deletions
11
src/View.cpp
11
src/View.cpp
|
@ -25,8 +25,7 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <iostream> // TODO Remove
|
||||
#include <sstream>
|
||||
//#include <iostream> // TODO Remove
|
||||
#include <View.h>
|
||||
#include <text.h>
|
||||
|
||||
|
@ -48,11 +47,6 @@ View::View ()
|
|||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
View::~View ()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// |<---------- terminal width ---------->|
|
||||
//
|
||||
|
@ -196,6 +190,7 @@ std::string View::render (std::vector <Task>& data, std::vector <int>& sequence)
|
|||
|
||||
// Output string.
|
||||
std::string out;
|
||||
_lines = 0;
|
||||
|
||||
// Render column headers.
|
||||
std::string left_margin = std::string (_left_margin, ' ');
|
||||
|
@ -218,6 +213,7 @@ std::string View::render (std::vector <Task>& data, std::vector <int>& sequence)
|
|||
}
|
||||
|
||||
out += extra + "\n";
|
||||
++_lines;
|
||||
}
|
||||
|
||||
// Compose, render columns, in sequence.
|
||||
|
@ -253,6 +249,7 @@ std::string View::render (std::vector <Task>& data, std::vector <int>& sequence)
|
|||
}
|
||||
|
||||
out += extra + "\n";
|
||||
++_lines;
|
||||
}
|
||||
|
||||
cells.clear ();
|
||||
|
|
|
@ -37,7 +37,7 @@ class View
|
|||
{
|
||||
public:
|
||||
View ();
|
||||
~View ();
|
||||
~View () {}
|
||||
|
||||
// View specifications.
|
||||
void add (Column* column) { _columns.push_back (column); }
|
||||
|
|
|
@ -74,6 +74,8 @@ int main (int argc, char** argv)
|
|||
// Render the view.
|
||||
std::cout << view.render (data, sequence)
|
||||
<< std::endl;
|
||||
|
||||
t.is (view.lines (), 4, "View::lines == 4");
|
||||
}
|
||||
|
||||
catch (std::string& e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue