mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-02-26 14:46:00 +01:00
Revert "Fix code in execute requiring EDT or write actions"
This reverts commit e7236beedd
.
This commit is contained in:
parent
5aea4cdd65
commit
f1b90857ff
src/main/java/com/maddyhome/idea/vim/vimscript
vim-engine/src/main/kotlin/com/maddyhome/idea/vim/vimscript/model/commands
@ -119,12 +119,10 @@ internal class Executor : VimScriptExecutorBase() {
|
||||
private fun ensureFileIsSaved(file: File) {
|
||||
val documentManager = FileDocumentManager.getInstance()
|
||||
|
||||
injector.application.invokeAndWait {
|
||||
VirtualFileManager.getInstance().findFileByNioPath(file.toPath())
|
||||
?.let(documentManager::getCachedDocument)
|
||||
?.takeIf(documentManager::isDocumentUnsaved)
|
||||
?.let(documentManager::saveDocumentAsIs)
|
||||
}
|
||||
VirtualFileManager.getInstance().findFileByNioPath(file.toPath())
|
||||
?.let(documentManager::getCachedDocument)
|
||||
?.takeIf(documentManager::isDocumentUnsaved)
|
||||
?.let(documentManager::saveDocumentAsIs)
|
||||
}
|
||||
|
||||
@Throws(ExException::class)
|
||||
|
@ -61,13 +61,10 @@ public sealed class Command(public var commandRanges: Ranges, public val command
|
||||
override fun execute(editor: VimEditor, context: ExecutionContext): ExecutionResult {
|
||||
checkRanges(editor)
|
||||
checkArgument(editor)
|
||||
injector.application.runWriteAction {
|
||||
if (editor.nativeCarets().any { it.hasSelection() } && Flag.SAVE_VISUAL !in argFlags.flags) {
|
||||
editor.removeSelection()
|
||||
editor.removeSecondaryCarets()
|
||||
}
|
||||
if (editor.nativeCarets().any { it.hasSelection() } && Flag.SAVE_VISUAL !in argFlags.flags) {
|
||||
editor.removeSelection()
|
||||
editor.removeSecondaryCarets()
|
||||
}
|
||||
|
||||
if (argFlags.access == Access.WRITABLE && !editor.isDocumentWritable()) {
|
||||
logger.info("Trying to modify readonly document")
|
||||
return ExecutionResult.Error
|
||||
|
Loading…
Reference in New Issue
Block a user