From c40b8fe22687401fe8ea81e65c8a163e11945ba1 Mon Sep 17 00:00:00 2001 From: Luxferre Date: Tue, 4 Apr 2023 11:07:52 +0300 Subject: [PATCH] improved gmi2txt.sh --- tools/gmi2txt.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/gmi2txt.sh b/tools/gmi2txt.sh index 1445328..d255bdb 100644 --- a/tools/gmi2txt.sh +++ b/tools/gmi2txt.sh @@ -18,7 +18,10 @@ SPC=$'\x20' [[ -z "$LSPACES" ]] && LSPACES=0 [[ -z "$TSPACES" ]] && TSPACES=0 -reflowfmt="%-$(( LSPACES ))s%-${TARGET_WIDTH}s%-$(( TSPACES ))s\n" # params: smth, line, smth +FORMAT_WIDTH=0 # make formatting width distinct from the target reflow width +(( TSPACES > 0 )) && FORMAT_WIDTH="$TARGET_WIDTH" # and only use it if there are trailing spaces + +reflowfmt="%-$(( LSPACES ))s%-${FORMAT_WIDTH}s%-$(( TSPACES ))s\n" # params: smth, line, smth reflow_line() { # single-line logic from phlow.sh, adapted into a function and separating by LF only local line="$1"