Also, creating an "option" to decide which behaviour should be followed
(current one or the one I propose) would make everyone happy

It should be possible to code a value for PROMPT_COMMAND that sends
the cursor position report escape sequence (for xterm this is
"\033[6n"), learn the position of the cursor, and conditionally output
a newline if the cursor is not in column 1.

Some quick experimentation shows that this sequence of commands will
do just that:

   echo -en '\033[6n'
   read -d R CURCOL
   CURCOL="${CURCOL##*;}"
   [ "$CURCOL" != 1 ] && echo

Unfortunately, I could not find a way to generate the cursor position
report escape sequence using tput, so you may have hard-code the
escape sequence as shown above.


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to