From d5a74fc3d8eb39483e8abdff4abd6da936e084de Mon Sep 17 00:00:00 2001 From: Devendra Gera Date: Mon, 28 Jan 2008 16:41:59 +0530 Subject: [PATCH] changed 'ls' to display first task in the group globally, instead of the first task in the group for pattern match results. Signed-off-by: Devendra Gera --- gtdo.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gtdo.pl b/gtdo.pl index 0710f6d..ccfa9a4 100755 --- a/gtdo.pl +++ b/gtdo.pl @@ -79,14 +79,15 @@ sub list_tasks @candidates = grep_pos_in_tasks( $pattern, @candidates ); } - # list only the first task from each group. + # list tasks only if they are the first task from their group. my %out; my $i = 0; foreach my $id ( @candidates ) { unless ($is_a_group) { my (undef,$group) = ( $tasks[$id - 1] =~ m{(^|\s)(/\S*)(\s|$)} ); if(defined $group) { - $out{$group} = $id if (!exists $out{$group}); + my $first = (grep_pos_in_tasks( $group, () ))[0]; + $out{$group} = $id if ($id == $first); next; } } -- 2.11.4.GIT