-
Notifications
You must be signed in to change notification settings - Fork 182
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
Always use rectangular prompt for multi-line input #338
Conversation
This commit changes multi-line input suport in the following way: * If there is no highlighter, the prompt is used in the first line and next lines are prepended by amount of spaces equal to the first line prompt * If highlighter is used, the original prompt is passed for every line to the highlighter, and highlighter is free to change color or characters of othe prompt as long as it's length is the same (usual contract for the highlighter) Internally this changes `layout` object to contain cursor position without prompt size (this should make it easier to allow non-rectangular prompts in future). This mostly fixes kkawakam#311
We should be able to keep the current behaviour (no continuation prompt, no space alignment). |
Is there are good use cases for that? Or is this just for backwards compatibility? I can do that, just not sure if it worth the complexity. In particular, how to configure that?
Another question is how cursor should work? In the master, LineUp behaves as if prompt is rectangular (i.e. it keeps cursor column relative to the text, regardless of the length of the prompt). |
As a readline alternative, we should try to keep a similar behaviour when possible.
I guess that |
Okay.
Yes, as far as I understand for now. It will change if/when we have rectangular selection.
Yes. Vim has two different commands to handle wrapped lines Perhaps, it's fine to keep cursor movement as the current master, and recommend using continuation prompt in case multi-line statements are frequent enough and where column structure matters (i.e. where input is something properly indented or a table). Will update PR with |
I am sorry to not be more helpful right now. |
Done. Let me know if anything else needs to be changed. |
Thanks. |
Currently, assertions are completly buggy because of regression introduced by kkawakam#338.
Revert "Merge pull request #338 from tailhook/prompt"
This is a reimplementation of kkawakam#338 which was reverted. When `Highligher::has_continuation_prompt` returns true, rustyline enables a special mode that passes the original prompt for every line to the highlighter, and highlighter is free to change color or characters of the prompt as long as it's length is the same (usual contract for the highlighter) Note: 1. Wrapped lines are not prefixed by prompt (this may be fixed in future releases either by prepending them, or by collapsing and scrolling lines wider than terminal). 2. Unlike kkawakam#338 this PR doesn't change the meaning of `cursor` and `end` fields of the `Layout` structure.
This is a reimplementation of kkawakam#338 which was reverted. When `Highligher::has_continuation_prompt` returns true, rustyline enables a special mode that passes the original prompt for every line to the highlighter, and highlighter is free to change color or characters of the prompt as long as it's length is the same (usual contract for the highlighter) Note: 1. Wrapped lines are not prefixed by prompt (this may be fixed in future releases either by prepending them, or by collapsing and scrolling lines wider than terminal). 2. Unlike kkawakam#338 this PR doesn't change the meaning of `cursor` and `end` fields of the `Layout` structure.
This is a reimplementation of kkawakam#338 which was reverted. When `Highligher::has_continuation_prompt` returns true, rustyline enables a special mode that passes the original prompt for every line to the highlighter, and highlighter is free to change color or characters of the prompt as long as it's length is the same (usual contract for the highlighter) Note: 1. Wrapped lines are not prefixed by prompt (this may be fixed in future releases either by prepending them, or by collapsing and scrolling lines wider than terminal). 2. Unlike kkawakam#338 this PR doesn't change the meaning of `cursor` and `end` fields of the `Layout` structure.
This is a reimplementation of kkawakam#338 which was reverted. When `Highligher::has_continuation_prompt` returns true, rustyline enables a special mode that passes the original prompt for every line to the highlighter, and highlighter is free to change color or characters of the prompt as long as it's length is the same (usual contract for the highlighter) Note: 1. Wrapped lines are not prefixed by prompt (this may be fixed in future releases either by prepending them, or by collapsing and scrolling lines wider than terminal). 2. Unlike kkawakam#338 this PR doesn't change the meaning of `cursor` and `end` fields of the `Layout` structure.
This is a reimplementation of kkawakam#338 which was reverted. When `Highligher::has_continuation_prompt` returns true, rustyline enables a special mode that passes the original prompt for every line to the highlighter, and highlighter is free to change color or characters of the prompt as long as it's length is the same (usual contract for the highlighter) Note: 1. Wrapped lines are not prefixed by prompt (this may be fixed in future releases either by prepending them, or by collapsing and scrolling lines wider than terminal). 2. Unlike kkawakam#338 this PR doesn't change the meaning of `cursor` and `end` fields of the `Layout` structure.
This is a reimplementation of kkawakam#338 which was reverted. When `Highligher::has_continuation_prompt` returns true, rustyline enables a special mode that passes the original prompt for every line to the highlighter, and highlighter is free to change color or characters of the prompt as long as it's length is the same (usual contract for the highlighter) Note: 1. Wrapped lines are not prefixed by prompt (this may be fixed in future releases either by prepending them, or by collapsing and scrolling lines wider than terminal). 2. Unlike kkawakam#338 this PR doesn't change the meaning of `cursor` and `end` fields of the `Layout` structure.
This is a reimplementation of kkawakam#338 which was reverted. When `Highligher::has_continuation_prompt` returns true, rustyline enables a special mode that passes the original prompt for every line to the highlighter, and highlighter is free to change color or characters of the prompt as long as it's length is the same (usual contract for the highlighter) Note: 1. Wrapped lines are not prefixed by prompt (this may be fixed in future releases either by prepending them, or by collapsing and scrolling lines wider than terminal). 2. Unlike kkawakam#338 this PR doesn't change the meaning of `cursor` and `end` fields of the `Layout` structure.
This is a reimplementation of kkawakam#338 which was reverted. When `Highligher::has_continuation_prompt` returns true, rustyline enables a special mode that passes the original prompt for every line to the highlighter, and highlighter is free to change color or characters of the prompt as long as it's length is the same (usual contract for the highlighter) Note: 1. Wrapped lines are not prefixed by prompt (this may be fixed in future releases either by prepending them, or by collapsing and scrolling lines wider than terminal). 2. Unlike kkawakam#338 this PR doesn't change the meaning of `cursor` and `end` fields of the `Layout` structure.
This is a reimplementation of kkawakam#338 which was reverted. When `Highligher::has_continuation_prompt` returns true, rustyline enables a special mode that passes the original prompt for every line to the highlighter, and highlighter is free to change color or characters of the prompt as long as it's length is the same (usual contract for the highlighter) Note: 1. Wrapped lines are not prefixed by prompt (this may be fixed in future releases either by prepending them, or by collapsing and scrolling lines wider than terminal). 2. Unlike kkawakam#338 this PR doesn't change the meaning of `cursor` and `end` fields of the `Layout` structure.
This commit changes multi-line input support in the following way:
next lines are prepended by amount of spaces equal to the first line
prompt
to the highlighter, and highlighter is free to change color or
characters of the prompt as long as its length is the same (usual
contract for the highlighter)
Internally this changes
layout
object to contain cursor positionwithout prompt size (this should make it easier to allow non-rectangular
prompts in future).
This mostly fixes #311
I've only implemented this thing for unix terminal. I'll take a look on windows support if this general approach is fine.