Bug 1247495 - terminfo 'screen' behavior broken wrt reverse color
terminfo 'screen' behavior broken wrt reverse color
Status: CLOSED DUPLICATE of bug 1245426
Product: Fedora
Classification: Fedora
Component: ncurses (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Miroslav Lichvar
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2015-07-28 03:25 EDT by Paul DeStefano
Modified: 2016-07-19 06:02 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2016-07-19 06:02:29 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Paul DeStefano 2015-07-28 03:25:18 EDT
Description of problem:
When TERM=screen, behavior of reverse color, an effect widely used by terminal utilities, is broken.  Effect shows as italic, not reverse video.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. man man

Actual results:
Reverse video characters show as italic, not reverse color.

Expected results:
Reverse color.

Additional info:
I see this in the ncurses documentation:

        + fix dereference before null check found by Coverity in tic.c
          (cf: 20140524).
        + fix sign-extension bug in read_entry.c which prevented "toe" from
          reading empty "screen+italics" entry.
        + modify sgr for screen.xterm-new to support dim capability -TD
        + add dim capability to nsterm+7 -TD
        + cancel dim capability for iterm -TD
        + add dim, invis capabilities to vte-2012 -TD
        + add sitm/ritm to konsole-base and mlterm3 -TD

        > fix regression in screen terminfo entries (reports by Christian
          Ebert, Gabriele Balducci) -TD
        + revert the change to screen; see notes for why this did not work -TD
        + cancel sitm/ritm for entries which extend "screen", to work around
          screen's hardcoded behavior for SGR 3 -TD

I think, judging from the rpm changelog, these updates were pulled into Fedora pkg *after* F21 rebuild and, therefore, showed up first in F22.  So, the timing fits, I think.
Comment 1 Robin Powell 2015-07-29 13:53:25 EDT
I know this isn't really very severe, but it's driving me bonkers because I use "less" *all the time*, and now I can't see what I'm searching for, because my terminal doesn't *do* italics, so searches are totally invisible.  ;_;
Comment 2 Robin Powell 2015-07-29 13:58:27 EDT
To clarify: I am having this issue with screen-265color, as well.  Also, setting TERM=xterm fixes it, but tmux says you're not supposed to do that.
Comment 3 Paul DeStefano 2015-07-29 14:06:21 EDT
See bug 1245426 for more info and workarounds.

You can't use xterm terminfo with TMUX and ncurses applications; moving the cursor around just messes everything up.  I use alpine, finch, wyrd, and irssi every day and three of them break with TERM=xterm* .

(Yes, I agree, 'bonkers' is exactly right!)
Comment 4 Melvar Chen 2015-07-29 15:55:53 EDT
To explain the specific problem: less, and presumably other programs, use smso (set stand-out mode) to hilight things, which generally ends up being reverse video. The screen-256color terminfo says that smso is SGR 3, which screen does interpret as reverse video, replacing it with the outer terminal’s reverse video code. In xterm-256color, reverse video is SGR 7. tmux (at least in the current F22 version) does not duplicate screen’s interpretation, and instead passes SGR 3 through unmodified, which other terminals then interpret as sitm (set italics mode) in accordance with the xterm-256color terminfo.

The bug linked in comment #3 indicates that the use of SGR 3 is a change to the screen-256color terminfo, but the corresponding compatibility fix to tmux was not incorporated in F22.
Comment 5 Miroslav Lichvar 2015-08-03 04:14:31 EDT
So the problem only shows up with tmux, which doesn't perfectly emulate screen?

In upstream ncurses there was a tmux terminfo entry recently included, that would probably be the best place to fix these issues. It will take some time before it's included in all major distributions, but tmux could then use its own entry and won't have to emulate all quirks of screen.
Comment 6 Miroslav Lichvar 2015-08-13 07:11:09 EDT
FWIW, the tmux terminfo is included in the latest rawhide ncurses.
Comment 7 Miroslav Lichvar 2016-07-19 06:02:29 EDT
It seems this was already fixed in tmux, so I'm closing this as a duplicate of the tmux bug.

*** This bug has been marked as a duplicate of bug 1245426 ***

Note You need to log in before you can comment on or make changes to this bug.