Commit abc1f63c authored by Iain Learmonth's avatar Iain Learmonth

Update upstream source from tag 'upstream/1.3_beta1'

Update to upstream version '1.3~beta1'
with Debian dir 3747a0cd06380cdbef71e8019c9cdb929dec3952
parents 5c185d94 849da327
The development of Vit was made possible by the significant
The development of VIT was made possible by the significant
contributions of the following people:
Scott Kostyshak (Maintainer and Contributing Author)
......@@ -6,11 +6,20 @@ contributions of the following people:
Paul Beckingham (Advisor)
David J Patrick (Designer)
The following submitted code, packages or analysis, and deserve special thanks:
The following submitted code or analysis, and deserve special thanks:
Bryce Harrington
Nemo Inis
Devendra Ghate
Ankur Sinha
Benjamin Weber
Jochen Sprickerhof
Peter Novak
Terran Air
Rowan Thorpe
Richard Gay
Bas Zoetekouw
Dhananjay Balan
Thanks to the following, who submitted detailed bug reports and excellent
suggestions:
......@@ -20,3 +29,7 @@ suggestions:
Peter Lewis
Jean-Philippe Rutault
Jason Woofenden
Benedikt Morbach
Alick Zhao
Bernhard M. Wiedemann
Thomas Rebele
Sun Apr 6 2013 - released v1.2
Sat Jun 14 2018 - fix "Negative repeat count does nothing" errors (GH#153)
Sat Jun 24 2017 - introduce feature for adding/removing tags (GH#5)
Sat Jun 24 2017 - add config option to disable wait prompts (GH#12)
Fri Jun 23 2017 - add config option to disable confirmation (GH#4)
Fri Jun 23 2017 - add "wait" command bound to 'w' (GH#3)
Sun Mar 12 2017 - add ctrl+g synonym for escape
Sun Mar 12 2017 - add start/stop toggle bound to 'b' (GH#152, part of GH#126)
Sat Aug 30 2016 - fix handling of CJK characters (GH#142)
Sat Aug 6 2016 - fix for multi-byte searches
Sun Jul 24 2016 - fix for multi-byte prompt input
Sun Jul 24 2016 - fix display of multi-byte report data
Sun Jul 17 2016 - do not exit if terminal resized to small height
Mon Jun 20 2016 - work around another instance of the Perl warning
Mon May 16 2016 - work around a warning from Perl versions >= v5.21.1
Sun Jan 10 2016 - annotations now correctly escape any character
Sun Jan 10 2016 - do not exit when invalid regex for search string (GH#148)
Sat Jan 9 2016 - clean up terminal on a Perl error or warning (part of GH#148)
Fri Jan 8 2016 - do not run 'task burndown' by default
Fri Jan 8 2016 - add config variable for 'task burndown'
Tue Jan 5 2016 - add support for config variables. See 'man vitrc'
Wed Sep 30 2015 - improve detection of annotations (GH#144)
Sun Mar 8 2015 - do not beep on a 'g' keystroke
Sat Mar 7 2015 - fix a bug where prompt text was invisible
Wed Mar 4 2015 - add support for End and Home keys (GH#137)
Mon Mar 2 2015 - add support for Del key in prompts (GH#120)
Sun Mar 1 2015 - allow Taskwarrior cmds to parse for 'a' and 'm' (GH#132, GH#135)
Sun Mar 1 2015 - in screen, VIT now highlights the entire line (GH#81, GH#129)
Sun Mar 1 2015 - update display after sync (GH#112)
Tue Aug 26 2014 - 'n'/'N' now work when not right after search
Sun Aug 24 2014 - store commands file in %prefix%/share/vit/
Wed Jul 30 2014 - update documentation URLs
Fri Jun 27 2014 - add prompt history scrolling with arrows (GH#54, GH#58)
Thu Jun 26 2014 - install files in more conventional paths (GH#118)
Wed Jun 25 2014 - fix vitrc man file (GH#119)
Wed Jun 25 2014 - Makefile no longer requires sudo (GH#118)
Sat Jun 21 2014 - '-version' prints the git hash if available
Fri Jun 20 2014 - all of vit's options work with two dashes
Fri Jun 20 2014 - 'vit -help' has 0 exit code
Fri Jun 20 2014 - 'vit -version' prints the version (GH#114)
Sun Apr 6 2014 - released v1.2
Tue Apr 1 2014 - the <Esc> key can now be used in shortcuts
Tue Apr 1 2014 - exit with informative error if shortcut too long (see VT-81)
Tue Apr 1 2014 - exit with informative error if shortcut too long (see GH#103)
Thu Mar 13 2014 - fix colors for running VIT in tmux
Sat Mar 8 2014 - do not print control characters to prompts
Thu Mar 6 2014 - fix recognition of backspace in tmux
......
Vit is free software: you can redistribute it and/or modify it under
VIT is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
Vit is distributed in the hope that it will be useful, but WITHOUT
VIT is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with Vit. If not, see <http://www.gnu.org/licenses/>.
with VIT. If not, see <http://www.gnu.org/licenses/>.
Copyright 2012 - 2013, Steve Rader
Copyright 2013 - 2014, Scott Kostyshak
Copyright 2013 - 2018, Scott Kostyshak
......@@ -4,7 +4,6 @@ LICENSE
MANIFEST
Makefile.in
README
TODO
VERSION
commands
configure
......
......@@ -12,10 +12,14 @@ CLEAR=@CLEAR@
build:
@echo "adding vit.pl to vit"
@cat vit.pl | grep -v ^require \
@if which git > /dev/null && git rev-parse > /dev/null 2>&1; \
then GITHASH=" ($$(git rev-parse --short HEAD))"; \
else GITHASH=""; \
fi && \
cat vit.pl | grep -v ^require \
| sed "s:%prefix%:$(PREFIX):" \
| sed "s/%BUILD%/$(VERSION) built `date`/" \
| sed "s/%VERSION%/$(VERSION) (`date +%Y%m%d`)/" \
| sed "s/%BUILD%/$(VERSION) built after `date -r CHANGES`/" \
| sed "s/%VERSION%/$(VERSION)$${GITHASH}/" \
| sed "s:%TASK%:$(TASK):" \
| sed "s:%CLEAR%:$(CLEAR):" \
> vit
......@@ -28,14 +32,14 @@ build:
chmod 755 vit
install:
sudo mkdir -p @prefix@/bin
sudo cp vit @prefix@/bin/vit
sudo mkdir -p @prefix@/man/man1
sudo cp vit.1 @prefix@/man/man1/
sudo mkdir -p @prefix@/man/man5
sudo cp vitrc.5 @prefix@/man/man5/
sudo mkdir -p @prefix@/etc/
sudo cp commands @prefix@/etc/vit-commands
mkdir -p $(DESTDIR)/@prefix@/bin
cp vit $(DESTDIR)/@prefix@/bin/
mkdir -p $(DESTDIR)/@prefix@/share/man/man1
cp vit.1 $(DESTDIR)/@prefix@/share/man/man1/
mkdir -p $(DESTDIR)/@prefix@/share/man/man5
cp vitrc.5 $(DESTDIR)/@prefix@/share/man/man5/
mkdir -p $(DESTDIR)/@prefix@/share/vit
cp commands $(DESTDIR)/@prefix@/share/vit/commands
autoconf:
@make -f .makefile autoconf
......
......@@ -21,7 +21,7 @@
xterm -geom 100x40 +sb -e /usr/local/bin/vit -titlebar &
Downloads:
http://taskwarrior.org/projects/taskwarrior/wiki/Vit
http://taskwarrior.org/download/vit-1.2.tar.gz
If you actually use this program, feel free to send me a msg and let me know.
......
summary mode: improve selection by making the bar graph bar visable
summary mode: <enter> and '=' should use $default_command (currently hardcoded to "ls")
add rc for report header effects (workaround for bug #1222)
# Copyright 2012 - 2013, Steve Rader
# Copyright 2013 - 2014, Scott Kostyshak
# Copyright 2013 - 2018, Scott Kostyshak
sub parse_args {
while ( @ARGV ) {
if ( $ARGV[0] eq '-help' ) {
if ( $ARGV[0] eq '--help' || $ARGV[0] eq '-help' || $ARGV[0] eq '-h' ) {
&usage();
}
if ( $ARGV[0] eq '-audit' || $ARGV[0] eq '-a' ) {
if ( $ARGV[0] eq '--version' || $ARGV[0] eq '-version' || $ARGV[0] eq '-v' ) {
print "$version\n";
exit 0;
}
if ( $ARGV[0] eq '--audit' || $ARGV[0] eq '-audit' || $ARGV[0] eq '-a' ) {
$audit = 1;
shift @ARGV;
next;
}
if ( $ARGV[0] eq '-titlebar' || $ARGV[0] eq '-t' ) {
if ( $ARGV[0] eq '--titlebar' || $ARGV[0] eq '-titlebar' || $ARGV[0] eq '-t' ) {
$titlebar = 1;
shift @ARGV;
next;
......@@ -39,8 +43,9 @@ sub usage {
print "usage: vit [switches] [task_args]\n";
print " -audit print task commands to vit_audit.log\n";
print " -titlebar sets the xterm titlebar to \"$version\"\n";
print " -version prints the version\n";
print " task_args any set of task commandline args that print an \"ID\" column\n";
exit 1;
exit 0;
}
return 1;
......
# Copyright 2012 - 2013, Steve Rader
# Copyright 2013 - 2014, Scott Kostyshak
# Copyright 2013 - 2018, Scott Kostyshak
sub cmd_line {
&audit("Inside of cmd_line");
......
# Copyright 2012 - 2013, Steve Rader
# Copyright 2013 - 2014, Scott Kostyshak
# Copyright 2013 - 2018, Scott Kostyshak
#------------------------------------------------------------------
sub prompt_quit {
my $yes;
if ($confirmation) {
$yes = &prompt_y("Quit?");
if ( ! $yes ) {
&draw_prompt_line('');
return;
}
endwin();
exit();
}
&clean_exit()
}
#------------------------------------------------------------------
......@@ -22,7 +23,10 @@ sub task_add {
&draw_prompt_line('');
return;
}
my ($es,$result) = &task_exec("add \"$str\"");
# TODO: get rid off escaping by replacing the shell call in task_exec() by something like IPC::Open2().
# That would allow us to get rid of all shell expansions, quotations and escaping. [BaZo]
$str =~ s{[&^\\]}{\\\&}g;
my ($es,$result) = &task_exec("add $str");
if ( $es != 0 ) {
$error_msg = $result;
&draw_error_msg();
......@@ -41,7 +45,19 @@ sub task_annotate {
&draw_prompt_line('');
return;
}
my ($es,$result) = &task_exec("$id annotate \"$str\"");
# This task_exec is different (from, e.g., the one in task_add)
# because for annotatate we embed quotes since there is nothing
# else for Taskwarrior to interpret. The advantage is that the
# user does not need to worry about proper quoting.
#
# Because single quotes are the enclosing characters, they must be escaped.
# This replaces each single quote inside $str with (1) a single quote to end
# the single-quoting, a double quote to begin a new type of quoting, a single
# quote (which is now embedded in a double quote so does not need escaping),
# an end double-quote, and a begin-single-quote that will begin the rest of
# the quoting. In summary, we rely on the sh and bash feature of stringing together multiple types of quotes
$str =~ s/'/'"'"'/g;
my ($es,$result) = &task_exec("$id annotate '$str'");
if ( $es != 0 ) {
$error_msg = $result;
&draw_error_msg();
......@@ -60,15 +76,17 @@ sub task_den_or_del {
for my $t (0 .. $#{ $report_tokens[$task_selected_idx] } ) {
$str .= "$report_tokens[$task_selected_idx][$t]";
}
my $target = ( $str !~ s/^\s*\d+\/\d+\/\d+\s+// )
my $target = ( $str !~ s/^\s*\d+[\/-]\d+[\/-]\d+\s+// )
? "task"
: "annotation";
$str =~ s/\s+$//;
if ($confirmation) {
$yes = &prompt_y("Delete current $target? ");
if ( ! $yes ) {
&draw_prompt_line('');
return;
}
}
my ($es,$result) = ($target eq "annotation")
? &task_exec("$id denotate \"$str\"")
: &task_exec("$id delete rc.confirmation:no");
......@@ -85,14 +103,50 @@ sub task_den_or_del {
#------------------------------------------------------------------
sub task_start_stop {
my ($ch, $str, $yes);
my $id = $report2taskid[$task_selected_idx];
my ($state, $result1) = &task_exec("$id active");
my $prompt = "stop";
$feedback_msg = "Stopped task";
if ($state != 0) {
$prompt = "start";
$feedback_msg = "Started task";
}
if ($confirmation) {
$yes = &prompt_y("$prompt task?");
if ( ! $yes ) {
&draw_prompt_line('');
return;
}
}
my ($es, $result2) = &task_exec("$id $prompt");
if ( $es != 0 ) {
$error_msg = $result2;
&draw_error_msg();
return;
}
&draw_feedback_msg();
$reread_needed = 1;
}
#------------------------------------------------------------------
sub task_done {
my ($ch, $str, $yes);
my $id = $report2taskid[$task_selected_idx];
if ($confirmation) {
$yes = &prompt_y("Mark task $id done? ");
if ( ! $yes ) {
&draw_prompt_line('');
return;
}
}
my ($es,$result) = &task_exec("$id done");
if ( $es != 0 ) {
$error_msg = $result;
......@@ -132,7 +186,7 @@ sub task_filter {
sub task_modify {
my $args = $_[0];
my $id = $report2taskid[$task_selected_idx];
&shell_exec("$task $id modify \"$args\"",'wait');
&shell_exec("$task $id modify $args",'wait');
$reread_needed = 1;
}
......@@ -163,7 +217,7 @@ sub task_set_priority {
if ( $p eq 'N' ) {
$p = '';
}
my ($es,$result) = &task_exec("$id modify prio:$p");
my ($es,$result) = &task_exec("$id modify 'priority:$p'");
if ( $es != 0 ) {
$error_msg = $result;
&draw_error_msg();
......@@ -193,7 +247,7 @@ sub task_set_project {
beep();
return;
}
my ($es,$result) = &task_exec("$id modify proj:$p");
my ($es,$result) = &task_exec("$id modify 'project:$p'");
if ( $es != 0 ) {
$error_msg = $result;
&draw_error_msg();
......@@ -206,6 +260,68 @@ sub task_set_project {
#------------------------------------------------------------------
sub task_set_wait {
my $id = $report2taskid[$task_selected_idx];
my $w = &prompt_str("Wait: ");
if ( $w eq '' ) {
&draw_prompt_line('');
return;
}
my ($es,$result) = &task_exec("$id modify 'wait:$w'");
if ( $es != 0 ) {
$error_msg = $result;
&draw_error_msg();
return;
}
$feedback_msg = "Modified task $id.";
&flash_current_task();
$reread_needed = 1;
}
#------------------------------------------------------------------
sub task_set_tag {
my $id = $report2taskid[$task_selected_idx];
my $tags = &prompt_str("Tag: ");
if ( $tags eq '' ) {
&draw_prompt_line('');
return;
}
# multiple tags can be input separated by a combination of spaces and commas
# note that this input format precludes inputting a comma as part of a tag
#
# keep track of current modifier (default:+) and use it for subsequent tags
# so "+a b c" means "+a +b +c" and "+a -b c" means "+a -b -c"
my $mod='+';
foreach my $t (split(/,?\s+|,/,$tags)) {
next if $t =~ m/^\s*$/;
# check if a + or - was specified
my $fc = substr($t,0,1);
if ( $fc eq '+' or $fc eq '-' ) {
# if so, save the current modifier
$mod = $fc;
} else {
# if not, add the current modifier
$t = $mod . $t;
}
my ($es,$result) = &task_exec("$id modify '$t'");
if ( $es != 0 ) {
$error_msg = $result;
&draw_error_msg();
return;
}
}
$feedback_msg = "Modified task $id.";
&flash_current_task();
$reread_needed = 1;
}
#------------------------------------------------------------------
sub shell_command {
my $args = $_[0];
my ($opts, $cmd);
......
# Copyright 2012 - 2013, Steve Rader
# Copyright 2013 - 2014, Scott Kostyshak
# Copyright 2013 - 2018, Scott Kostyshak
sub parse_report_line {
my ($l,$str) = @_;
......
cmd a STRING add a new task
cmd A STRING add an annotation to the current task
cmd b STRING start/stop a task
cmd m STRING modify the current task
cmd w STRING wait the current task
cmd :![rw] STRING execute "STRING" in shell. 'r' rereads, 'w' waits
cmd t prepend the command prompt with ":!rw task "
cmd :s/OLD/NEW/ change OLD to NEW in the current task's description
......@@ -27,8 +29,10 @@
nav :N move to task number N
nav 0 move to the first line
nav gg move to the first line
nav Home move to the first line or beginning of prompt
nav H move to the first line on screen
nav G move to the last line
nav End move to the last line or end of prompt
nav L move to the last line on screen
nav M move to the middle line on screen
nav k move up one line
......@@ -40,12 +44,15 @@
nav PgDn scroll down (forward) one page
nav ^b scroll up (back) one page
nav PgUp scroll up (back) up one page
cmd /STRING search forwards for STRING
cmd ?STRING search backwards for STRING
cmd /STRING search forwards for regular expression STRING
cmd ?STRING search backwards for regular expression STRING
cmd P [hmln] set the current task's priority to H, M, L, or none
cmd p STRING set the current task's project to STRING
cmd p STRING<tab> set the current task's project to STRING using tab completion
cmd p <tab> set the current task's project using tab completion
cmd T +STRING add the tag STRING to the current task
cmd T -STRING remove the tag STRING from the current task
cmd T <tab> add tags to the current task using tab completion
help :h view the whole help file
help :h cmd view help about commands
help :h help view help about help
......
# Copyright 2012 - 2013, Steve Rader
# Copyright 2013 - 2014, Scott Kostyshak
# Copyright 2013 - 2018, Scott Kostyshak
sub init_curses {
my $m = $_[0];
......
# Copyright 2012 - 2013, Steve Rader
# Copyright 2013 - 2014, Scott Kostyshak
# Copyright 2013 - 2018, Scott Kostyshak
sub draw_header_line {
my ($row,$lhs,$rhs) = @_;
......@@ -26,6 +26,7 @@ sub draw_prompt {
my ($lhs) = @_;
$prompt_win->addstr(0, 0, $lhs);
$prompt_win->clrtoeol();
$cur_pos = length($lhs);
$prompt_win->refresh();
}
......@@ -35,7 +36,12 @@ sub draw_prompt_cur {
my ($lhs) = @_;
$prompt_win->addstr(0, 0, $lhs);
$prompt_win->clrtoeol();
$prompt_win->move(0, $cur_pos);
# the next line calculates the terminal column from the
# current position in the prompt string; this calculation
# is *not* the identity if there are characters that
# occupy more than 1 terminal column (e.g., CJK characters)
my $terminal_pos = mbswidth(substr($lhs, 0, $cur_pos));
$prompt_win->move(0, $terminal_pos);
$prompt_win->refresh();
}
......@@ -51,7 +57,6 @@ sub draw_error_msg {
$prompt_win->addstr(0, 0, $error_msg);
$prompt_win->attroff(A_BOLD);
$prompt_win->attroff(COLOR_PAIR($COLOR_ERRORS));
$prompt_win->attron(COLOR_PAIR($COLOR_HEADER));
$prompt_win->addstr(0, $COLS - length($cursor_position) - 1, $cursor_position);
$prompt_win->refresh();
}
......@@ -87,14 +92,37 @@ sub draw_report_line {
}
#if ( $t == 0 ) { debug("DRAW tok=$line.$t cp=$cp \"$report_tokens[$i][$t]\""); }
&set_attron($report_win,$report_attrs[$i][$t]);
$report_win->addstr($line,$x,$report_tokens[$i][$t]);
my $tok = $report_tokens[$i][$t];
$report_win->addstr($line,$x,$tok);
&set_attroff($report_win,$report_attrs[$i][$t]);
if ( $mode eq 'without-selection' || $i != $task_selected_idx ) {
$report_win->attroff(COLOR_PAIR($cp));
}
$x += length($report_tokens[$i][$t]);
$x += mbswidth($tok);
}
$str = ' ' x ($REPORT_COLS - $x);
my $repeat_count=($REPORT_COLS - $x);
if ( $repeat_count < 0 ) {
# FIXME
# I added this "if" block when VIT exited with a Perl warning that
# "VIT fatal error: (converted from warning) Negative repeat count does
# nothing..."
# Note that warnings are (purposefully) converted to errors because of
# using "strict'. There is likely a bug in the algorithm as I'm guessing
# the original author of this code never intended for the value to be
# negative. I do not think this is a serious bug, and thus I leave this
# note as a reminder for if someone takes an in-depth look at the algorithm
# or decides for other reasons that a refactoring is needed. I can only
# reproduce this issue with a private dataset and unfortunately it is not
# the normal case for bugs where one can whittle the dataset down and
# easily anonymize it. I will keep the dataset to test in the future in
# case a fix is proposed. The tar where will I keep my private
# reproduceable dataset is named "vit_negative_repeat.tar.gz".
# There are other similar situations in the code. To see the FIXMEs that
# are associated with them, do "git grep bd4a905c".
# scott k, 2016-05-15
$repeat_count = 0;
}
$str = ' ' x $repeat_count;
if ( $mode eq 'without-selection' || $i != $task_selected_idx ) {
$report_win->attron(COLOR_PAIR($cp));
}
......
# Copyright 2012 - 2013, Steve Rader
# Copyright 2013 - 2014, Scott Kostyshak
# Copyright 2013 - 2018, Scott Kostyshak
sub init_shell_env {
if ( $ENV{'TERM'} =~ /^xterm/ || $ENV{'TERM'} =~ /^screen/ ) {
&audit("ENV TERM=xterm-256color");
$ENV{'TERM'} = 'xterm-256color';
if ( $ENV{'TERM'} =~ /^(xterm|screen)/ ) {
my $TERM_newval = "$1-256color";
&audit("setting ENV TERM=$TERM_newval");
$ENV{'TERM'} = "$TERM_newval";
}
if ( $titlebar ) {
&audit("ENV set titlebar");
......
# Copyright 2012 - 2013, Steve Rader
# Copyright 2013 - 2014, Scott Kostyshak
# Copyright 2013 - 2018, Scott Kostyshak
sub task_exec {
my ($cmd) = @_;
......@@ -27,6 +27,12 @@ sub task_exec {
#------------------------------------------------------------------
sub exited_successfully {
my $status = shift || 0;
return 1 if WIFEXITED($status) and WEXITSTATUS($status)==0;
return undef;
}
sub shell_exec {
my ($cmd,$mode) = @_;
endwin();
......@@ -40,7 +46,14 @@ sub shell_exec {
exit();
}
wait();
if ( $mode eq 'wait' ) {
my $success = &exited_successfully($?);
# two reasons to wait:
# - an error occurred
# - $mode is wait and the user didn't specify nowait in config file
if ( not $success or ( $mode eq 'wait' and not $nowait ) or $mode eq 'forcewait' ) {
if (not $success) {
print "Error while executing command `$cmd'\n";
}
print "Press return to continue.\r\n";
<STDIN>;
}
......
# Copyright 2012 - 2013, Steve Rader
# Copyright 2013 - 2014, Scott Kostyshak
# Copyright 2013 - 2018, Scott Kostyshak
sub getch_loop {
while (1) {
......@@ -19,7 +19,7 @@ sub getch_loop {
last CASE;
}
if ( $ch eq '0' || ( $ch eq 'g' && $prev_ch eq 'g' ) ) {
if ( $ch eq '0' || $ch eq KEY_HOME || ( $ch eq 'g' && $prev_ch eq 'g' ) ) {
$task_selected_idx = 0;
$display_start_idx = 0;
$refresh_needed = 1;
......@@ -56,6 +56,11 @@ sub getch_loop {
last CASE;
}
if ( $ch eq 'b' ) {
&task_start_stop();
last CASE;
}
if ( $ch eq "e" ) {
&shell_exec("task $report2taskid[$task_selected_idx] edit",'wait');
$reread_needed = 1;
......@@ -67,7 +72,7 @@ sub getch_loop {
last CASE;
}
if ( $ch eq 'G' ) {
if ( $ch eq 'G' || $ch eq KEY_END ) {
$task_selected_idx = $#report_tokens;
if ( $display_start_idx + $REPORT_LINES <= $#report_tokens ) {
$display_start_idx = $task_selected_idx - $REPORT_LINES + 1;
......@@ -129,17 +134,19 @@ sub getch_loop {
last CASE;
}
if ( $ch eq 'N' && $input_mode eq 'search' ) {
&do_search('N');
if ( $ch eq 'n' || $ch eq 'N' ) {
if ( defined $search_pat ) {
&do_search($ch);
$refresh_needed = 1;
last CASE;
}
if ( $ch eq 'n' && $input_mode eq 'search' ) {
&do_search('n');
$refresh_needed = 1;
else {
# do nothing: the user has mistakenly requested a search next/previous
# before doing an initial search.
# Alternative: give a search prompt (this is what mutt does).
last CASE;
}
}
if ( $ch eq 'P' ) {
&task_set_priority();
......@@ -164,6 +171,7 @@ sub getch_loop {
my $majmin = &task_version('major.minor');
if ( $majmin >= 2.3 ) {
&shell_exec("task sync",'wait');
$reread_needed = 1;
}
else {
$error_msg = "'sync' was introduced in Taskwarrior 2.3.0";
......@@ -176,12 +184,22 @@ sub getch_loop {
&ungetstr(':!rw task ')
}
if ( $ch eq 'T' ) {
&task_set_tag();
last CASE;
}
if ( $ch eq 'u' ) {
&shell_exec('task undo','wait');
$reread_needed = 1;
last CASE;
}
if ( $ch eq 'w' ) {
&task_set_wait();
last CASE;
}
if ( $ch eq '/' ) {
$search_direction = 1;
&start_search();
......@@ -204,10 +222,10 @@ sub getch_loop {
my $p = $report_tokens[$task_selected_idx][0];
$p =~ s/(.*?)\s+.*/$1/;
$p =~ s/\(none\)//;
$current_command = "ls proj:$p";
$current_command = "ls project:$p";
$reread_needed = 1;
} else {
&shell_exec("task $report2taskid[$task_selected_idx] info",'wait');
&shell_exec("task $report2taskid[$task_selected_idx] information",'forcewait');
}
last CASE;
}
......@@ -243,7 +261,7 @@ sub getch_loop {
last CASE;
}
if ( $ch eq "\e" ) {
if ( $ch eq "\e" || $ch eq "\cg" ) {
$error_msg = '';
$feedback_msg = '';
$refresh_needed = 1;
......@@ -251,15 +269,26 @@ sub getch_loop {
last CASE;
}
if ( $ch eq 'Z' ) { last CASE; }
if ( $ch eq "410" ) {
if ( $ch eq KEY_RESIZE ) {
# FIXME resize
# this code chunk is also in prompt.pl
if ( $LINES > 1 ) {
&audit("Received KEY_RESIZE. Going to refresh.");
&init_curses('refresh');
&draw_screen();
} else {
&audit("Received KEY_RESIZE, but terminal height ($LINES) too
small to refresh.");
}
last CASE;
}
if ( $ch eq '-1' ) { last CASE; }
# before beeping, rule out the first 'g' in a 'gg' sequence
# (which is not handled above)
if ( $ch ne 'g' ) {
beep();
}
}
if ( $ch ne '/' && $ch ne '?' && $ch ne 'n' && $ch ne 'N' ) {
$input_mode = 'cmd';
}
......
# Copyright 2012 - 2013, Steve Rader
# Copyright 2013 - 2014, Scott Kostyshak
# Copyright 2013 - 2018, Scott Kostyshak
sub audit {
if ( $audit ) {
......@@ -19,13 +19,17 @@ sub clean_exit {