summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2023-10-10 04:57:26 +0200
committerAlejandro Colomar <alx@kernel.org>2023-10-10 04:57:26 +0200
commit920957bb0e30198f49de649b111b4a4e04f24c4d (patch)
treec828b4290de54a3837fbe15cbe1bae498166eab8
parent15370a64924b1efc189ae5b77cb0cc811e173ef4 (diff)
bin/ovr: --no-alt: Use setterm --linewrap off to trim long lines
This is more reliable, and probably faster, than using sed(1). Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rwxr-xr-xbin/ovr6
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/ovr b/bin/ovr
index a930710..8294aa1 100755
--- a/bin/ovr
+++ b/bin/ovr
@@ -28,8 +28,10 @@ ovr_alt()
ovr_noalt()
{
- sed -e "s/^\(.\{,$(tput cols)\}\).*$/\1/" \
- -e '2,$s/^/\x1B[1A\x1B[K/';
+ setterm --linewrap off;
+ sed \
+ -e '2,$ s/^/\x1B[1A\x1B[K/';
+ setterm --linewrap on;
}