{"action":"opened","issue":{"url":"https://api.github.com/repos/xtermjs/xterm.js/issues/1521","repository_url":"https://api.github.com/repos/xtermjs/xterm.js","labels_url":"https://api.github.com/repos/xtermjs/xterm.js/issues/1521/labels{/name}","comments_url":"https://api.github.com/repos/xtermjs/xterm.js/issues/1521/comments","events_url":"https://api.github.com/repos/xtermjs/xterm.js/issues/1521/events","html_url":"https://github.com/xtermjs/xterm.js/issues/1521","id":333992710,"node_id":"MDU6SXNzdWUzMzM5OTI3MTA=","number":1521,"title":"'restore cursor' restoring position but not text attributes","user":{"login":"7PH","id":31401273,"node_id":"MDQ6VXNlcjMxNDAxMjcz","avatar_url":"https://avatars1.githubusercontent.com/u/31401273?v=4","gravatar_id":"","url":"https://api.github.com/users/7PH","html_url":"https://github.com/7PH","followers_url":"https://api.github.com/users/7PH/followers","following_url":"https://api.github.com/users/7PH/following{/other_user}","gists_url":"https://api.github.com/users/7PH/gists{/gist_id}","starred_url":"https://api.github.com/users/7PH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/7PH/subscriptions","organizations_url":"https://api.github.com/users/7PH/orgs","repos_url":"https://api.github.com/users/7PH/repos","events_url":"https://api.github.com/users/7PH/events{/privacy}","received_events_url":"https://api.github.com/users/7PH/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-20T09:21:26Z","updated_at":"2018-06-20T09:21:26Z","closed_at":null,"author_association":"NONE","body":"I had some issues working with some VT100 escape sequences:\r\n- save cursor (ESC 7) (DECSC)\r\n- restore cursor (ESC 8) (DECRC)\r\n\r\nUsually, a [VT100 terminal should save the cursor position but also characters attributes when writing a save cursor escape sequence](https://vt100.net/docs/vt510-rm/DECSC.html)\r\nThe characters attributes should be restored when writing a restore cursor.\r\n\r\n[Currently, the position of the cursor is saved and restored **but not the characters attributes**.](https://github.com/xtermjs/xterm.js/blob/master/src/InputHandler.ts#L1822)\r\n\r\nI've tested the behavior of the save/restore escape sequences on other VT100 implementations to ensure they were handling it:\r\n- gnome-terminal\r\n- terminator\r\n- [hterm](https://chromium.googlesource.com/apps/libapps/+/master/hterm)\r\n\r\nI'll give some details below, and will start working on a solution since I need it for myself. \r\nKeep up the great work!\r\n\r\n## Details\r\n- Browser and browser version: **Chromium: Version 62.0.3202.89 (Developer Build) built on Debian buster/sid, running on Debian buster/sid (64-bit)**\r\n- OS version: **debian buster/sid**\r\n- xterm.js version: **3.4.1**\r\n\r\n### Steps to reproduce\r\n\r\nHere's the VT100 escape sequences used for testing:\r\n```text\r\n\\x1b[0m (reset color)\r\n\\x1b[1;1f (reset origin)\r\n\\x1b[2J (clear)\r\n\\x1b7 (save cursor state)\r\n\\x1b[7m (set negative color)\r\n                        <colored> (just some output)\r\n\\x1b8 (restore cursor state)\r\n<should not be colored>\\n\\r (another output - will be printed in negative color in xtermjs)\r\n```\r\n\r\nWith xtermjs, \"should not be colored\" is colored\r\n```typescript\r\nxterm.write('\\x1b[0m\\x1b[1;1f\\x1b[2J\\x1b7\\x1b[7m                        <colored>\\x1b8<should not be colored>\\n\\r');\r\n// will print:\r\n// \"<should not be colored> <colored>\"\r\n```\r\n\r\nIn a bash, \"should not be colored\" won't be colored\r\n```bash\r\nprintf '\\x1b[0m\\x1b[1;1f\\x1b[2J\\x1b7\\x1b[7m                        <colored>\\x1b8<should not be colored>\\n\\r'\r\n# will print\r\n# \"<should not be colored> <colored>\"\r\n```\r\n"}}
{"actor":{"display_login":"7PH"}}