Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add readline ignore markers to color escape codes in the shell #900

Merged
merged 1 commit into from
Aug 10, 2016

Conversation

stevendanna
Copy link
Contributor

@stevendanna stevendanna commented Aug 10, 2016

Previously, if you typed more than 20 characters at the prompt and
attempted to press Ctrl+a (readline's "Move to start of line" command),
your prompt would appear at the ~11th character from the start of the
line, unable to go further back.

screen shot 2016-08-10 at 10 00 29 am

This was a result readline counting the terminal escape sequences we use
for color output as part of the line.

Wrapping these sequences in \001 and \002 instructs readline to ignore
them when doing calculations regarding line-length, resolving the
problem.

screen shot 2016-08-10 at 10 07 09 am

@stevendanna stevendanna added the Type: Bug Feature not working as expected label Aug 10, 2016
@chris-rock
Copy link
Contributor

Very nice addition @stevendanna +1

Previously, if you typed more than 20 characters at the prompt and
attempted pressed Ctrl+a (readline's "Move to start of line" command),
your prompt would appear at the ~11th character from the start of the
line, unable to go further back.

This was a result readline counting the terminal escape sequences we use
for color output as part of the line.

Wrapping these sequences in \001 and \002 instructs readline to ignore
them when doing calculations regarding line-length, resolving the
problem.
@chris-rock chris-rock merged commit c1e6478 into master Aug 10, 2016
@chris-rock chris-rock modified the milestone: 0.30.0 Aug 10, 2016
@stevendanna stevendanna deleted the ssd/shell-readline branch August 11, 2016 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Feature not working as expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants