-
Notifications
You must be signed in to change notification settings - Fork 178
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
Keep track of layout of input buffer spans #820
base: master
Are you sure you want to change the base?
Conversation
Sorry, I may have missed something but I don't see:
So you need to recompute almost everything. |
The
Is this what you are asking about? |
Without the
|
Well, this call is only needed for getting positions within a span. If one wants to know where does a line start, no |
In any case, this PR solves a part of the problem you are describing and is useful in its own. |
Also, where would this |
When you move up or down like you already know, for scrolling vertically (when screen height < number of rows) (not supported currently), to repaint only edited / impacted line(s) (not supported currently), ... https://github.com/gwenn/rustyline-notes/blob/master/src/layout.md |
See also https://github.com/daanx/isocline/blob/c9310ae58941559d761fe5d2dd2713d245f18da6/src/stringbuf.h#L88-L93 |
What's the status of this PR now? Can it be merged? I do believe it has merit of its own, even though it does not implement layout caching or selective refresh. |
If you don't mind, I would prefer this simple patch: #822 |
Ok, but then I must also add a |
For |
I don't think we do.
What am I looking for?
This PR adds this mapping! It contains enough information to not make any calls to |
Ok, so you think that we can support continuation prompt without fixing highlighting.
This line
How are you going to invalidate / refresh the cache ? |
Another issue: soft-wrap for input text longer that screen width. |
Builds on top of https://github.com/gwenn/rustyline/pull/2/files
When moving cursor up or down a line, it should not change columns. To be precise, it should not change columns on the screen.
Current implementation was making sure it was not changing number of graphemes from the beginning of the line. This works correctly, as long as prompt is empty. If it so not empty, the cursor moves up and down like this:
This PR changes this behavior to this:
This change is also needed for continuation prompts.
To make this happen, I had to:
Renderer::compute_layout
intoLayout::compute
,LineBuffer::move_to_line
to takeLayout
as a parameter,State::move_cursor
.