{"action":"opened","issue":{"url":"https://api.github.com/repos/SBoudrias/Inquirer.js/issues/677","repository_url":"https://api.github.com/repos/SBoudrias/Inquirer.js","labels_url":"https://api.github.com/repos/SBoudrias/Inquirer.js/issues/677/labels{/name}","comments_url":"https://api.github.com/repos/SBoudrias/Inquirer.js/issues/677/comments","events_url":"https://api.github.com/repos/SBoudrias/Inquirer.js/issues/677/events","html_url":"https://github.com/SBoudrias/Inquirer.js/issues/677","id":322253378,"number":677,"title":"Wrong position of caret when using ANSI escape commands or backspace in message","user":{"login":"NearAutomata","id":32624319,"avatar_url":"https://avatars3.githubusercontent.com/u/32624319?v=4","gravatar_id":"","url":"https://api.github.com/users/NearAutomata","html_url":"https://github.com/NearAutomata","followers_url":"https://api.github.com/users/NearAutomata/followers","following_url":"https://api.github.com/users/NearAutomata/following{/other_user}","gists_url":"https://api.github.com/users/NearAutomata/gists{/gist_id}","starred_url":"https://api.github.com/users/NearAutomata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NearAutomata/subscriptions","organizations_url":"https://api.github.com/users/NearAutomata/orgs","repos_url":"https://api.github.com/users/NearAutomata/repos","events_url":"https://api.github.com/users/NearAutomata/events{/privacy}","received_events_url":"https://api.github.com/users/NearAutomata/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-11T10:48:40Z","updated_at":"2018-05-11T10:48:40Z","closed_at":null,"author_association":"NONE","body":"The default behavior of `inquirer` is to insert an additional space between the `prefix` and the `message` of a `Question` which looks as follows:\r\n\r\n![screen shot 2018-05-11 at 12 34 07](https://user-images.githubusercontent.com/32624319/39920828-c67c7310-5518-11e8-841d-7b4ef86a66a2.png)\r\n\r\nIn my case I am trying to remove that space since I am using background colors to indicate the different parts of the prompt (similar to Powerline). When I add `message: chalk.reset(chalk.bgGreen.black(\"\\b $ \"))` for example there is an annoying side effect which you can see here:\r\n\r\n![screen shot 2018-05-11 at 12 34 33](https://user-images.githubusercontent.com/32624319/39920871-fedc7ec6-5518-11e8-9bf0-70386282fc63.png)\r\n\r\nThe dark caret at the end of the text is always one char off since the manual backspace does change the caret's position. Is there any reasonable way to fix this without manually altering these lines:\r\n\r\nhttps://github.com/SBoudrias/Inquirer.js/blob/a4cfcd39bab203e979abb0174d504c4f4cefc375/lib/prompts/base.js#L117-L122\r\n\r\nFurthermore usual ANSI escape codes do not change the visual caret position although the logical caret is moved correctly. That means replacing my `\\b` with a `\\u001b[1D` to move the caret left cause the same rendering issue."}}
{"actor":{"display_login":"NearAutomata"}}