- Feature #934, supports 'reserved.lines' to indicate a multi-line prompt for
  use in conjunction with 'limit:page' (thanks to Robert Gill).
- Removed 'locale' from the taskrc.5 man page.
- Added verbosity token 'sync'.
- Fixed bug in size calculation for 'limit:page', but there is still one more.
- Corrected unit test limit.t given the above fix.
This commit is contained in:
Paul Beckingham 2012-10-06 14:52:41 -04:00
parent 9cbd729553
commit c5ff24358c
11 changed files with 62 additions and 12 deletions

View file

@ -156,4 +156,5 @@ suggestions:
Rene Vergara Rene Vergara
Stéphane Pezennec Stéphane Pezennec
Jim B Jim B
Robert Gill

View file

@ -3,10 +3,15 @@
2.3.0 () - 2.3.0 () -
Features Features
+ Added Feature #934, support for 'reserved.lines' to accomodate multi-line
shell prompts when used in conjunction with 'limit:page' (thanks to Robert
Gill).
+ Stores un-synched transactions in <data.location>/backlog.data. + Stores un-synched transactions in <data.location>/backlog.data.
+ Adds a new "synchronize" command to sync data with a task server. + Adds a new 'synchronize' command to sync data with a task server.
+ Adds a new 'sync' verbosity token, which will reminds when a backlog builds
up and needs a sync.
Bugs Bugs
+ + Fixed bug so that 'limit:page' now considers footnote messages.
------ old releases ------------------------------ ------ old releases ------------------------------

View file

@ -230,9 +230,9 @@ that you would see a smaller, more compact representation of the task, with no
help text. Deprecated - use verbosity token 'edit'. help text. Deprecated - use verbosity token 'edit'.
.TP .TP
.B locale=en-US.UTF8 .B reserved.lines=1
Locale to be used by Taskwarrior for synchronization with the task server. The This is the number of lines reserved at the bottom of the screen for the shell
default value is currently blank. prompt. This is only referenced when 'limit:page' is used.
.SS MISCELLANEOUS .SS MISCELLANEOUS
@ -258,6 +258,7 @@ control specific occasions when output is generated. This list may contain:
edit Used the verbose template for the 'edit' command edit Used the verbose template for the 'edit' command
special Feedback when applying special tags special Feedback when applying special tags
project Feedback about project status changes project Feedback about project status changes
sync Feedback about the need for sync
Note that the "on" setting is equivalent to all the tokens being specified, Note that the "on" setting is equivalent to all the tokens being specified,
and the "nothing" setting is equivalent to none of the tokens being specified. and the "nothing" setting is equivalent to none of the tokens being specified.
@ -265,7 +266,7 @@ and the "nothing" setting is equivalent to none of the tokens being specified.
Here are the shortcut equivalents: Here are the shortcut equivalents:
verbose=on verbose=on
verbose=blank,header,footnote,label,new-id,affected,edit,special,project verbose=blank,header,footnote,label,new-id,affected,edit,special,project,sync
verbose=off verbose=off
verbose=blank,label,new-id,edit verbose=blank,label,new-id,edit

View file

@ -76,13 +76,14 @@ std::string Config::_defaults =
"avoidlastcolumn=no # Fixes Cygwin width problem\n" "avoidlastcolumn=no # Fixes Cygwin width problem\n"
"hyphenate=on # Hyphenates lines wrapped on non-word-breaks\n" "hyphenate=on # Hyphenates lines wrapped on non-word-breaks\n"
"#editor=vi # Preferred text editor\n" "#editor=vi # Preferred text editor\n"
"reserved.lines=1 # Assume a 1-line prompt\n"
"\n" "\n"
"# Miscellaneous\n" "# Miscellaneous\n"
"verbose=yes # Provide maximal feedback\n" "verbose=yes # Provide maximal feedback\n"
"#verbose=no # Provide regular feedback\n" "#verbose=no # Provide regular feedback\n"
"#verbose=nothing # Provide no feedback\n" "#verbose=nothing # Provide no feedback\n"
"# # Comma-separated list. May contain any subset of:\n" "# # Comma-separated list. May contain any subset of:\n"
"#verbose=blank,header,footnote,label,new-id,affected,edit,special,project\n" "#verbose=blank,header,footnote,label,new-id,affected,edit,special,project,sync\n"
"confirmation=yes # Confirmation on delete, big changes\n" "confirmation=yes # Confirmation on delete, big changes\n"
"indent.annotation=2 # Indent spaces for annotations\n" "indent.annotation=2 # Indent spaces for annotations\n"
"indent.report=0 # Indent spaces for whole report\n" "indent.report=0 # Indent spaces for whole report\n"

View file

@ -451,6 +451,9 @@ bool Context::color ()
// rc.verbose=nothing Show the absolute minimum. // rc.verbose=nothing Show the absolute minimum.
// rc.verbose=one,two Show verbosity for 'one' and 'two' only. // rc.verbose=one,two Show verbosity for 'one' and 'two' only.
// //
// TODO This mechanism is clunky, and should slowly evolve into something more
// logical and consistent. This should probably mean that 'nothing' should
// take the place of '0'.
bool Context::verbose (const std::string& token) bool Context::verbose (const std::string& token)
{ {
if (! verbosity.size ()) if (! verbosity.size ())
@ -470,7 +473,8 @@ bool Context::verbose (const std::string& token)
verbosity[0] != "affected" && // verbosity[0] != "affected" && //
verbosity[0] != "edit" && // verbosity[0] != "edit" && //
verbosity[0] != "special" && // verbosity[0] != "special" && //
verbosity[0] != "project") // verbosity[0] != "project" && //
verbosity[0] != "sync") //
{ {
verbosity.clear (); verbosity.clear ();

View file

@ -145,9 +145,11 @@ int CmdCustom::execute (std::string& output)
// Adjust for fluff in the output. // Adjust for fluff in the output.
if (maxlines) if (maxlines)
maxlines -= (context.verbose ("blank") ? 1 : 0) maxlines -= table_header
+ table_header + (context.verbose ("blank") ? 1 : 0)
+ 1; // "X tasks shown ..." + (context.verbose ("footnote") ? context.footnotes.size () : 0)
+ (context.verbose ("affected") ? 1 : 0)
+ context.config.getInteger ("reserved.lines"); // For prompt, etc.
// Render. // Render.
std::stringstream out; std::stringstream out;
@ -183,6 +185,7 @@ int CmdCustom::execute (std::string& output)
rc = 1; rc = 1;
} }
feedback_backlog ();
context.tdb2.commit (); context.tdb2.commit ();
output = out.str (); output = out.str ();
return rc; return rc;

View file

@ -178,6 +178,7 @@ int CmdShow::execute (std::string& output)
" recurrence.indicator" " recurrence.indicator"
" recurrence.limit" " recurrence.limit"
" regex" " regex"
" reserved.lines"
" row.padding" " row.padding"
" rule.precedence.color" " rule.precedence.color"
" search.case.sensitive" " search.case.sensitive"

View file

@ -60,6 +60,9 @@ int CmdSync::execute (std::string& output)
// Obtain credentials. // Obtain credentials.
std::string credentials_string = context.config.get ("taskd.credentials"); std::string credentials_string = context.config.get ("taskd.credentials");
if (credentials_string == "")
throw std::string (STRING_CMD_SYNC_BAD_CRED);
std::vector <std::string> credentials; std::vector <std::string> credentials;
split (credentials, credentials_string, "/"); split (credentials, credentials_string, "/");
if (credentials.size () != 3) if (credentials.size () != 3)

View file

@ -415,6 +415,25 @@ void feedback_unblocked (const Task& task)
} }
} }
///////////////////////////////////////////////////////////////////////////////
void feedback_backlog ()
{
if (context.config.get ("taskd.server") != "" &&
context.verbose ("sync"))
{
std::vector <std::string> lines = context.tdb2.backlog.get_lines ();
std::vector <std::string>::iterator line;
for (line = lines.begin (); line != lines.end (); ++line)
{
if ((*line)[0] == '[')
{
context.footnote ("There are local changes. Sync required.");
break;
}
}
}
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
std::string onProjectChange (Task& task, bool scope /* = true */) std::string onProjectChange (Task& task, bool scope /* = true */)
{ {

View file

@ -76,6 +76,7 @@ void feedback_affected (const std::string&, int);
void feedback_affected (const std::string&, const Task&); void feedback_affected (const std::string&, const Task&);
void feedback_special_tags (const Task&, const std::string&); void feedback_special_tags (const Task&, const std::string&);
void feedback_unblocked (const Task&); void feedback_unblocked (const Task&);
void feedback_backlog ();
std::string onProjectChange (Task&, bool scope = true); std::string onProjectChange (Task&, bool scope = true);
std::string onProjectChange (Task&, Task&); std::string onProjectChange (Task&, Task&);
std::string onExpiration (Task&); std::string onExpiration (Task&);

View file

@ -79,8 +79,19 @@ like ($output, qr/^30 tasks$/ms, 'limited to 0 - unlimited');
$output = qx{../src/task rc:limit.rc ls limit:3 2>&1}; $output = qx{../src/task rc:limit.rc ls limit:3 2>&1};
like ($output, qr/^30 tasks, 3 shown$/ms, 'limited to 3'); like ($output, qr/^30 tasks, 3 shown$/ms, 'limited to 3');
# Default height is 24 lines:
# - header
# - blank
# - labels
# - underline
# - (data)
# - blank
# - affected
# - reserved.lines
# ------------
# = 17 lines
$output = qx{../src/task rc:limit.rc ls limit:page 2>&1}; $output = qx{../src/task rc:limit.rc ls limit:page 2>&1};
like ($output, qr/^30 tasks, truncated to 18 lines$/ms, 'limited to page'); like ($output, qr/^30 tasks, truncated to 17 lines$/ms, 'limited to page');
# Cleanup. # Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data limit.rc); unlink qw(pending.data completed.data undo.data backlog.data limit.rc);