-
Notifications
You must be signed in to change notification settings - Fork 185
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
Vertical scroll #378
base: master
Are you sure you want to change the base?
Vertical scroll #378
Conversation
|
I don't have too. Since windows 7 end of life has been reached on 14 January 2020, should we still be concerned about it? (and since the issue here is relatively minor). There are threads on tab size that predate windows 10, so it probably works anyway.
We are always in |
I mean |
|
Also note: #396 In the case terminal size is uninitialized, when we force inserting newlines we will get nicely formatted 80 chars column (assuming real terminal is >= 80). Otherwise the output will be a little bit messy. |
But we will wrap uselessly, no ? |
No, in case we wrap, we'll get something like:
In case we don't wrap, rustyline will think the cursor is there on the second line, while the actual picture is this:
So on every refresh rustyline would clean two lines and so input will gradually move towards the top of the screen. By the way, this also help in testing. As I've recently discovered, you can excute |
Maybe we should remember that the size cannot be trusted and wrap manually only in this case ? |
Yes. But this sounds like another branch (e.g. |
Code is simpler if we don't perform wrapping when terminal already handles it. |
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.
Previously the differences where: 1. Escape codes were skipped on windows 2. Tab stops weren't accounted on windows Actually windows supports both tab stops and escape codes (windows >= 10) so there is no good reason to keep the code different.
f281ca2
to
7a7355f
Compare
Note to myself: have to retest it on windows after rebase. |
This PR implements vertical scroll in case input doesn't fit the screen.
This is based on top of #372 (so I'll rebase this PR when that one is ready).
This PR also includes d84c034 which unifies row/column measuring on unix and windows (because we use escape codes for colorful text on windows, and tab stops also work on windows, so it's basically the same)
The last commit also unifies what previously was "wrap_at_eol" thing. As it's not harmful to insert newlines after last column on unix terminals too. And it looks like it makes code and testing simpler.
This PR is tested on linux and windows.