diff --git a/plugins/terminal/frontend/src/com/intellij/terminal/frontend/action/TerminalEscapeHandlers.kt b/plugins/terminal/frontend/src/com/intellij/terminal/frontend/action/TerminalEscapeHandlers.kt index dc0a4db8285c..f2eb7782fdd1 100644 --- a/plugins/terminal/frontend/src/com/intellij/terminal/frontend/action/TerminalEscapeHandlers.kt +++ b/plugins/terminal/frontend/src/com/intellij/terminal/frontend/action/TerminalEscapeHandlers.kt @@ -27,7 +27,7 @@ internal class CancelSelection : TerminalEscapeHandler { override fun isEnabled(e: AnActionEvent): Boolean = e.terminalEditor?.selectionModel?.hasSelection() == true override fun execute(e: AnActionEvent) { - e.terminalEditor?.selectionModel?.removeSelection() + e.terminalEditor?.selectionModel?.removeSelection(true) } } diff --git a/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalMouseEventsHandlerImpl.kt b/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalMouseEventsHandlerImpl.kt index 52a1c49d58dd..7c575f5e5255 100644 --- a/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalMouseEventsHandlerImpl.kt +++ b/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalMouseEventsHandlerImpl.kt @@ -50,7 +50,7 @@ internal class TerminalMouseEventsHandlerImpl( // Editor selection can be active at this moment only if the user holds Shift. // Support the case of removing the selection here, because editor logic won't be able to do it // (we consume the event). - editor.selectionModel.removeSelection() + editor.selectionModel.removeSelection(true) // Consume the mouse event to avoid double processing: // by the terminal process and the editor logic (for example, text selection). @@ -136,7 +136,7 @@ internal class TerminalMouseEventsHandlerImpl( if (event.isConsumed) return if (settings.enableMouseReporting() && terminalState.mouseMode != MouseMode.MOUSE_REPORTING_NONE && !event.isShiftDown) { - editor.selectionModel.removeSelection() + editor.selectionModel.removeSelection(true) // mousePressed() handles mouse wheel using SCROLLDOWN and SCROLLUP buttons mousePressed(x, y, event) } diff --git a/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalTextSelectionModelImpl.kt b/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalTextSelectionModelImpl.kt index 9f532adef659..0d723484dcf4 100644 --- a/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalTextSelectionModelImpl.kt +++ b/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalTextSelectionModelImpl.kt @@ -48,7 +48,7 @@ internal class TerminalTextSelectionModelImpl( val end = newSelection.endOffset - outputModel.startOffset editorSelectionModel.setSelection(start.toInt(), end.toInt()) } - else editorSelectionModel.removeSelection() + else editorSelectionModel.removeSelection(true) } private fun getCurrentSelection(): TerminalTextSelection? { diff --git a/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalViewImpl.kt b/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalViewImpl.kt index b07ae4c2995c..95ee6bfc7c62 100644 --- a/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalViewImpl.kt +++ b/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalViewImpl.kt @@ -581,8 +581,8 @@ class TerminalViewImpl( coroutineScope.launch(Dispatchers.UI + CoroutineName("Key events listener")) { keyEventsFlow.collect { e -> if (e.awtEvent.id == KeyEvent.KEY_TYPED) { - outputEditor.selectionModel.let { if (it.hasSelection()) it.removeSelection() } - alternateBufferEditor.selectionModel.let { if (it.hasSelection()) it.removeSelection() } + outputEditor.selectionModel.let { if (it.hasSelection()) it.removeSelection(true) } + alternateBufferEditor.selectionModel.let { if (it.hasSelection()) it.removeSelection(true) } } } }