VSCodeVim / VSCodeVim/Vim

`viw` results in wrong selection in whitespace at beginning of line

Open
#5,572 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

area/selection kind/bug
Dominant language
TypeScript
Stars
15.2k
Forks
1.5k
Avg merge
3d 18h
Merged PRs (30d)
6

Description

Scenario 1:

if x is None:
  | y = 0

viw should select all of whitespace before y, but not the newline or anything on the first line. Our current implementation selects up to and including the :.

Scenario 2:

  | y = 0

This is the first line in the file. Same as above, viw should select all the whitespace. Here our current implementation misses the first space.

(The above is also a problem with viW as well as with operators like diw/diW)

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

The issue does not name a file or test; start by locating the TypeScript handling for viw, viW, diw, and diW. Reproduce both whitespace-at-line-start scenarios, then verify that the selection includes all leading spaces, excludes the newline and previous-line text, and includes the first space on the file's first line.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.