[Top][All Lists]

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

Re: shouldn't prompt printing be smarter?

From: Thomas Dickey
Subject: Re: shouldn't prompt printing be smarter?
Date: Mon, 02 Apr 2007 12:45:16 -0000
User-agent: tin/1.4.4-20000803 ("Vet for the Insane") (UNIX) (SunOS/5.8 (sun4u))

Chet Ramey <address@hidden> 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

reply via email to

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