]> ruderich.org/simon Gitweb - fcscs/fcscs.git/blobdiff - bin/fcscs
add match_last attribute to color last match
[fcscs/fcscs.git] / bin / fcscs
index 66c8410bc7a24a372568063c078b7b57dff8f3b7..d6a5878a6dcf51e3e911bde3748bcd64a1fdcb52 100755 (executable)
--- a/bin/fcscs
+++ b/bin/fcscs
@@ -102,12 +102,16 @@ or another number to select the longer match. Use backspace to remove the last
 entered number.
 
 Press return before entering a number to select the last (lowest numbered)
 entered number.
 
 Press return before entering a number to select the last (lowest numbered)
-match. To abort without selecting any match either use "q".
+match (underlined by default). To abort without selecting any match either use
+"q".
 
 To change the selection mode (e.g. paths, files, etc.) use one of the mappings
 explained below. Per default URLs are selected, see options for a way to
 change this.
 
 
 To change the selection mode (e.g. paths, files, etc.) use one of the mappings
 explained below. Per default URLs are selected, see options for a way to
 change this.
 
+I<NOTE>: Opening URLs in the browser passes the URL via the command line which
+leaks URLs to other users on the current system via C<ps aux> or C<top>.
+
 I<NOTE>: When yanking (copying) a temporary file is used to pass the data to
 GNU screen/Tmux without exposing it to C<ps aux> or C<top>. However this may
 leak data if those temporary files are written to disk. To prevent this change
 I<NOTE>: When yanking (copying) a temporary file is used to pass the data to
 GNU screen/Tmux without exposing it to C<ps aux> or C<top>. However this may
 leak data if those temporary files are written to disk. To prevent this change
@@ -264,6 +268,8 @@ package Screen {
     sub draw_prompt {
         my ($self, $config) = @_;
 
     sub draw_prompt {
         my ($self, $config) = @_;
 
+        $self->debug('draw_prompt', 'started');
+
         my $x = 0;
         my $y = $self->height - 1;
 
         my $x = 0;
         my $y = $self->height - 1;
 
@@ -273,17 +279,20 @@ package Screen {
         # Draw prompt flags.
         if (defined (my $s = $self->{prompt}{flags})) {
             $s = "[$s]";
         # Draw prompt flags.
         if (defined (my $s = $self->{prompt}{flags})) {
             $s = "[$s]";
+            $self->debug('draw_prompt', $s);
             $self->draw_clipped($y, $x, $config->{attribute}{prompt_flags}, $s);
             $x += length($s) + 1; # space between next element
         }
         # Draw prompt name.
         if (defined (my $s = $self->{prompt}{name})) {
             $s = "[$s]";
             $self->draw_clipped($y, $x, $config->{attribute}{prompt_flags}, $s);
             $x += length($s) + 1; # space between next element
         }
         # Draw prompt name.
         if (defined (my $s = $self->{prompt}{name})) {
             $s = "[$s]";
+            $self->debug('draw_prompt', $s);
             $self->draw_clipped($y, $x, $config->{attribute}{prompt_name}, $s);
             $x += length($s) + 1;
         }
         # Draw prompt value, e.g. a search field.
         if (defined (my $s = $self->{prompt}{value})) {
             $self->draw_clipped($y, $x, $config->{attribute}{prompt_name}, $s);
             $x += length($s) + 1;
         }
         # Draw prompt value, e.g. a search field.
         if (defined (my $s = $self->{prompt}{value})) {
+            $self->debug('draw_prompt', $s);
             $self->draw_clipped($y, $x, undef, $s);
             $x += length($s) + 1;
         }
             $self->draw_clipped($y, $x, undef, $s);
             $x += length($s) + 1;
         }
@@ -299,9 +308,13 @@ package Screen {
 
         my $attr_id     = $config->{attribute}{match_id};
         my $attr_string = $config->{attribute}{match_string};
 
         my $attr_id     = $config->{attribute}{match_id};
         my $attr_string = $config->{attribute}{match_string};
+        my $attr_last   = $config->{attribute}{match_last};
 
         foreach (@{$matches_add}) {
 
         foreach (@{$matches_add}) {
-            $self->draw($_->{y}, $_->{x}, $attr_string, $_->{string});
+            my $attr = (defined $_->{id} and $_->{id} == 1)
+                     ? $attr_last
+                     : $attr_string;
+            $self->draw($_->{y}, $_->{x}, $attr, $_->{string});
             if (defined $_->{id}) {
                 $self->draw($_->{y}, $_->{x}, $attr_id, $_->{id});
             }
             if (defined $_->{id}) {
                 $self->draw($_->{y}, $_->{x}, $attr_id, $_->{id});
             }
@@ -603,6 +616,8 @@ sub extend_match {
 
     $screen->debug('extend_match', 'started');
 
 
     $screen->debug('extend_match', 'started');
 
+    return if not defined $match;
+
     $screen->prompt(name => 'extend', value => undef);
     $screen->draw_prompt($config);
 
     $screen->prompt(name => 'extend', value => undef);
     $screen->draw_prompt($config);
 
@@ -1040,6 +1055,8 @@ Defaults in parentheses (foreground, background, attribute).
 
 =item B<match_string>  attribute for matches (yellow, default, normal)
 
 
 =item B<match_string>  attribute for matches (yellow, default, normal)
 
+=item B<match_last>    attribute for the match selected by return (yellow, default, underline)
+
 =item B<prompt_name>   attribute for prompt name (standout)
 
 =item B<prompt_flags>  attribute for prompt flags (standout)
 =item B<prompt_name>   attribute for prompt name (standout)
 
 =item B<prompt_flags>  attribute for prompt flags (standout)
@@ -1058,6 +1075,8 @@ my %attribute = (
     match_id     => $screen->color_pair(Curses::COLOR_RED, -1)
                     | Curses::A_BOLD,
     match_string => $screen->color_pair(Curses::COLOR_YELLOW, -1),
     match_id     => $screen->color_pair(Curses::COLOR_RED, -1)
                     | Curses::A_BOLD,
     match_string => $screen->color_pair(Curses::COLOR_YELLOW, -1),
+    match_last   => $screen->color_pair(Curses::COLOR_YELLOW, -1)
+                    | Curses::A_UNDERLINE,
     prompt_name  => Curses::A_STANDOUT,
     prompt_flags => Curses::A_STANDOUT,
 );
     prompt_name  => Curses::A_STANDOUT,
     prompt_flags => Curses::A_STANDOUT,
 );
@@ -1368,8 +1387,8 @@ RESULT:
             $screen->debug('input', 'selecting match');
             my $tmp = $result;
             $result = select_match($result->{select},
             $screen->debug('input', 'selecting match');
             my $tmp = $result;
             $result = select_match($result->{select},
-                                $screen, \%config, $input,
-                                $result->{matches});
+                                   $screen, \%config, $input,
+                                   $result->{matches});
             $result->{handler} = $tmp->{handler};
             $result->{extend}  = $tmp->{extend};
             goto RESULT; # reprocess special entries in result
             $result->{handler} = $tmp->{handler};
             $result->{extend}  = $tmp->{extend};
             goto RESULT; # reprocess special entries in result