Article 566MN [SOLVED] zle widget printing blank line before the next prompt

[SOLVED] zle widget printing blank line before the next prompt

by
blueray
from LinuxQuestions.org on (#566MN)
I am using the following widget so that I do not have to write git clone to clone a repo.

Code:function _accept-line-with-url {

if [[ $BUFFER =~ ^https.*git ]]
then
printf "\n"
git clone $BUFFER && cd "$(basename $BUFFER .git)"

zle kill-whole-line
zle .accept-line
else
zle .accept-line
fi
}

zle -N accept-line _accept-line-with-urlHowever, it has a small problem.

Code:~/Desktop% https://github.com/chmln/sd.git
Cloning into 'sd'...
remote: Enumerating objects: 78, done.
remote: Counting objects: 100% (78/78), done.
remote: Compressing objects: 100% (57/57), done.
remote: Total 792 (delta 34), reused 48 (delta 15), pack-reused 714
Receiving objects: 100% (792/792), 239.98 KiB | 308.00 KiB/s, done.
Resolving deltas: 100% (456/456), done.

Desktop/sd:master=%If you look at Desktop/sd:master=%, It is printing an extra blank line before this prompt. Why is that blank line there? How can I remove it?latest?d=yIl2AUoC8zA latest?i=vwX8l1YvOPk:9OxoCHZNrUs:F7zBnMy latest?i=vwX8l1YvOPk:9OxoCHZNrUs:V_sGLiP latest?d=qj6IDK7rITs latest?i=vwX8l1YvOPk:9OxoCHZNrUs:gIN9vFwvwX8l1YvOPk
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments