VSCodeVim / VSCodeVim/Vim

I have overloaded cursorStartPosition to be too many different things.

Open
#805 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted kind/refactor size/L
Dominant language
TypeScript
Stars
15.2k
Forks
1.5k
Avg merge
3d 18h
Merged PRs (30d)
6

Description

Currently cursorStartPosition and cursorPosition can mean both "the start and end of the current selection" and "the range over which to apply an operator".

These are actually totally different! It's especially bad when you apply an operator and then suddenly you lose the tracked position of the cursor.

Move "the range over which to apply an operator" into a new field on RecordedState and use that instead of cursorStartPosition and cursorPosition. Continue using cursorStartPosition and cursorPosition for selections and cursor locations.

My current problem is running ci( on |(abcd), which promptly forgets the position of the cursor and can't (because of the overloading) figure out where to place it.

Contributor guide

Open the contributing guide

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.

Research direction

Start by locating RecordedState and the code that reads or updates cursorStartPosition and cursorPosition during operator application. Trace the ci( flow and separate the operator range from selection and cursor location state. Done means operator ranges use the new RecordedState field while selections and cursor placement remain tracked correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
developer-experience, tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.