mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-27 19:17:19 +02:00
Enhancement - debug mode
- Added terminal width determination in debug mode.
This commit is contained in:
parent
32b951dcc9
commit
5726926449
2 changed files with 12 additions and 1 deletions
|
@ -26,6 +26,7 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//#include <iostream>
|
//#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
//#include <pwd.h>
|
//#include <pwd.h>
|
||||||
//#include <stdlib.h>
|
//#include <stdlib.h>
|
||||||
//#include <string.h>
|
//#include <string.h>
|
||||||
|
@ -130,13 +131,23 @@ int Context::getWidth ()
|
||||||
{
|
{
|
||||||
// Determine window size, and set table accordingly.
|
// Determine window size, and set table accordingly.
|
||||||
int width = config.get ("defaultwidth", (int) 80);
|
int width = config.get ("defaultwidth", (int) 80);
|
||||||
|
|
||||||
#ifdef HAVE_LIBNCURSES
|
#ifdef HAVE_LIBNCURSES
|
||||||
if (config.get ("curses", true))
|
if (config.get ("curses", true))
|
||||||
{
|
{
|
||||||
WINDOW* w = initscr ();
|
WINDOW* w = initscr ();
|
||||||
width = w->_maxx + 1;
|
width = w->_maxx + 1;
|
||||||
endwin ();
|
endwin ();
|
||||||
|
|
||||||
|
std::stringstream out;
|
||||||
|
out << "Context::getWidth: ncurses determined width of " << width << " characters";
|
||||||
|
debug (out.str ());
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
debug ("Context::getWidth: ncurses available but disabled.");
|
||||||
|
#else
|
||||||
|
out << "Context::getWidth: no ncurses, using width of " << width << " characters";
|
||||||
|
debug (out.str ());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return width;
|
return width;
|
||||||
|
|
|
@ -171,7 +171,7 @@ std::string shortUsage ()
|
||||||
|
|
||||||
row = table.addRow ();
|
row = table.addRow ();
|
||||||
table.addCell (row, 1, "task export");
|
table.addCell (row, 1, "task export");
|
||||||
table.addCell (row, 2, "Lists all tasks as a CSV file.");
|
table.addCell (row, 2, "Lists all tasks in CSV format.");
|
||||||
|
|
||||||
row = table.addRow ();
|
row = table.addRow ();
|
||||||
table.addCell (row, 1, "task color");
|
table.addCell (row, 1, "task color");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue