Add WISH_AUTONEWLINE. Adds a newline is the output doesn't end with \n

This commit is contained in:
Ceda EI 2019-06-10 16:48:40 +05:30
parent 31ec315ffd
commit 78253e1939
1 changed files with 6 additions and 0 deletions

View File

@ -69,6 +69,12 @@ function wish_main() {
local prev=$? local prev=$?
PS1="" PS1=""
local i local i
if [[ $WISH_AUTONEWLINE != 0 ]]; then
echo -ne "\033[6n" ; read -s -d ';'; read -s -d R WISH_CURSOR_POSITION
if [[ $WISH_CURSOR_POSITION != "1" ]]; then
PS1="\n"
fi
fi
for i in $(seq 0 $((${#WISH_PLUGINS[@]} - 1))); do for i in $(seq 0 $((${#WISH_PLUGINS[@]} - 1))); do
wish_${WISH_PLUGINS[i]}_main $prev wish_${WISH_PLUGINS[i]}_main $prev
if [[ -v WISH_POWERLINE ]] && [[ $WISH_POWERLINE != 0 ]]; then if [[ -v WISH_POWERLINE ]] && [[ $WISH_POWERLINE != 0 ]]; then