summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2023-12-27 21:12:10 +0000
committerdavidovski <david@davidovski.xyz>2023-12-27 21:12:10 +0000
commita35613e0558af8dd0b6fa158272f78005946eba2 (patch)
treefb3cbfb69c284a13e75fc475f38f007078c3ba79
parent1c9838799a8a548fde6d8bda1475783867877894 (diff)
wrap before end of line instead of after
-rwxr-xr-xtypr.sh11
1 files changed, 7 insertions, 4 deletions
diff --git a/typr.sh b/typr.sh
index f54464e..61f29c3 100755
--- a/typr.sh
+++ b/typr.sh
@@ -57,10 +57,13 @@ typr_draw_text () {
[ ! "$ce" ] && newcolor="" \
- [ "$i" -gt "$startcol" ] && [ "$lt" = " " ] && {
- line=$((line+1))
- draw="${draw}[${line};${startcol}H"
- i=0
+ [ "$lt" = " " ] && {
+ next_word=${t%% *}
+ [ "$i" -gt "$((startcol - ${#next_word}))" ] && {
+ line=$((line+1))
+ draw="${draw}[${line};${startcol}H"
+ i=0
+ }
}
[ "$color" != "$newcolor" ] && {