From dad4d26fd830f5665db24fca287fa9bd35ec8363 Mon Sep 17 00:00:00 2001 From: hstyi Date: Mon, 22 Dec 2025 09:06:09 +0800 Subject: [PATCH] chore: add "Nothing" option for right-click --- .../kotlin/app/termora/SettingsOptionsPane.kt | 3 ++ .../TerminalPanelMouseSelectionAdapter.kt | 33 ++++++++++--------- src/main/resources/i18n/messages.properties | 1 + .../resources/i18n/messages_ru_RU.properties | 1 + .../resources/i18n/messages_zh_CN.properties | 1 + .../resources/i18n/messages_zh_TW.properties | 1 + 6 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/main/kotlin/app/termora/SettingsOptionsPane.kt b/src/main/kotlin/app/termora/SettingsOptionsPane.kt index 14f4f17..6e7acec 100644 --- a/src/main/kotlin/app/termora/SettingsOptionsPane.kt +++ b/src/main/kotlin/app/termora/SettingsOptionsPane.kt @@ -547,6 +547,7 @@ class SettingsOptionsPane : OptionsPane() { rightClickComboBox.addItem("Copy") rightClickComboBox.addItem("CopyAndPaste") + rightClickComboBox.addItem("Nothing") rightClickComboBox.selectedItem = terminalSetting.rightClick @@ -576,6 +577,8 @@ class SettingsOptionsPane : OptionsPane() { text = I18n.getString("termora.settings.terminal.right-click.copy") } else if (value == "CopyAndPaste") { text = I18n.getString("termora.settings.terminal.right-click.copy-and-paste") + }else if (value == "Nothing") { + text = I18n.getString("termora.settings.terminal.right-click.nothing") } return super.getListCellRendererComponent(list, text, index, isSelected, cellHasFocus) } diff --git a/src/main/kotlin/app/termora/terminal/panel/TerminalPanelMouseSelectionAdapter.kt b/src/main/kotlin/app/termora/terminal/panel/TerminalPanelMouseSelectionAdapter.kt index f454ddb..aa19cbe 100644 --- a/src/main/kotlin/app/termora/terminal/panel/TerminalPanelMouseSelectionAdapter.kt +++ b/src/main/kotlin/app/termora/terminal/panel/TerminalPanelMouseSelectionAdapter.kt @@ -53,30 +53,31 @@ class TerminalPanelMouseSelectionAdapter(private val terminalPanel: TerminalPane if (SwingUtilities.isRightMouseButton(e)) { // 如果有选中并且开启了选中复制,那么右键直接是粘贴 if (selectionModel.hasSelection() && isSelectCopy.not()) { - triggerCopyAction( - KeyEvent( - e.component, - KeyEvent.KEY_PRESSED, - e.`when`, - e.modifiersEx, - KeyEvent.VK_C, - 'C' - ) - ) - - if (rightClickMode == "CopyAndPaste") { - triggerPasteAction( + if (rightClickMode != "Nothing") { + triggerCopyAction( KeyEvent( e.component, KeyEvent.KEY_PRESSED, e.`when`, e.modifiersEx, - KeyEvent.VK_V, - 'V' + KeyEvent.VK_C, + 'C' ) ) - } + if (rightClickMode == "CopyAndPaste") { + triggerPasteAction( + KeyEvent( + e.component, + KeyEvent.KEY_PRESSED, + e.`when`, + e.modifiersEx, + KeyEvent.VK_V, + 'V' + ) + ) + } + } } else { // paste triggerPasteAction( diff --git a/src/main/resources/i18n/messages.properties b/src/main/resources/i18n/messages.properties index 01434c4..25697ab 100644 --- a/src/main/resources/i18n/messages.properties +++ b/src/main/resources/i18n/messages.properties @@ -59,6 +59,7 @@ termora.settings.terminal.hyperlink=Hyperlink termora.settings.terminal.select-copy=Select copy termora.settings.terminal.right-click=Right click termora.settings.terminal.right-click.copy-and-paste=Copy and Paste +termora.settings.terminal.right-click.nothing=Nothing termora.settings.terminal.right-click.copy=${termora.copy} termora.settings.terminal.cursor-style=Cursor type termora.settings.terminal.cursor-blink=Cursor blink diff --git a/src/main/resources/i18n/messages_ru_RU.properties b/src/main/resources/i18n/messages_ru_RU.properties index 770ec96..5cae657 100644 --- a/src/main/resources/i18n/messages_ru_RU.properties +++ b/src/main/resources/i18n/messages_ru_RU.properties @@ -81,6 +81,7 @@ termora.settings.terminal.hyperlink=Ссылки termora.settings.terminal.select-copy=Копировать выделенное termora.settings.terminal.right-click=правой кнопкой мыши termora.settings.terminal.right-click.copy-and-paste=Копировать и вставить +termora.settings.terminal.right-click.nothing=никто termora.settings.terminal.cursor-style=Вид курсора termora.settings.terminal.cursor-blink=Мигать курсором termora.settings.terminal.local-shell=Локальный терминал diff --git a/src/main/resources/i18n/messages_zh_CN.properties b/src/main/resources/i18n/messages_zh_CN.properties index a374b35..7f3f37b 100644 --- a/src/main/resources/i18n/messages_zh_CN.properties +++ b/src/main/resources/i18n/messages_zh_CN.properties @@ -73,6 +73,7 @@ termora.settings.terminal.hyperlink=超链接 termora.settings.terminal.select-copy=选中复制 termora.settings.terminal.right-click=右键点击 termora.settings.terminal.right-click.copy-and-paste=复制 & 粘贴 +termora.settings.terminal.right-click.nothing=无操作 termora.settings.terminal.cursor-style=光标样式 termora.settings.terminal.cursor-blink=光标闪烁 termora.settings.terminal.local-shell=本地终端 diff --git a/src/main/resources/i18n/messages_zh_TW.properties b/src/main/resources/i18n/messages_zh_TW.properties index e9fbbed..75cebf9 100644 --- a/src/main/resources/i18n/messages_zh_TW.properties +++ b/src/main/resources/i18n/messages_zh_TW.properties @@ -85,6 +85,7 @@ termora.settings.terminal.hyperlink=超連結 termora.settings.terminal.select-copy=選取複製 termora.settings.terminal.right-click=右鍵點擊 termora.settings.terminal.right-click.copy-and-paste=複製 & 貼上 +termora.settings.terminal.right-click.nothing=無操作 termora.settings.terminal.cursor-style=遊標風格 termora.settings.terminal.cursor-blink=遊標閃爍 termora.settings.terminal.local-shell=本地端