Files
1grzyb1 3b42f660a1 VIM-4259 Put the clipboard back after the backend paste in split mode
With ideaput, the register is put into the clipboard for the IDE paste and the
clipboard is put back afterwards (VIM-4371). In split mode the backend executes
the paste again with its own clipboard, which is synced from the frontend.
Since 2026.3 (IJPL-254899) the backend runs the action after a hop to the EDT,
so the clipboard that was put back reaches it first, and the backend pastes the
old system clipboard over the register text.

The frontend editor action handler completes a continuation from the data
context once the backend has executed the action. A new frontend split module
puts it there, and the clipboard is put back only after it completes, with a
timeout. Before 2026.3, or with the document synced by Rhizome, the clipboard
is still put back right away.

Several puts in a row are all sent before the first one is pasted on the
backend, so the clipboard is put back once, after the last of them. Until then
each put and each read of the clipboard register take the content from before
the first put, and a write of the clipboard by IdeaVim drops the pending
restore.
2026-11-20 11:14:03 +01:00

71 lines
1.9 KiB
Kotlin

/*
* Copyright 2003-2026 The IdeaVim authors
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE.txt file or at
* https://opensource.org/licenses/MIT.
*/
import org.jetbrains.intellij.platform.gradle.extensions.IntelliJPlatformExtension
plugins {
java
kotlin("jvm")
id("org.jetbrains.intellij.platform.module")
}
val kotlinVersion: String by project
val ideaType: String by project
val ideaVersion: String by project
val javaVersion: String by project
val ideaBranchNumber = ideaVersion.substringBefore('-').split('.').let { parts ->
val head = parts[0].toIntOrNull() ?: Int.MAX_VALUE // LATEST-EAP-SNAPSHOT
val isProductVersion = head > 1000 // 2026.2 rather than 262.8665.258
if (isProductVersion) (head % 100) * 10 + (parts.getOrNull(1)?.toIntOrNull() ?: 1) else head
}
// intellij.rd.client is a product module since 2026.2; before, its jar only ships for the split-mode frontend
val rdClientModuleExists = ideaBranchNumber >= 262
repositories {
maven { url = uri("https://cache-redirector.jetbrains.com/repo.maven.apache.org/maven2") }
intellijPlatform {
defaultRepositories()
}
}
dependencies {
compileOnly(project(":"))
compileOnly(project(":ideavim-common"))
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
intellijPlatform {
var useInstaller = "EAP-SNAPSHOT" !in ideaVersion
if (ideaType == "RD") {
useInstaller = false
}
create(ideaType, ideaVersion) { this.useInstaller = useInstaller }
if (rdClientModuleExists) bundledModule("intellij.rd.client")
}
if (!rdClientModuleExists) {
compileOnly(files({
project.the<IntelliJPlatformExtension>().platformPath.resolve("plugins/cwm-plugin/lib/frontend-split/rd-client.jar")
}))
}
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(javaVersion))
}
}
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(javaVersion))
}
}