Skip to content

Commit

Permalink
fix: explicitly set terminal tput COLUMNS width [NMO-546]
Browse files Browse the repository at this point in the history
  • Loading branch information
RedLeader962 committed May 10, 2024
1 parent 4c40520 commit fb804b9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/function_library/prompt_utilities.bash
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,12 @@ function n2st::draw_horizontal_line_across_the_terminal_window() {

# Ref https://bash.cyberciti.biz/guide/$TERM_variable
TPUT_FLAG="-T $TERM"

# (CRITICAL) ToDo: on task end >> delete next bloc ↓↓
printenv
echo -e "Original TERM=${TERM}"

if [[ -z ${TERM} ]]; then
TPUT_FLAG='-T xterm-256color'
elif [[ ${TERM} == dumb ]]; then
# "dumb" is the one set on TeamCity Agent
TPUT_FLAG='-T xterm-256color'
# TPUT_FLAG='-T xterm-256color'
unset TPUT_FLAG
fi

# (NICE TO HAVE) ToDo:
Expand All @@ -161,6 +157,12 @@ function n2st::draw_horizontal_line_across_the_terminal_window() {
terminal_width="${COLUMNS:-$(tput ${TPUT_FLAG} cols)}"
pad=$(printf -- "${SYMBOL}%.0s" $(seq $terminal_width))
printf -- "${pad}\n"

# # (CRITICAL) ToDo: on task end >> delete next bloc ↓↓
# echo "terminal_width=${terminal_width}"
# echo "seq $terminal_width = $(seq $terminal_width)"
# echo "$SHELL"
# ps -p $$
}

# =================================================================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ SHELL ["/bin/bash", "-e", "-c"]
ARG DEBIAN_FRONTEND=noninteractive

ENV TERM=${TERM:-"xterm-256color"}

#RUN tput -T $TERM init
ENV COLUMNS=80

# ====Begin========================================================================================
# ....Setup timezone and localization..............................................................
Expand Down

0 comments on commit fb804b9

Please sign in to comment.