From 6af599a81babf26727b20aa5c22f32e84f039f7d Mon Sep 17 00:00:00 2001 From: Siep Kroonenberg Date: Sat, 17 Jun 2017 20:15:35 +0000 Subject: Line breaking for text-mode __ function git-svn-id: svn://tug.org/texlive/trunk@44624 c570f23f-e606-0410-a88d-b1316a301751 --- Master/install-tl | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/Master/install-tl b/Master/install-tl index e0554b48228..723866666e8 100755 --- a/Master/install-tl +++ b/Master/install-tl @@ -602,7 +602,7 @@ if ($opt_gui eq 'text' or $opt_profile ne "" or } do_cleanup(); # sets $::LOGFILENAME if not already defined if ($LOGFILENAME) { - print STDOUT "Logfile: $::LOGFILENAME\n"; + print STDOUT "\nLogfile: $::LOGFILENAME\n"; } else { # do_cleanup sets $::LOGFILENAME to "" #if no logfile could be written @@ -2385,6 +2385,7 @@ sub create_welcome { "See %s/index.html for links to documentation.\nThe TeX Live web site (http://tug.org/texlive/) contains any updates and corrections. TeX Live is a joint project of the TeX user groups around the world; please consider supporting it by joining the group best for you. The list of groups is available on the web at http://tug.org/usergroups.html.", $::vars{'TEXDIR'}); if (!win32()) { + push @::welcome_arr, "\n"; push @::welcome_arr, __( "Add %s/texmf-dist/doc/man to MANPATH.\nAdd %s/texmf-dist/doc/info to INFOPATH.\nMost importantly, add %s/bin/%s\nto your PATH for current and future sessions.", $::vars{'TEXDIR'}, $::vars{'TEXDIR'}, $::vars{'TEXDIR'}, @@ -2431,9 +2432,46 @@ sub deselect_collections { # assign \&___ to *__ if __ is not otherwise defined sub ___ { my $s = shift; - return sprintf($s, @_); + return wrapped (sprintf($s, @_)); } +sub wrapped { + my $t = shift; + my $toolong = '.{79}'; + if ($t !~ $toolong) { + return $t; + } else { + my @lines = split /\n/, $t; + foreach my $l (@lines) { + if ($l !~ $toolong) { + next; # leave $l alone + } + my @words = split /\s+/, $l; + if (! @words) { + $l = ""; + next; + } else { + my $indent = $l; + $indent =~ s/^(\s*).*$/$1/; # extract leading spaces + my @broken = (); + my $inx = 0; + while (@words) { + if (not ((defined $broken[$inx]) && ($broken[$inx] =~ /\S/))) { + $broken[$inx] = $indent . (shift @words); + } elsif (($broken[$inx] . " " . $words[0]) =~ $toolong) { + $inx++; # NO word consumed, still words remaining + } else { + $broken[$inx] = $broken[$inx] . " " . (shift @words); + } # $l =~ $toolong + } # while @words + $l = join "\n", @broken; + } # @words + } # foreach my $l + return join "\n", @lines; + } # $t =~ $toolong +} # wrapped + + __END__ =head1 NAME -- cgit v1.2.3