bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: shouldn't prompt printing be smarter?


From: Fran Litterio
Subject: Re: shouldn't prompt printing be smarter?
Date: Sun, 1 Apr 2007 19:16:15 -0400

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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]