From: Steve Peters Date: Sat, 15 Jul 2006 15:22:35 +0000 (+0000) Subject: Upgrade to ANSIColor-1.11 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cd07961becb6aedb450c6b97e45886d44a7289c2;p=p5sagit%2Fp5-mst-13.2.git Upgrade to ANSIColor-1.11 p4raw-id: //depot/perl@28580 --- diff --git a/MANIFEST b/MANIFEST index 7856c0d..1e6a115 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2390,7 +2390,8 @@ lib/tainted.pl Old code for tainting lib/Term/ANSIColor/ChangeLog Term::ANSIColor lib/Term/ANSIColor.pm Perl module supporting termcap usage lib/Term/ANSIColor/README Term::ANSIColor -lib/Term/ANSIColor/test.pl See if Term::ANSIColor works +lib/Term/ANSIColor/t/basic.t Tests for Term::ANSIColor +lib/Term/ANSIColor/t/pod.t Tests for Term::ANSIColor lib/termcap.pl Perl library supporting termcap usage lib/Term/Cap.pm Perl module supporting termcap usage lib/Term/Cap.t See if Term::Cap works diff --git a/lib/Term/ANSIColor.pm b/lib/Term/ANSIColor.pm index ef27ae9..9832c41 100644 --- a/lib/Term/ANSIColor.pm +++ b/lib/Term/ANSIColor.pm @@ -1,7 +1,7 @@ # Term::ANSIColor -- Color screen output using ANSI escape sequences. -# $Id: ANSIColor.pm,v 1.10 2005/08/21 18:31:58 eagle Exp $ +# $Id: ANSIColor.pm 58 2006-07-12 22:30:55Z eagle $ # -# Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2005 +# Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2005, 2006 # by Russ Allbery and Zenin # # This program is free software; you may redistribute it and/or modify it @@ -32,9 +32,7 @@ use Exporter (); ON_CYAN ON_WHITE)]); Exporter::export_ok_tags ('constants'); -# Don't use the CVS revision as the version, since this module is also in Perl -# core and too many things could munge CVS magic revision strings. -$VERSION = '1.10'; +$VERSION = '1.11'; ############################################################################## # Internal data structures @@ -209,9 +207,10 @@ Term::ANSIColor - Color screen output using ANSI escape sequences print "This text is bold blue.\n"; print color 'reset'; print "This text is normal.\n"; - print colored ("Yellow on magenta.\n", 'yellow on_magenta'); + print colored ("Yellow on magenta.", 'yellow on_magenta'), "\n"; print "This text is normal.\n"; - print colored ['yellow on_magenta'], "Yellow on magenta.\n"; + print colored ['yellow on_magenta'], 'Yellow on magenta.'; + print "\n"; use Term::ANSIColor qw(uncolor); print uncolor '01;31', "\n"; @@ -269,10 +268,12 @@ Normally, colored() just puts attribute codes at the beginning and end of the string, but if you set $Term::ANSIColor::EACHLINE to some string, that string will be considered the line delimiter and the attribute will be set at the beginning of each line of the passed string and reset at the end of -each line. This is often desirable if the output is being sent to a program -like a pager that can be confused by attributes that span lines. Normally -you'll want to set $Term::ANSIColor::EACHLINE to C<"\n"> to use this -feature. +each line. This is often desirable if the output contains newlines and +you're using background colors, since a background color that persists +across a newline is often interpreted by the terminal as providing the +default background color for the next line. Programs like pagers can also +be confused by attributes that span lines. Normally you'll want to set +$Term::ANSIColor::EACHLINE to C<"\n"> to use this feature. Alternately, if you import C<:constants>, you can use the constants CLEAR, RESET, BOLD, DARK, UNDERLINE, UNDERSCORE, BLINK, REVERSE, CONCEALED, BLACK, @@ -280,11 +281,14 @@ RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, ON_BLACK, ON_RED, ON_GREEN, ON_YELLOW, ON_BLUE, ON_MAGENTA, ON_CYAN, and ON_WHITE directly. These are the same as color('attribute') and can be used if you prefer typing: - print BOLD BLUE ON_WHITE "Text\n", RESET; + print BOLD BLUE ON_WHITE "Text", RESET, "\n"; to - print colored ("Text\n", 'bold blue on_white'); + print colored ("Text", 'bold blue on_white'), "\n"; + +(Note that the newline is kept separate to avoid confusing the terminal as +described above since a background color is being used.) When using the constants, if you don't want to have to remember to add the C<, RESET> at the end of each print line, you can set @@ -298,7 +302,9 @@ will reset the display mode afterwards, whereas: print BOLD, BLUE, "Text\n"; -will not. +will not. If you are using background colors, you will probably want to +print the newline with a separate print statement to avoid confusing the +terminal. The subroutine interface has the advantage over the constants interface in that only two subroutines are exported into your namespace, versus @@ -465,8 +471,8 @@ with input from Zenin. Russ Allbery now maintains this module. =head1 COPYRIGHT AND LICENSE -Copyright 1996, 1997, 1998, 2000, 2001, 2002 Russ Allbery -and Zenin. This program is free software; you may redistribute it and/or -modify it under the same terms as Perl itself. +Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2005, 2006 Russ Allbery + and Zenin. This program is free software; you may +redistribute it and/or modify it under the same terms as Perl itself. =cut diff --git a/lib/Term/ANSIColor/ChangeLog b/lib/Term/ANSIColor/ChangeLog index 6012ee1..d488dae 100644 --- a/lib/Term/ANSIColor/ChangeLog +++ b/lib/Term/ANSIColor/ChangeLog @@ -1,3 +1,18 @@ +2006-07-12 Russ Allbery + + * ANSIColor.pm: Version 1.11 released. + +2006-06-22 Russ Allbery + + * ANSIColor.pm: Clarify in the documentation the behavior of + terminals when background colors are set across newlines, and + rewrite some of the examples to avoid doing things that confuse + the terminal. Fix a couple of spelling errors. + + * test.pl: Moved to... + * t/basic.t: ...here. + * t/pod.t: New test for POD validity. + 2005-08-21 Russ Allbery * ANSIColor.pm: Version 1.10 released. diff --git a/lib/Term/ANSIColor/README b/lib/Term/ANSIColor/README index 443c499..cea39dc 100644 --- a/lib/Term/ANSIColor/README +++ b/lib/Term/ANSIColor/README @@ -1,7 +1,7 @@ - Term::ANSIColor version 1.10 + Term::ANSIColor version 1.11 (A simple ANSI text attribute control module) - Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2005 Russ Allbery + Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2005, 2006 Russ Allbery and Zenin. This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself. @@ -98,4 +98,7 @@ THANKS To James Bowlin for catching a bug in colored when $EACHLINE is set that caused it to not color lines consisting solely of 0. + To Helge Kreutzmann for pointing out the need for warnings in the + documentation about background colors that span newlines. + To Larry Wall, as always, for Perl. diff --git a/lib/Term/ANSIColor/test.pl b/lib/Term/ANSIColor/t/basic.t old mode 100755 new mode 100644 similarity index 92% rename from lib/Term/ANSIColor/test.pl rename to lib/Term/ANSIColor/t/basic.t index ddf34df..eb0eb6b --- a/lib/Term/ANSIColor/test.pl +++ b/lib/Term/ANSIColor/t/basic.t @@ -1,10 +1,7 @@ #!/usr/bin/perl -# $Id: test.pl,v 1.5 2005/08/21 18:31:58 eagle Exp $ +# $Id: basic.t 55 2006-06-22 17:56:02Z eagle $ # -# test.pl -- Test suite for the Term::ANSIColor Perl module. -# -# Before "make install" is performed this script should be runnable with "make -# test". After "make install" it should work as "perl test.pl". +# t/basic.t -- Test suite for the Term::ANSIColor Perl module. ############################################################################## # Ensure module can be loaded diff --git a/lib/Term/ANSIColor/t/pod.t b/lib/Term/ANSIColor/t/pod.t new file mode 100644 index 0000000..5e73bcc --- /dev/null +++ b/lib/Term/ANSIColor/t/pod.t @@ -0,0 +1,12 @@ +#!/usr/bin/perl +# $Id: pod.t 55 2006-06-22 17:56:02Z eagle $ +# +# t/pod.t -- Test POD formatting for Term::ANSIColor. + +eval 'use Test::Pod 1.00'; +if ($@) { + print "1..1\n"; + print "ok 1 # skip - Test::Pod 1.00 required for testing POD\n"; + exit; +} +all_pod_files_ok ();