feat(viewport): horizontal scroll#240
Conversation
|
Thanks for the PR! One immediate things is jumping out here:
So, in short, keep in mind that horizontal scrolling will need to handle double-width runes. Here’s a more in-depth example that breaks it down further: |
It's a good point. I guess I have to use |
|
Waiting for this PR merge and tagging. |
|
Don't merge it yet, please. |
|
Done! |
|
Thanks, @tty2. Before we get to this, do you mind adding some tests with double-width runes? That is going to be the number one thing we'll want to verify. In particular, cases where there's a mix of single and double width runes. |
|
These tests I've written inside |
|
@meowgorithm |
|
Hi, @meowgorithm |
|
Hey, @tty2! Thanks for all your work on this so far. It's going to be a little bit of time until we can give this a proper review, but I promise we'll get to it. |
|
It would be great to have this feature as well. |
caarlos0
left a comment
There was a problem hiding this comment.
i think the only issue here is the truncation using rune width, ansi.Truncate should be a quick fix though!
viewport/viewport.go
Outdated
| if m.indent > 0 { | ||
| cutLines := make([]string, len(lines)) | ||
| for i := range lines { | ||
| cutLines[i] = runewidth.TruncateLeft(lines[i], m.indent, "") |
There was a problem hiding this comment.
should probably use ansi.Truncate so it doesn't trim escape codes as well...
There was a problem hiding this comment.
Created a patch that does that and renames indent to XOffset to match YOffset
ba37376 to
143ea43
Compare
|
@Caden64 |
…ntal-scroll Feature/i236 viewport horizontal scroll
|
thanks @tty2! I'll look into glamour and what's needed there, just to make sure we're not missing anything here. :) |
|
|
Hi @caarlos0 |
|
this change is not breaking the other models in the lib, for instance table, i guess. a proper keymap and update implements are required to do this feature for them and this could be in another PR |
|
cannot wait this til next two years 😇 @meowgorithm @bashbunni are you mind to check this? |
|
I hear you @flavono123. We're all on holiday through the new year but we'll pick this up after then. We've done an initial review internally, made some changes, and we intend to merge this. |
|
thanks got it. have a holy holiday |
|
Alright, so I pushed a few changes to make the horizontal scroll API better match the rest of the API. I think this is ready to go (the implementation is really good) although I'd love to figure out why it's breaking table tests first. |
|
Will take a look later |
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
|
Thanks for the PR, @tty2, and for the discourse, @flavono123. This was a long time coming. We expect to release this soon. |
|
Hi Guys, thank you all by all the amazing work btw! |
|
@rdalbuquerque Yep, absolutely. We regularly merge new stuff on |




implement #235