summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarstr\xf6m <john@ankarstrom.se>2021-06-02 23:44:18 +0200
committerJohn Ankarstr\xf6m <john@ankarstrom.se>2021-06-02 23:46:42 +0200
commit3fb6e7ec9efa61e4c2599c79314bed98577af3e1 (patch)
tree378c8f33f3535e2e97eb742b9cda601d36c6e7e2
parente4abbe05b3886d0d652a651e3c2e66fcc5784c07 (diff)
downloadref-3fb6e7ec9efa61e4c2599c79314bed98577af3e1.tar.gz
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.
-rwxr-xr-xre6
1 files changed, 5 insertions, 1 deletions
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;