G should not jump to end of file empty newline
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.2k
- Forks
- 1.5k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 6
Description
Not sure if this is a bug or feature request but it's not quite consistent with default vim behavior, so posting it as a bug.
When using the G motion the cursor jumps to the last line of the file, however this includes an empty new line. The question of whether to render the numbers for the newline has come up as an issue with VSCode and they've allowed an option to not show it, however this motion still jumps to that line:
https://user-images.githubusercontent.com/74646/132346500-9c43360c-4701-4fd5-8961-be8e32a7e651.mov
Compare this to default vim, where no second line is rendered or selectable.
Whether or not the line should be selectable at all is one question, however I suspect that this extension may not have control over this. Barring that, at least this text motion should not jump to the "last line" but instead technically one line before. This would make it consistent with default vim. At least this could perhaps be an option.
Seems like a small issue but Prettier always inserts this EOL for compatibility with *nix commands, which is not so easy (and probably not a good idea) to override. For example having a default export always at the last line would be difficult to jump to easily when using Prettier.
Workarounds would also be appreciated :)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the G motion in VSCodeVim with a file that ends in an empty newline, then trace the motion handling and compare it with default Vim. Done means G lands on the final non-empty line while preserving expected behavior for other files; add coverage for the trailing-newline case if the existing tests support it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100