Skip to content

Escape codes that change color don't work properly #507

Closed

Description

@pankdm

It seems like mosh doesn't support escape sequences that contain both foreground and background color changes (see http://en.wikipedia.org/wiki/ANSI_escape_code#Colors).
The following command isn't shown correctly in mosh:

echo -e "\033[38;5;1;48;5;220m Some text\033[m"

wheres in usual terminal (say iterm2) it looks fine (red text on yellow background).

Note, that the individual color changing commands, e.g:

 echo -e "\033[38;5;1m Some text\033[m"

and

echo -e "\033[48;5;220m Some text\033[m"

works fine.

P.S. If it helps: $TERM is xterm-256color

Activity

  1. keithw commented on Mar 25, 2014

    @keithw
    Member

    Mosh takes the somewhat-opinionated view that the 256color escape sequences need to be generated exactly as specified in the terminfo entry -- which means it's ok to combine arbitrary rendition (color) changes in general, but not the 256color sequences as you're using here. (The 256color sequences are somewhat ill-specified in the first place so we try to keep to a restrictive interpretation to be safe.) This is not the first time this issue has come up, but in general we haven't heard a lot of complaints.

    What program is generating the sequence you gave above? If this is common, we might want to change our stance. (Our understanding is that a terminfo or ncurses program will never generate a sequence like that, but if we're wrong, please let us know!)

  2. pankdm commented on Mar 25, 2014

    @pankdm
    Author

    Thank you for the reply.

    I am using powerline (https://github.com/Lokaltog/powerline). It generates the escape sequence in format I mentioned before (see https://github.com/Lokaltog/powerline/blob/develop/powerline/renderers/shell.py#L62).

    I understand that powerline could be easily patched, but the same issue could arise in other scenarios, so in my opinion the fix in mosh would be more appropriate.

  3. junzh0u commented on Apr 7, 2014

    @junzh0u

    Encounter the same problem, with Powerline + Mosh. I would really appreciate it if you are gonna fix this from mosh side.

  4. undassa commented on May 11, 2014

    @undassa

    same problem

  5. elventear commented on Jul 24, 2014

    @elventear

    Also affected by this.

  6. added a commit that references this issue on Sep 26, 2014
  7. added a commit that references this issue on Feb 11, 2015
  8. added a commit that references this issue on Jun 6, 2015
  9. cgull commented on Jun 6, 2015

    @cgull
    Member

    Fix merged.

  10. cgull commented on Jun 6, 2015

    @cgull
    Member

    Sorry, @keithw, but I think this is the right thing to do. Terminfo/termcap were never intended as complete descriptions of terminal behavior; they're just databases that curses/terminfo can refer to to figure out what they should do. All of the other emulator code I've looked at (I think there were at least 3: xterm, gnome-terminal, rxvt maybe?) works this way.

  11. keithw commented on Feb 11, 2016

    @keithw
    Member

    The issue is closed because we believe it is solved. If you use mosh and find a problem, please open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions