diff options
author | John Ankarstr\xf6m <john@ankarstrom.se> | 2021-06-02 23:44:18 +0200 |
---|---|---|
committer | John Ankarstr\xf6m <john@ankarstrom.se> | 2021-06-02 23:46:42 +0200 |
commit | 3fb6e7ec9efa61e4c2599c79314bed98577af3e1 (patch) | |
tree | 378c8f33f3535e2e97eb742b9cda601d36c6e7e2 | |
parent | e4abbe05b3886d0d652a651e3c2e66fcc5784c07 (diff) | |
download | ref-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-x | re | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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; |