Here is how you do it. What we're going to do is generate the PS1 (shell prompt) and your current words to repair the broken new line. We could stick the contents of $actualPS1
inside our echo statment directly, but I figured this method was much more legible.
...
*)
actualPS1=$(eval echo \"$PS1\")
echo -en "\nWhatever line of text you want.\n"
echo -en "${actualPS1}${COMP_WORDS[@]}"
return 0
;;
esac
...
That will print a line of text for your specific case and then give the console back to you properly. There is no need to specify what COMPREPLY should be.
Note that you could basically add this completion to anything that can't be completed by normal means as a helpful reminder to the end user. One method that could potentially use this would be echo
itself!