From fe59a1297a96e560ac6019f45638533e960aa8e0 Mon Sep 17 00:00:00 2001 From: Nikita Pavlenko Date: Mon, 13 Jul 2026 10:41:11 +0200 Subject: [PATCH] IJPL-245941 Settings: Fixed exception with mnemonics in "Remote Jar Repositories" settings. (cherry picked from commit 6fd377626a1db2d07b5697cd61ff55b4cb7a04bc) IJ-CR-213483 GitOrigin-RevId: 7b78f33dede3af8a57ed2c7c56b36e5a50c776fd --- .../jarRepository/settings/RemoteRepositoriesConfigurable.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/java/idea-ui/src/com/intellij/jarRepository/settings/RemoteRepositoriesConfigurable.kt b/java/idea-ui/src/com/intellij/jarRepository/settings/RemoteRepositoriesConfigurable.kt index 55a23c33e51c..a274b6a1fe01 100644 --- a/java/idea-ui/src/com/intellij/jarRepository/settings/RemoteRepositoriesConfigurable.kt +++ b/java/idea-ui/src/com/intellij/jarRepository/settings/RemoteRepositoriesConfigurable.kt @@ -343,7 +343,10 @@ class RemoteRepositoriesConfigurable(private val project: Project) : SearchableC private fun mnemonicButton(@Nls text: String): JButton { val button = JButton() val parsed = TextWithMnemonic.parse(text) - button.text = parsed.text + // Use getText(true) so the mnemonic suffix (e.g. "追加 (D)" in locales where the mnemonic + // char is not part of the text) is included; otherwise mnemonicIndex may point outside the text + // length and setDisplayedMnemonicIndex throws IllegalArgumentException. + button.text = parsed.getText(/*withMnemonicSuffix=*/true) if (parsed.hasMnemonic()) { button.mnemonic = parsed.mnemonicCode button.displayedMnemonicIndex = parsed.mnemonicIndex