diff options
author | davidovski <david@davidovski.xyz> | 2023-12-27 21:12:10 +0000 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2023-12-27 21:12:10 +0000 |
commit | a35613e0558af8dd0b6fa158272f78005946eba2 (patch) | |
tree | fb3cbfb69c284a13e75fc475f38f007078c3ba79 | |
parent | 1c9838799a8a548fde6d8bda1475783867877894 (diff) |
wrap before end of line instead of after
-rwxr-xr-x | typr.sh | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -57,10 +57,13 @@ typr_draw_text () { [ ! "$ce" ] && newcolor="[0;37m" \ - [ "$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" ] && { |