From a35613e0558af8dd0b6fa158272f78005946eba2 Mon Sep 17 00:00:00 2001 From: davidovski Date: Wed, 27 Dec 2023 21:12:10 +0000 Subject: wrap before end of line instead of after --- typr.sh | 11 +++++++---- 1 file 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" ] && { -- cgit v1.2.1