Skip to content

Add multicursor autocompletions - #4028

Open
redsti-github wants to merge 1 commit into
micro-editor:masterfrom
redsti-github:feature/multicursor-autocomplete
Open

Add multicursor autocompletions#4028
redsti-github wants to merge 1 commit into
micro-editor:masterfrom
redsti-github:feature/multicursor-autocomplete

Conversation

@redsti-github

@redsti-github redsti-github commented Mar 1, 2026

Copy link
Copy Markdown

Implements autocomplete while using multiple cursors. (loosely based on #3442)

Only autocompletes cursors which end in the same word as the active cursor.

For example:

foo bar
f|     -> foo|
f|     -> foo|
b|     -> b|
f|b    -> f|b

Closes #3442

@JoeKar

JoeKar commented Mar 1, 2026

Copy link
Copy Markdown
Member

But we already have #3442 and this use case is discussed within it?!
I don't see any reason to duplicate the PR.

@redsti-github

Copy link
Copy Markdown
Author

Yes, but #3442 still autocompletes on all cursors, even if they shouldn't be.
I created this PR because as far as i know, i can't add or suggest commits to someone else's PR. (Atleast not without opening a PR to the author's repo, or commenting a diff, both of which feel impractical to me.)

Comment thread internal/buffer/autocomplete.go Outdated
@Neko-Box-Coder

Copy link
Copy Markdown
Contributor

Tested the changes, works well as expected. Nice one.

Comment thread internal/buffer/autocomplete.go Outdated
@Neko-Box-Coder

Neko-Box-Coder commented Mar 21, 2026

Copy link
Copy Markdown
Contributor

Hey @redsti-github , I want to merge this to my own fork.

Could you tidy up the commits please?
i.e. "fix plugin support" and "remove trailing whitespace" should be in "Autocomplete support for multiple cursors" instead of having their own commits.

Thanks.

@redsti-github
redsti-github force-pushed the feature/multicursor-autocomplete branch from 325e85c to 5c71c2e Compare March 24, 2026 11:35
@Neko-Box-Coder

Copy link
Copy Markdown
Contributor

I have tested this on my own fork for quite awhile and I haven't encountered any issues. Maybe we can merge this @JoeKar @dmaluka ?

Comment thread internal/buffer/autocomplete.go Outdated
Comment thread internal/buffer/autocomplete.go Outdated
Comment thread internal/buffer/autocomplete.go Outdated
Comment thread internal/buffer/autocomplete.go Outdated
@redsti-github
redsti-github force-pushed the feature/multicursor-autocomplete branch from 5c71c2e to 5b66d78 Compare August 22, 2026 10:26
}

c := b.GetActiveCursor()
// cycle autocomplete for all except active cursors

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is not true anymore?

c := b.GetActiveCursor()
// cycle autocomplete for all except active cursors
activeWord, _ := b.GetWord()
activeWord = bytes.Clone(activeWord)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently bytes.Clone() was added in Go 1.20, while micro claims to support 1.19.

Maybe we should just bump the minimum required version to 1.20? @JoeKar WDYT?

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.

4 participants