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

Open
#59 0 comments 0 reactions 1 assignee View on GitHub

@MegatronKing is already working on this.

Since Jan 6, 2025.

Assessment

This issue has not been assessed yet.

Description

bug

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)));
}
Dominant language
Dart
Stars
761
Forks
102
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from reqable/re-editor

All issues in reqable/re-editor

Similar issues

More Dart issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.