[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.
- shouldn't prompt printing be smarter?, Francesco Montorsi, 2007/04/01
- Re: shouldn't prompt printing be smarter?, Bob Proulx, 2007/04/01
- Re: shouldn't prompt printing be smarter?, Francesco Montorsi, 2007/04/01
- Re: shouldn't prompt printing be smarter?, Bob Proulx, 2007/04/01
- Re: shouldn't prompt printing be smarter?, Francesco Montorsi, 2007/04/01
- Re: shouldn't prompt printing be smarter?, Paul Jarc, 2007/04/01
- Re: shouldn't prompt printing be smarter?, Francesco Montorsi, 2007/04/01
- Re: shouldn't prompt printing be smarter?,
Fran Litterio <=
- Re: shouldn't prompt printing be smarter?, Chet Ramey, 2007/04/01
- Message not available
- Re: shouldn't prompt printing be smarter?, Thomas Dickey, 2007/04/02