http://invisible-island.net/ncurses/
Copyright © 2016,2023 by Thomas E. Dickey


Synopsis

The ncurses terminal database includes descriptions for most of the terminals (or emulators) you may happen to use. A few are excluded, usually because the terms under which the terminal is provided are not permissive enough.

Usually, that is, except for rxvt-unicode.

Background

I have dealt with rxvt developers since 1996. Development of rxvt-unicode began with the rxvt source-code in November 2003, making these significant changes:

There are other changes, e.g., support for CJK, input-method ISO 14755 and a Perl interface. But from the standpoint of ncurses, very little has changed: almost all of the relevant terminal emulator work was done before rxvt-unicode.

Because the last version of rxvt (2.7.10) was released in March 2003, rxvt-unicode is technically not a “fork” (since there was never more than one active line of development) but rather a switch in focus, continuing the development of rxvt. Its developer began by describing it as a “clone” but that was an error because it is clearly a derived work rather than an independent implementation.

Issues

Before I provided a workable terminal description for the rxvt developers late in 1997, it had only a file adapted from Midnight Commander sources which used xterm as the value for TERM. There were differences when comparing to xterm which I addressed:

While rxvt-unicode provides an updated terminal description (see source code), the same type of fixes would be needed if I were to incorporate it into ncurses.

Now here is the problem: in some cases the terminal developers provide a usable terminal description, but generally the more work that has to be done, the less the terminal developers want to be involved with terminal descriptions. But rxvt-unicode is an exception.

Take these bug reports for example:

In each case, the developer was part of the problem. He also spent some time aggravating the situation, e.g.,

In the meantime, as part of routine development, I checked the terminal description for rxvt-unicode, found (and fixed for my own use) the issues noted. But publishing the result would inevitably lead into needless conflict, particularly where I would point out that some of the advertised features of rxvt-unicode do not work (at least not compatibly with other programs), and are not present in the resulting description.

To get a sense for this, read the developer's comments in

A few people asked in private email about this (as early as 2006). Finally in 2009 someone asked on the ncurses mailing list, so the viewpoints on both sides have been given:

Example

Here is a copy of the terminal description which I use for reference. Expect some disagreement.

# $Id: ncurses-urxvt.html,v 1.8 2023/12/30 17:58:04 tom Exp $
# vile:timode file-encoding=utf-8
#
# From: Thomas Dickey <dickey@clark.net> 04 Oct 1997
# Updated: Ã–zgür Kesim <kesim@math.fu-berlin.de> 02 Nov 1997
# Updated: Marc Lehmann <pcg@goof.com>, 17 Feb 2005
# Notes:
# It has an AIX extension
#       box2=lqkxjmwuvtn,
# but the latter does not work correctly.
#
# rxvt-unicode uses special functions for shift+control, so the corresponding
# function-keys from rxvt+pcfkeys are unavailable here (kf35-kf44).
#
# kIC, kNXT and kPRV do not work (no visible display).
# perhaps this is copying from xterm's default translations.
#
# Comparing with 9.30,
#       since 2021-05-17 (9.26), implements 1006 mouse-mode and focus events.
#       since 2016-06-30 (9.26), implements direct color mapped to 256-colors
#       since 2014-08-21 (9.22), implements DECSCUSR/xterm
#       insert-key on editing-keypad allows modifiers:
#               kIC3=\E[28~     alt             (kf15)
#               kIC4=\E[28$     shift+alt       (?)
#               kIC5=\E[28^     control         (kf37)
#               kIC6=\E[3@      shift+control   (?)
#               kIC7=\E[28^     alt+control     (kf37)
#               kIC8=\E[28@     shift+alt+ctrl  (?)
#       numeric-keypad does not allow modifiers
#               kp_insert       \EOp
#               kp_del          \EOn
#               kp_enter        \EOM
#               kp_plus         \EOk
#               kp_minus        \EOm
#               kp_multiply     \EOj
#               kp_divide       \EOo
#               kp_numlock      N/A
#       does not know OSC 104, hence cannot reset 256-color palette
#       amended cvvis to be like xterm, though private modes 12 and 25 differ
# vttest:
#       answerback returns \E[?1;2c
#       secondary DA returns \E[>85;95;0c
#       VT52 works
#       SRM does not work
#       most cursor-movement works, except CNL
#       SD works but not REP, SL, SR, SU
#
# Comparing with 9.02, besides the missing key definitions:
#       uses km (but since it doesn't support meta key, it's wrong)
#       defines some extra acsc codes
#       pairs is still 256 (to work with ncurses5)
#       defines status-line (but I don't, since it doesn't use column param)
#       uses cvvis (to work with one of Emacs bugs)
#       sgr uses invis, but it's not supported
#       sgr0 uses the shift in/out rather than scs.
#       cursor-keys use CSI rather than SS3.
#
# 9.02 no longer sets application-keypad mode.  That's the \E[?1h in smkx,
# rmkx as well as in is2 and rs2.
#
# 9.05 notes -
#       its wrapping behavior (vttest menu 1) matches xterm.
#       rxvt 2.6.4's behavior differs.
#
#       urxvt 9.05 blink doesn't work properly.  Using the "blink" sequence,
#       it does blink.  But ncurses prefers sgr, which first does a reset:
#               \E[0;5m
#       Something confuses urxvt, and it shows dim text.  It seems that the
#       problem is the use of the SGR 38's, which force the colors to be
#       conflicting with its blink function.
#
# 9.06 notes -
#       Its terminfo and the numeric keypad differ.  Adapting the table from
#       terminfo.src, kp0-kp9 differ from rxvt, as well as ".":
#
#  XK_KP_Multiply   *                                      ESC O j
#  XK_KP_Add        +                                      ESC O k
#  XK_KP_Separator  ,                                      ESC O l
#  XK_KP_Subtract   -                                      ESC O m
#  XK_KP_Decimal    .                                      ESC O _
#  XK_KP_Divide     /                                      ESC O o
#  XK_KP_0          0                                      ESC O p
#  XK_KP_1          1                                      ESC O \
#  XK_KP_2          2                                      ESC O Y
#  XK_KP_3          3                                      ESC O [
#  XK_KP_4          4                                      ESC O V
#  XK_KP_5          5                                      ESC O ]
#  XK_KP_6          6                                      ESC O X
#  XK_KP_7          7                                      ESC O U
#  XK_KP_8          8                                      ESC O W
#  XK_KP_9          9                                      ESC O Z
#
#       For reference, I'm still using the vt220+keypad building block.
#
#       These keys do not work with tack: kfnd, kNXT, kDC, kPRV, kslt, kIC
#
#       Its is2/rs2 strings are longer (the former clears the screen, otherwise
#       they're the same).  Most of the increased length is explicitly
#       resetting modes that are reset in xterm using the soft reset.
#
#       The acsc string defines the teletype arrow symbols and block.
#       Those are redundant in xterm, since they're available in UTF-8
#       mode, which means they always work in uxterm with ncurses, and
#       other curses implementations do not support them.
#
# 9.09
#       adds a "rxvt-unicode-256color" which is okay except for the length of
#       the name.  I use urxvt-256color.
#
#       reviewing 9.09, realized that rxvt and urxvt support cbt.
#
#       9.09 also changes the various k[abc][123] values to match vt100,
#       abandoning long-term compatibility with rxvt.
#
urxvt|rxvt-unicode|rxvt-unicode terminal (X Window System),
        ambcebweomc5imirmsgrnpcxenlxonXT,
        btns#5cols#80lines#24lm#0ncv#0,
        acsc=+C\,D-A.B0E``aaffgghFiGjjkkllmmnnooppqqrrssttuuvvwwxxyy
             zz{{||}}~~
,
        bel=^Gclear=\E[H\E[2Jcr=\rcub1=^Hcud1=\n,
        ech=\E[%p1%dXed=\E[Jel=\E[Kel1=\E[1Kenacs=,
        flash=\E[?5h$<200/>\E[?5lhpa=\E[%i%p1%dGich1@,
        ind=\n,
        initc=\E]4;%p1%d;rgb:%p2%{65535}%*%{1000}%/%4.4X/%p3%{65535}
              %*%{1000}%/%4.4X/%p4%{65535}%*%{1000}%/%4.4X\E\\
,
        invis@, is1=\E[!p,
        is2=\E[r\E[m\E[2J\E[?7;25h\E[?1;3;4;5;6;9;66;1000;1001;1049l
            \E[4l
,
        kbs=^?kcbt=\E[Zmc0=\E[imc4=\E[4imc5=\E[5ioc@,
        op=\E[39;49mri=\EMritm=\E[23mrmacs=\E(Brmam=\E[?7l,
        rmcup=\E[r\E[?1049lrmkx=\E>rmpch@, rs1=\Ec,
        rs2=\E[r\E[m\E[?7;25h\E[?1;3;4;5;6;9;66;1000;1001;1049l\E[4l,
        s0ds=\E(Bs1ds=\E(0s2ds=\E*Bs3ds=\E+B,
        setab=\E[48;5;%p1%dmsetaf=\E[38;5;%p1%dm,
        setb=%?%p1%{7}%>%t\E[48;5;%p1%dm%e\E[4%?%p1%{1}%=%t4%e%p1
             %{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m%;
,
        setf=%?%p1%{7}%>%t\E[38;5;%p1%dm%e\E[3%?%p1%{1}%=%t4%e%p1
             %{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m%;
,
        sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?
            %p9%t\E(0%e\E(B%;
,
        sgr0=\E[m\E(Bsitm=\E[3msmacs=\E(0smam=\E[?7h,
        smcup=\E[?1049hsmkx=\E=smpch@, vpa=\E[%i%p1%dd,
        Se=\E[ qSs=\E[%p1%d quse=att610+cvisuse=ansi+csr,
        use=ansi+cupuse=ansi+inittabsuse=ansi+idc,
        use=ansi+idluse=ansi+localuse=ecma+index,
        use=ecma+sgruse=rxvt+pcfkeysuse=vt100+enq,
        use=vt220+keypaduse=xterm+88coloruse=xterm+focus,
        use=xterm+sl-twmuse=xterm+sm+1006,
        use=bracketed+paste,
 
urxvt-direct|urxvt mapping direct-color to 256-colors,
        use=xterm+direct2use=urxvt,
 
# This user comment claims that it works with just a terminfo change:
#       http://lists.schmorp.de/pipermail/rxvt-unicode/2008q2/000626.html
# At the time, I had the Debian package for rxvt-unicode 9.05, which only
# supports 88 colors (2008/8/23).
urxvt-256color|rxvt-unicode-256color|urxvt with xterm 256-colors,
        use=xterm+256coloruse=urxvt,
 
# This would be the conventional 88-color entry (use for comparison).
urxvt-88color|rxvt-unicode-88color|urxvt with xterm 88-colors,
        use=xterm+88coloruse=urxvt,
 
screen.urxvt-256color|screen.rxvt-unicode-256color|urxvt with xterm 256-colors,
        use=xterm+256coloruse=screen.urxvt,
 
# Tested with screen 4.00.02 and rxvt-unicode 9.02
# screen overrides kf1-kf4 and the cursor keys
screen.urxvt|screen.rxvt-unicode|screen in rxvt-unicode,
        bw,
        cvvis@, flash@, kcub1=\EODkcud1=\EOBkcuf1=\EOC,
        kcuu1=\EOAuse=screen+fkeysuse=rxvt+pcfkeys,
        use=vt100+enquse=vt220+keypaduse=screen4,
screen-bce.rxvt-unicode|screen optimized for rxvt-unicode,
        bceuse=screen.rxvt-unicode,