mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[terminal] IDEA-337522 Clear text selection on typing when command is running
GitOrigin-RevId: b43c30a0fd08e0477e060479c118a7f69eae317c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
bb5a58edeb
commit
126ce73045
+2
-2
@@ -7,9 +7,9 @@ import java.awt.event.KeyEvent
|
||||
class BlockTerminalEventsHandler(
|
||||
session: TerminalSession,
|
||||
settings: JBTerminalSystemSettingsProviderBase,
|
||||
private val outputModel: TerminalOutputModel,
|
||||
outputModel: TerminalOutputModel,
|
||||
private val selectionModel: TerminalSelectionModel
|
||||
) : SimpleTerminalEventsHandler(session, settings) {
|
||||
) : SimpleTerminalEventsHandler(session, settings, outputModel) {
|
||||
override fun keyTyped(e: KeyEvent) {
|
||||
// Clear the block selection on typing
|
||||
if (selectionModel.primarySelection != null) {
|
||||
|
||||
@@ -42,7 +42,7 @@ class SimpleTerminalController(
|
||||
terminalModel.isCommandRunning = true
|
||||
|
||||
setupContentListener()
|
||||
val eventsHandler = SimpleTerminalEventsHandler(session, settings)
|
||||
val eventsHandler = SimpleTerminalEventsHandler(session, settings, outputModel)
|
||||
setupKeyEventDispatcher(editor, settings, eventsHandler, outputModel, selectionModel, disposable = this)
|
||||
setupMouseListener(editor, settings, terminalModel, eventsHandler, disposable = this)
|
||||
terminalModel.withContentLock {
|
||||
|
||||
+7
-1
@@ -23,7 +23,8 @@ import javax.swing.SwingUtilities
|
||||
*/
|
||||
open class SimpleTerminalEventsHandler(
|
||||
private val session: TerminalSession,
|
||||
private val settings: JBTerminalSystemSettingsProviderBase
|
||||
private val settings: JBTerminalSystemSettingsProviderBase,
|
||||
protected val outputModel: TerminalOutputModel,
|
||||
) : TerminalEventsHandler {
|
||||
private var ignoreNextKeyTypedEvent: Boolean = false
|
||||
private var lastMotionReport: Point? = null
|
||||
@@ -37,6 +38,11 @@ open class SimpleTerminalEventsHandler(
|
||||
get() = session.model
|
||||
|
||||
override fun keyTyped(e: KeyEvent) {
|
||||
val selectionModel = outputModel.editor.selectionModel
|
||||
if (selectionModel.hasSelection()) {
|
||||
selectionModel.removeSelection()
|
||||
}
|
||||
|
||||
if (ignoreNextKeyTypedEvent) {
|
||||
e.consume()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user