X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=term2gui.pl;h=274ad2cc7d37fc98194344d447d08bfaeca52371;hb=58369e3fc1dcd091fbf35408951c8e40008f39c4;hp=c019326f8448117d49b07df7d04fc7ebc82ad0fb;hpb=3490b7298c1a541ea03ea657da642e2195e61cef;p=config%2Fdotfiles.git diff --git a/term2gui.pl b/term2gui.pl index c019326..274ad2c 100755 --- a/term2gui.pl +++ b/term2gui.pl @@ -3,7 +3,7 @@ # Convert a terminal color scheme for 256 color terminals to a GUI color # scheme by adding the appropriate gui* options. -# Copyright (C) 2012 Simon Ruderich +# Copyright (C) 2012-2014 Simon Ruderich # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -281,10 +281,10 @@ sub xterm2rgb { } -while (my $line = <>) { +while () { # Only handle lines with highlight commands. - if ($line =~ /^\s*\bhi(?:ghlight)?\b/) { - foreach my $setting ($line =~ m/\bcterm(?:fg|bg)?=\S+/g) { + if (/^\s*\bhi(?:ghlight)?\b/) { + foreach my $setting (m/\bcterm(?:fg|bg)?=\S+/g) { my ($name, $value) = split /=/, $setting; my $gui_name = $name; @@ -300,14 +300,14 @@ while (my $line = <>) { } # Update existing value. - if ($line =~ /\b\Q$gui_name\E=/) { - $line =~ s/\Q$gui_name\E=\S+/$gui_name=$new_value/; + if (/\b\Q$gui_name\E=/) { + s/\Q$gui_name\E=\S+/$gui_name=$new_value/; # Append at the end of the line. } else { - $line =~ s/\n/ $gui_name=$new_value\n/; + s/\n/ $gui_name=$new_value\n/; } } } - print $line; + print; }