From 3fb6e7ec9efa61e4c2599c79314bed98577af3e1 Mon Sep 17 00:00:00 2001 From: "John Ankarstr\\xf6m" Date: Wed, 2 Jun 2021 23:44:18 +0200 Subject: re: Improve wrapping Tabs are now taken into account, as long as they are eight spaces long (which they should be). Also, lines will now only be wrapped if more than five characters extend past the maximum line length. --- re | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/re b/re index 51e400e..78f4129 100755 --- a/re +++ b/re @@ -112,7 +112,11 @@ while (<$fh>) { $bytes += length($_); last if $end and $bytes > $end; /^(\s+)/; my $indent = $1; - s/(.{60})(.)/$1\\fR...\\fP\n$indent\t$2/g; + my $max = 64; + for (split //, $indent) { + $max -= 7 if /\t/; + } + s/(.{$max})(.{6,})/$1\\fR...\\fP\n$indent\t$2/g; s/\\/\\\\/g; s/\\\\fR...\\\\fP/\\fR...\\fP/g; s/^\./\\&./m; -- cgit v1.2.3