mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-05-28 00:34:02 +02:00
Add write action in several places
This commit is contained in:
parent
c9189ed7cb
commit
42d80f6866
src/main/java/com/maddyhome/idea/vim/extension/exchange
vim-engine/src/main/kotlin/com/maddyhome/idea/vim/put
@ -8,7 +8,6 @@
|
||||
|
||||
package com.maddyhome.idea.vim.extension.exchange
|
||||
|
||||
import com.intellij.openapi.application.runWriteAction
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.editor.LogicalPosition
|
||||
import com.intellij.openapi.editor.colors.EditorColors
|
||||
@ -111,14 +110,12 @@ internal class VimExchangeExtension : VimExtension {
|
||||
|
||||
private class VExchangeHandler : ExtensionHandler {
|
||||
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
|
||||
runWriteAction {
|
||||
val mode = editor.mode
|
||||
// Leave visual mode to create selection marks
|
||||
executeNormalWithoutMapping(injector.parser.parseKeys("<Esc>"), editor.ij)
|
||||
Operator(true).apply(editor, context, mode.selectionType ?: SelectionType.CHARACTER_WISE)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class Operator(private val isVisual: Boolean = false) : OperatorFunction {
|
||||
fun Editor.getMarkOffset(mark: Mark) = IjVimEditor(this).getOffset(mark.line, mark.col)
|
||||
@ -226,7 +223,7 @@ internal class VimExchangeExtension : VimExtension {
|
||||
val unnRegText = getRegister(editor.vim, '"')
|
||||
val startRegText = getRegister(editor.vim, '*')
|
||||
val plusRegText = getRegister(editor.vim, '+')
|
||||
runWriteAction {
|
||||
|
||||
// TODO handle:
|
||||
// " Compare using =~ because "'==' != 0" returns 0
|
||||
// let indent = s:get_setting('exchange_indent', 1) !~ 0 && a:x.type ==# 'V' && a:y.type ==# 'V'
|
||||
@ -243,7 +240,6 @@ internal class VimExchangeExtension : VimExtension {
|
||||
setRegister('*', startRegText)
|
||||
setRegister('+', plusRegText)
|
||||
}
|
||||
}
|
||||
|
||||
private fun compareExchanges(x: Exchange, y: Exchange): ExchangeCompareResult {
|
||||
fun intersects(x: Exchange, y: Exchange) =
|
||||
|
@ -580,10 +580,8 @@ abstract class VimPutBase : VimPut {
|
||||
logger.debug("Perform put via plugin")
|
||||
val myCarets = visualSelection?.caretsAndSelections?.keys?.sortedByDescending { it.getBufferPosition() }
|
||||
?: editor.sortedNativeCarets().reversed()
|
||||
injector.application.runWriteAction {
|
||||
myCarets.forEach { caret -> putForCaret(editor, caret, data, additionalData, context, text) }
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
val logger: VimLogger by lazy { vimLogger<VimPutBase>() }
|
||||
|
Loading…
Reference in New Issue
Block a user