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

Remove left margin when scrolling #197

Closed
makew0rld opened this issue Feb 17, 2021 · 9 comments
Closed

Remove left margin when scrolling #197

makew0rld opened this issue Feb 17, 2021 · 9 comments
Assignees
Labels
enhancement New feature or request question Further information is requested UI Deals with the visual user interface
Milestone

Comments

@makew0rld
Copy link
Owner

Due to the change in 90654cd (as a part of #107, to fix #26) the left margin on pages was made into a UI element. That means that when scrolling to the right, for long pre-formatted lines, they appear to "disappear" under the left margin. This is an undesirable effect.

One solution would be to change the size of the margin when scrolling, and eventually remove it once its width becomes <= 0. Another possible solution would be to find a way to keep the left margin "underneath" the text.

@makew0rld makew0rld added enhancement New feature or request help wanted Extra attention is needed question Further information is requested UI Deals with the visual user interface labels Feb 17, 2021
@makew0rld makew0rld added this to the v1.9.0 milestone Feb 17, 2021
@makew0rld
Copy link
Owner Author

cc @objectliteral for originally bringing this up

@makew0rld
Copy link
Owner Author

This can probably be done by using SetInputCapture on the TextView, and changing the margin size if scroll keys are being used. That would be left and right arrow, as well as h and l.

@makew0rld
Copy link
Owner Author

This is almost done, and the work is on the issue-197 branch. cview will need to be modified to continue. I will make the modifications and switch to using my fork, and then make a PR for it.

@makew0rld makew0rld self-assigned this Feb 27, 2021
@makew0rld
Copy link
Owner Author

Branch has been merged, this issue is fixed! I opened this upstream PR.

@makew0rld
Copy link
Owner Author

This is still broken. If you go to gemini://makeworld.space/test/wrapping-test.gmi and scroll to the bottom, then start scrolling to the right, it will jump back up to the longest line.

@makew0rld makew0rld reopened this Apr 2, 2021
@makew0rld makew0rld removed the help wanted Extra attention is needed label Apr 2, 2021
makew0rld added a commit to singalhimanshu/amfora that referenced this issue Apr 22, 2021
@makew0rld
Copy link
Owner Author

Also: will pageUp and pageDown affect this?

@makew0rld
Copy link
Owner Author

Alright so scrolling to the bottom with arrow keys was fine, because that's captured. It's scrolling with PgUp or PgDown, or non-capture keys like g and G that was the issue. Now all those keys are captured, and so the internal scroll position is maintained no matter what key is used.

This was fixed in ed36eee.

@makew0rld
Copy link
Owner Author

makew0rld commented Jun 27, 2021

ScrollToHighlight is called for link navigation, and will be called for search (#240). This can mess up the custom scroll logic a lot. A workaround is needed.

Maybe a func like (t *tab) scrollTo(row, col int) that would set t.page.Column and t.page.Row, but make sure they don't exceed the max values. Then call t.applyScroll() and App.Draw().

Then (t *tab) ScrollToHighlight func that would call scroll to highlight, get the scroll position but compensate for the current left margin size, then use scrollTo to actually change it.

@makew0rld
Copy link
Owner Author

Fixed by 6ec7ed1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested UI Deals with the visual user interface
Projects
None yet
Development

No branches or pull requests

1 participant