Skip to content

Commit

Permalink
Add cursorStyle when entering/exiting vim mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Brijesh Bittu committed Dec 8, 2024
1 parent 3c9ae24 commit 9a859c1
Show file tree
Hide file tree
Showing 5 changed files with 5,871 additions and 4,205 deletions.
Binary file added .yarn/install-state.gz
Binary file not shown.
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "monaco-vim",
"version": "0.4.1",
"version": "0.4.2",
"description": "Vim keybindings for monaco-editor",
"main": "./lib/index.js",
"scripts": {
Expand Down Expand Up @@ -46,5 +46,6 @@
},
"peerDependencies": {
"monaco-editor": "*"
}
},
"packageManager": "[email protected]+sha512.3003a14012e2987072d244c720506549c1aab73ee728208f1b2580a9fd67b92d61ba6b08fe93f6dce68fd771e3af1e59a0afa28dd242dd0940d73b95fedd4e90"
}
24 changes: 13 additions & 11 deletions src/cm_adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ class CMAdapter {
this.disposables.push(
this.editor.onDidChangeCursorPosition(this.handleCursorChange),
this.editor.onDidChangeModelContent(this.handleChange),
this.editor.onKeyDown(this.handleKeyDown)
this.editor.onKeyDown(this.handleKeyDown),
);
}

Expand Down Expand Up @@ -417,7 +417,7 @@ class CMAdapter {
pos.lineNumber,
pos.column,
pos.lineNumber,
pos.column + 1
pos.column + 1,
);
let forceMoveMarkers = true;

Expand All @@ -438,7 +438,7 @@ class CMAdapter {
pos.lineNumber,
pos.column,
pos.lineNumber,
pos.column - 1
pos.column - 1,
);
} else {
return;
Expand Down Expand Up @@ -875,6 +875,7 @@ class CMAdapter {
this.editor.updateOptions({
cursorWidth: config.fontInfo.typicalFullwidthCharacterWidth,
cursorBlinking: "solid",
cursorStyle: "block",
});
}

Expand All @@ -884,6 +885,7 @@ class CMAdapter {
this.editor.updateOptions({
cursorWidth: this.initialCursorWidth || 0,
cursorBlinking: "blink",
cursorStyle: "line",
});
}

Expand Down Expand Up @@ -1042,7 +1044,7 @@ class CMAdapter {
lastSearch = match.range;
context.highlightRanges([lastSearch], "currentFindMatch");
context.highlightRanges(
matches.map((m) => m.range).filter((r) => !r.equalsRange(lastSearch))
matches.map((m) => m.range).filter((r) => !r.equalsRange(lastSearch)),
);

return lastSearch;
Expand All @@ -1064,7 +1066,7 @@ class CMAdapter {
} else {
const pos = lastSearch
? model.getPositionAt(
model.getOffsetAt(lastSearch.getEndPosition()) + 1
model.getOffsetAt(lastSearch.getEndPosition()) + 1,
)
: monacoPos;
match = model.findNextMatch(query, pos, isRegex, matchCase);
Expand All @@ -1076,7 +1078,7 @@ class CMAdapter {
lastSearch = match.range;
context.highlightRanges([lastSearch], "currentFindMatch");
context.highlightRanges(
matches.map((m) => m.range).filter((r) => !r.equalsRange(lastSearch))
matches.map((m) => m.range).filter((r) => !r.equalsRange(lastSearch)),
);

return lastSearch;
Expand All @@ -1101,7 +1103,7 @@ class CMAdapter {
function (edits) {
const { endLineNumber, endColumn } = edits[0].range;
lastSearch = lastSearch.setEndPosition(endLineNumber, endColumn);
}
},
);
editor.setPosition(lastSearch.getStartPosition());
}
Expand All @@ -1122,7 +1124,7 @@ class CMAdapter {
className,
showIfCollapsed: true,
},
}))
})),
);

return this[decorationKey];
Expand Down Expand Up @@ -1193,7 +1195,7 @@ class CMAdapter {
true,
true,
null,
true
true,
);
const thisBracket = match.matches[0];

Expand All @@ -1216,7 +1218,7 @@ class CMAdapter {
}

mPos = model.getPositionAt(
model.getOffsetAt(match.range.getStartPosition()) + dir
model.getOffsetAt(match.range.getStartPosition()) + dir,
);
iterations += 1;
}
Expand Down Expand Up @@ -1251,7 +1253,7 @@ class CMAdapter {
insertSpaces: cursorConfig.insertSpaces,
useTabStops: cursorConfig.useTabStops,
autoIndent: cursorConfig.autoIndent,
})
}),
);
}

Expand Down
Loading

0 comments on commit 9a859c1

Please sign in to comment.