fix: hide editor cursor during command-line mode#10028
Open
nikhiltelkar2005-glitch wants to merge 1 commit into
Open
fix: hide editor cursor during command-line mode#10028nikhiltelkar2005-glitch wants to merge 1 commit into
nikhiltelkar2005-glitch wants to merge 1 commit into
Conversation
Resolves VSCodeVim#2436 by mapping command-line modes to a new Hidden cursor type (BlockOutline), preventing the cursor from blinking in the editor while typing in the status bar.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Resolves #2436.
Currently, when a user enters command-line mode (
:), search mode (/), or reverse search mode (?), the cursor remains visibly blinking in the active editor. Because Vim is terminal-based, the cursor is supposed to jump to the bottom status line and disappear from the main editor entirely to prevent confusion.Since the VS Code extension API does not natively support completely hiding the cursor (
TextEditorCursorStyle.Hiddendoes not exist), this PR approximates the native Vim behavior by mapping these modes toBlockOutline.This effectively turns the cursor into a static, hollow box that represents a defocused/inactive state, which eliminates the distracting blinking cursor while typing in the status bar command-line.
Changes Made
src/mode/mode.ts: Introduced a newVSCodeVimCursorType.Hiddencursor type enum and mapped it to usevscode.TextEditorCursorStyle.BlockOutline.src/mode/modeHandler.ts: UpdatedgetCursorType()so thatSearchInProgressModeandCommandlineInProgressnow return the newHiddencursor type instead ofUnderlineThin.test/index.ts: Updated theglobimport and usage to conform toglobv10's Promise API to fix local test runner build errors.Testing
yarn build-devsucceeds.:,/, and?modes to ensure the active cursor stops blinking and transforms into theBlockOutlinestyle until the mode is exited.