Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to support IdeaVim 2.13 #5

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/main/kotlin/com/github/dankinsoid/multicursor/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import com.maddyhome.idea.vim.command.MappingMode
import com.maddyhome.idea.vim.extension.VimExtension
import com.maddyhome.idea.vim.extension.VimExtensionFacade
import com.maddyhome.idea.vim.extension.VimExtensionHandler
import com.maddyhome.idea.vim.helper.StringHelper

/**
* Map some <Plug>(keys) command to given handler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.colors.EditorColors
import com.intellij.openapi.editor.markup.*
import com.intellij.openapi.util.Disposer
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.extension.VimExtension
import com.maddyhome.idea.vim.extension.VimExtensionFacade
import com.maddyhome.idea.vim.extension.VimExtensionHandler
import com.maddyhome.idea.vim.newapi.vim
import com.maddyhome.idea.vim.ui.ModalEntry
import com.maddyhome.idea.vim.ui.ex.ExEntryPanel
import java.awt.Font
import java.awt.event.KeyEvent
import javax.swing.KeyStroke
Expand Down Expand Up @@ -44,24 +44,23 @@ class VimMulticursor : VimExtension {
private val select: Boolean = false
) : VimExtensionHandler {
override fun execute(editor: Editor, context: DataContext) {
val panel = ExEntryPanel.getInstanceWithoutShortcuts()
panel.activate(editor, context, " ", "", 1)
val panel = injector.commandLine.createWithoutShortcuts(editor.vim, context.vim, " ", "")
ModalEntry.activate(editor.vim) { key: KeyStroke ->
return@activate when (key.keyCode) {
KeyEvent.VK_ESCAPE -> {
panel.deactivate(true)
panel.deactivate(refocusOwningEditor = true, resetCaret = true)
highlightHandler.clearAllMulticursorHighlighters(editor)
false
}
KeyEvent.VK_ENTER -> {
highlightHandler.clearAllMulticursorHighlighters(editor)
panel.deactivate(false)
select(editor, panel.text, select)
panel.deactivate(refocusOwningEditor = false, resetCaret = true)
select(editor, panel.actualText, select)
false
}
else -> {
panel.handleKey(key)
highlightHandler.highlightMulticursorRange(editor, ranges(panel.text, editor))
highlightHandler.highlightMulticursorRange(editor, ranges(panel.actualText, editor))
true
}
}
Expand Down
Loading