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

Action lineMoveDown will jump to arbitrary position in the attempt to make the cursor visible #59

Open
TomKrauss opened this issue Jan 6, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@TomKrauss
Copy link

Pressing key down and reaching the end of the page will not scroll by one line, but by an arbitrary amount of lines in the attempt to make the caret visible on the screen.

Expected behavior
I would expect the screen in this case to scroll by one line - same behavior as if I scroll up, which will also always scroll the screen by one line, when we reach the top of the screen.

Device:

  • all platforms

Additional context
This behavior is caused by method _CodeField.makePositionVisible line 550. In my opinion this line should be corrected from:

Current code:

if (position.index > last.index) {
    _verticalViewport.jumpTo(max(0, last.bottom - size.height + _preferredLineHeight * (position.index - first.index)));
}

Correct code (replace first.index by last.index):

if (position.index > last.index) {
    _verticalViewport.jumpTo(max(0, last.bottom - size.height + _preferredLineHeight * (position.index - last.index)));
}
@TomKrauss TomKrauss added the bug Something isn't working label Jan 6, 2025
TomKrauss added a commit to TomKrauss/re-editor that referenced this issue Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants