Chet Ramey <[EMAIL PROTECTED]> wrote: > Fran Litterio wrote: >>> 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:
> This is the right approach. In general, it's not possible for readline > to do this in a terminal-independent way -- termcap and terminfo do not > provide the appropriate capability. If you want to do this, you will > have to decide yourself which terminals to support. yes/no: since termcap doesn't have a standard, one can add capabilities if they're needed. ncurses's terminfo has a convention: # The System V Release 4 and XPG4 terminfo format defines ten string # capabilities for use by applications, <u0>...<u9>. In this file, we use # certain of these capabilities to describe functions which are not covered # by terminfo. The mapping is as follows: # # u9 terminal enquire string (equiv. to ANSI/ECMA-48 DA) # u8 terminal answerback description # u7 cursor position request (equiv. to VT100/ANSI/ECMA-48 DSR 6) # u6 cursor position report (equiv. to ANSI/ECMA-48 CPR) The feature won't work on some terminal types (Sun console for instance). -- Thomas E. Dickey http://invisible-island.net ftp://invisible-island.net _______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash