From 49662443ee9fd7a5570e19e5cfe9158b23993bd0 Mon Sep 17 00:00:00 2001 From: Warren Van Winckel Date: Tue, 6 Feb 2018 01:26:44 -0800 Subject: [PATCH 1/2] Set stty size --- runtime/entrypoint.d/sttysize.sh | 9 +++++++++ runtime/entrypoint.d/sttysize.snippet | 16 ++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100755 runtime/entrypoint.d/sttysize.sh create mode 100644 runtime/entrypoint.d/sttysize.snippet diff --git a/runtime/entrypoint.d/sttysize.sh b/runtime/entrypoint.d/sttysize.sh new file mode 100755 index 00000000..95e92202 --- /dev/null +++ b/runtime/entrypoint.d/sttysize.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +RC=${HOME}/.bashrc +SNIPPET=/st2-docker/entrypoint.d/sttysize.snippet + +if ! grep -q sttysize ${RC}; then + echo >> ${RC} + echo "[ -r ${SNIPPET} ] && . ${SNIPPET}" >> ${RC} +fi diff --git a/runtime/entrypoint.d/sttysize.snippet b/runtime/entrypoint.d/sttysize.snippet new file mode 100644 index 00000000..2852505b --- /dev/null +++ b/runtime/entrypoint.d/sttysize.snippet @@ -0,0 +1,16 @@ +res() { + + old=$(stty -g) + stty raw -echo min 0 time 5 + + printf '\033[18t' > /dev/tty + IFS=';t' read -r _ rows cols _ < /dev/tty + + stty "$old" + + # echo "cols:$cols" + # echo "rows:$rows" + stty cols "$cols" rows "$rows" +} + +res From 9318abd8da958d7ddf4c6850ac8b86b8078c3723 Mon Sep 17 00:00:00 2001 From: Warren Van Winckel Date: Mon, 30 Apr 2018 10:06:59 -0700 Subject: [PATCH 2/2] Add a comment describing what this function does --- runtime/entrypoint.d/sttysize.snippet | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/runtime/entrypoint.d/sttysize.snippet b/runtime/entrypoint.d/sttysize.snippet index 2852505b..64161401 100644 --- a/runtime/entrypoint.d/sttysize.snippet +++ b/runtime/entrypoint.d/sttysize.snippet @@ -1,3 +1,6 @@ +# Ensure the entire terminal is used. This particular code comes from +# https://gist.github.com/scentoni/f4bda3a07cf7711125de3928f95809af + res() { old=$(stty -g) @@ -8,8 +11,6 @@ res() { stty "$old" - # echo "cols:$cols" - # echo "rows:$rows" stty cols "$cols" rows "$rows" }