Skip to content

Conversation

@coxxny
Copy link

@coxxny coxxny commented Nov 1, 2025

What this PR does / why we need it:

Fixes a freeze when pressing . twice right after executing a command that is not dot-repeatable (e.g., :w, :q, :bn) at startup.

Expected

  • Pressing . after a non-repeatable command is a no-op (or repeats the last edit, if any)
  • No freeze or invalid state

Actual

  • Pressing . twice after :w leads to an unresponsive state

Root Cause

  1. After a non-dot-repeatable command at startup, lastCommandDotRepeatable=false and globalState.previousFullAction=undefined
  2. Later, lastCommandDotRepeatable is reset to true
  3. On the first ., CommandDot runs but adds no transformations because previousFullAction is undefined
  4. Because CommandDot.createsUndoPoint = true, an empty RecordedState is saved into previousFullAction
  5. On the second ., replaying this empty RecordedState via rerunRecordedState causes the invalid state/freeze

Which issue(s) this PR fixes

Fixes #9808

Special notes for your reviewer

Build & Test evidence

Build log (yarn build)
yarn run v1.22.22
$ gulp build
(node:57076) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
[10:58:34] Using gulpfile ~/document/repositories/Vim/gulpfile.js
[10:58:34] Starting 'build'...
[10:58:34] Starting 'webpack'...
[10:58:51] asset extension.js 954 KiB [emitted] [minimized] (name: main) 1 related asset
orphan modules 73.5 KiB [orphan] 15 modules
runtime modules 793 bytes 4 modules
cacheable modules 2.63 MiB
  modules by path ./src/ 1.39 MiB 162 modules
  modules by path ./node_modules/ 1.19 MiB 137 modules
  modules by path ./*.ts 27 KiB
    ./extension.ts 3.63 KiB [built] [code generated]
    ./extensionBase.ts 23.4 KiB [built] [code generated]
  ./package.json 32.7 KiB [built] [code generated]
+ 17 modules
webpack 5.102.0 compiled successfully in 15303 ms

asset extensionWeb.js 2.16 MiB [emitted] [minimized] (name: main) 1 related asset
runtime modules 344 bytes 2 modules
modules by path ./src/ 1.34 MiB 155 modules
modules by path ./node_modules/ 663 KiB
  ./node_modules/process/browser.js 5.29 KiB [built] [code generated]
  ./node_modules/parsimmon/build/parsimmon.umd.min.js 14.9 KiB [built] [code generated]
  ./node_modules/path-browserify/index.js 15.8 KiB [built] [code generated]
  ./node_modules/lodash/lodash.js 531 KiB [built] [code generated]
  ./node_modules/queue/index.js 4.03 KiB [built] [code generated]
  ./node_modules/untildify/index.js 331 bytes [built] [code generated]
  + 4 modules
modules by path ./*.ts 24 KiB
  ./extensionWeb.ts 682 bytes [built] [code generated]
  ./extensionBase.ts 23.4 KiB [built] [code generated]
external "vscode" 42 bytes [built] [code generated]
./package.json 32.7 KiB [built] [code generated]
webpack 5.102.0 compiled successfully in 8422 ms
[10:58:51] Finished 'webpack' after 16 s
[10:58:51] Starting 'commit-hash'...
[10:58:51] Finished 'commit-hash' after 11 ms
[10:58:51] Finished 'build' after 16 s
Done in 17.75s.
Test log (tail of npx gulp test)
    .
    .
    .
    ✔ b-
    ✔ b[num]
    ✔ b+[num]
    ✔ b-[num]
  3088 passing (2m)
  10 pending
[main 2025-11-01T02:02:37.500Z] Extension host with pid 222 exited with code: 0, signal: unknown.
Exit code:   0

behavior before this change

example1.txt.-.test.-.Visual.Studio.Code.2025-11-01.08-50-51.mp4

behavior after this change

example1.txt.-.test.-.Visual.Studio.Code.2025-11-01.11-55-21.mp4

@coxxny coxxny changed the title [Bug] Fix freeze when pressing . twice after a non-repeatable command in startup [Bug] Pressing . twice after an Ex command with no prior edit state causes a freeze Nov 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Pressing . twice after an Ex command with no prior edit state freezes extention

1 participant