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 <iostream> // TODO Remove
|
||||||
#include <sstream>
|
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
#include <text.h>
|
#include <text.h>
|
||||||
|
|
||||||
|
@ -48,11 +47,6 @@ View::View ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
View::~View ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// |<---------- terminal width ---------->|
|
// |<---------- terminal width ---------->|
|
||||||
//
|
//
|
||||||
|
@ -196,6 +190,7 @@ std::string View::render (std::vector <Task>& data, std::vector <int>& sequence)
|
||||||
|
|
||||||
// Output string.
|
// Output string.
|
||||||
std::string out;
|
std::string out;
|
||||||
|
_lines = 0;
|
||||||
|
|
||||||
// Render column headers.
|
// Render column headers.
|
||||||
std::string left_margin = std::string (_left_margin, ' ');
|
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";
|
out += extra + "\n";
|
||||||
|
++_lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compose, render columns, in sequence.
|
// Compose, render columns, in sequence.
|
||||||
|
@ -253,6 +249,7 @@ std::string View::render (std::vector <Task>& data, std::vector <int>& sequence)
|
||||||
}
|
}
|
||||||
|
|
||||||
out += extra + "\n";
|
out += extra + "\n";
|
||||||
|
++_lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
cells.clear ();
|
cells.clear ();
|
||||||
|
|
|
@ -37,7 +37,7 @@ class View
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
View ();
|
View ();
|
||||||
~View ();
|
~View () {}
|
||||||
|
|
||||||
// View specifications.
|
// View specifications.
|
||||||
void add (Column* column) { _columns.push_back (column); }
|
void add (Column* column) { _columns.push_back (column); }
|
||||||
|
|
|
@ -74,6 +74,8 @@ int main (int argc, char** argv)
|
||||||
// Render the view.
|
// Render the view.
|
||||||
std::cout << view.render (data, sequence)
|
std::cout << view.render (data, sequence)
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
|
t.is (view.lines (), 4, "View::lines == 4");
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (std::string& e)
|
catch (std::string& e)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue