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

Newline characters used as-is in the prompt #1865

Closed
lenormf opened this issue Feb 22, 2018 · 7 comments

Comments

Projects
None yet
2 participants
@lenormf
Copy link
Contributor

commented Feb 22, 2018

Steps

Open a new buffer:

  • *
  • / ctrl-r /

Outcome

The newline character appears in the prompt as .

Expected

That doesn't have an impact on the functionality, i.e. the pattern is still usable, but it would probably be more convenient if \n appeared instead.

@lenormf

This comment has been minimized.

Copy link
Contributor Author

commented Feb 22, 2018

I suppose having a function that converts non-printable characters into their escape form could be used in input_handler.cc.

@lenormf lenormf changed the title Newline characters used as-is in a few operations Newline characters used as-is in the prompt Feb 22, 2018

@mawww

This comment has been minimized.

Copy link
Owner

commented Feb 22, 2018

Displaying for newline characters in the command line is a voluntary behaviour, why do you think \n would be better ? We would then need to highlight it specially to show that its a single character, and not a \ followed by a n.

@lenormf

This comment has been minimized.

Copy link
Contributor Author

commented Feb 22, 2018

In prompts that accept a regex, it's visually more consistent as I almost never insert a raw newline or tab character when I want to match them. In other cases (like in a command prompt), the current behavior (WYSIWYG) is better.

@mawww

This comment has been minimized.

Copy link
Owner

commented Feb 22, 2018

Why would you write a literal newline in a regex prompt ?

@lenormf

This comment has been minimized.

Copy link
Contributor Author

commented Feb 22, 2018

Sometimes muscle memory trained in the shell kicks in and I use c-v. But when I paste a register (whose value was set from raw data) into a prompt that takes a regex as input, I find it more consistent to have everything encoded as escapes.

@mawww

This comment has been minimized.

Copy link
Owner

commented Feb 22, 2018

That seems like a very specific feature for a very specific corner case, I believe is good enough, and might make more sense as we can see that its a raw new line instead of the escape sequence (I think the regex engine will accept raw newlines).

@lenormf

This comment has been minimized.

Copy link
Contributor Author

commented Feb 22, 2018

Alright, closing!

@lenormf lenormf closed this Feb 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.