Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Programmatically set multiple cursors #22

squarewave17 started this conversation in General
Discussion options

Hello! I'm trying to set a cursor at the beginning of each line, like you would with alt + click. There doesn't seem to be a way to do it with setCursor(). Does anyone know of a way to do this?

You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

You can try the following methods:

for (let i = 1, len = editor?.lineCount(); i < len; i++) {
 editor.addSelection({ line: i, ch: 0 });
}
editor.focus();
You must be logged in to vote
1 reply
Comment options

That worked perfectly! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /