VSCodeVim / VSCodeVim/Vim

CTRL+D and CTRL+U doesn't work if cursor at the top of the document and imports are folded

Open
#8,277 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

As title says. But if I navigate down with SHIFT+} and use CTRL+D or CTRL+U it starts to work, if I go back at the top of the document it doesn't work again. This happens only if imports are folded.

Here are the logs:

Trying to use CTRL+U or CTRL+D, does nothing:

2023-03-02 20:42:17.443 [debug] Handling key: <C-u>
2023-03-02 20:42:17.443 [trace] trying to find matching remap. keys=<C-u>. mode=Normal. keybindings=normalModeKeyBindingsMap.
2023-03-02 20:42:17.443 [trace] key=<C-u>. keySlice=<C-u>.
2023-03-02 20:42:17.445 [trace] Adding selection change to be ignored! (total: 1) Hash: [70, 8; 70, 8], Selections: [70, 8], [70, 8]
2023-03-02 20:42:17.445 [trace] handleKeyEvent('<C-u>') took 2ms
2023-03-02 20:42:17.454 [trace] Ignoring selection: [70, 8; 70, 8]. 0 left
2023-03-02 20:42:22.458 [debug] Handling key: <C-d>
2023-03-02 20:42:22.458 [trace] trying to find matching remap. keys=<C-d>. mode=Normal. keybindings=normalModeKeyBindingsMap.
2023-03-02 20:42:22.458 [trace] key=<C-d>. keySlice=<C-d>.
2023-03-02 20:42:22.460 [trace] handleKeyEvent('<C-d>') took 2ms

Use SHIFT+}:

2023-03-02 20:43:38.069 [debug] Handling key: }
2023-03-02 20:43:38.069 [trace] trying to find matching remap. keys=}. mode=Normal. keybindings=normalModeKeyBindingsMap.
2023-03-02 20:43:38.069 [trace] key=}. keySlice=}.
2023-03-02 20:43:38.071 [trace] Adding selection change to be ignored! (total: 1) Hash: [332, 0; 332, 0], Selections: [332, 0], [332, 0]
2023-03-02 20:43:38.071 [trace] handleKeyEvent('}') took 2ms
2023-03-02 20:43:38.075 [trace] Ignoring selection: [332, 0; 332, 0]. 0 left

Use CTRL+U after using SHIFT+}:

2023-03-02 20:44:04.429 [debug] Handling key: <C-u>
2023-03-02 20:44:04.429 [trace] trying to find matching remap. keys=<C-u>. mode=Normal. keybindings=normalModeKeyBindingsMap.
2023-03-02 20:44:04.429 [trace] key=<C-u>. keySlice=<C-u>.
2023-03-02 20:44:04.432 [trace] Adding selection change to be ignored! (total: 1) Hash: [314, 8; 314, 8], Selections: [314, 8], [314, 8]
2023-03-02 20:44:04.432 [trace] handleKeyEvent('<C-u>') took 3ms
2023-03-02 20:44:04.434 [trace] Ignoring selection: [314, 8; 314, 8]. 0 left

It can be reproduced in .ts file and especially large one with a lot of imports (I have 54). And it happens only if these imports are folded. If I unfold imports it works as expected.

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

Reproduce the issue in a large .ts file with many imports folded, checking CTRL+D and CTRL+U at the top before and after moving with SHIFT+}. Use the logs to compare key handling and selection changes; done means both commands work at the top of the document while imports remain folded.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
tooling
Issue type
Bug
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.