summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2023-10-10 04:20:07 +0200
committerAlejandro Colomar <alx@kernel.org>2023-10-10 04:58:14 +0200
commit53973e375f0d93bd5946b9d7c840c2ef711ada65 (patch)
treedbd22b7a5da3e75a00e32e374c8a1b86f4e97670
parent920957bb0e30198f49de649b111b4a4e04f24c4d (diff)
bin/ovr: --no-alt: Don't overwrite stderr
Move part of the escape sequence to the end of stdout lines, instead of the begining of lines, so that a stdout line won't overwrite the previous line if it comes from stderr. Instead, a stderr line coming after a stdout one will overwrite it. Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rwxr-xr-xbin/ovr4
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/ovr b/bin/ovr
index 8294aa1..28784e6 100755
--- a/bin/ovr
+++ b/bin/ovr
@@ -29,8 +29,8 @@ ovr_alt()
ovr_noalt()
{
setterm --linewrap off;
- sed \
- -e '2,$ s/^/\x1B[1A\x1B[K/';
+ sed -e '$ ! s/$/\x1B[1A/' \
+ -e '2,$ s/^/\x1B[K/';
setterm --linewrap on;
}