mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Disable retyper on focus lost
This commit is contained in:
@@ -241,6 +241,9 @@ class RetypeSession(
|
||||
override fun dispose() {
|
||||
}
|
||||
|
||||
private fun inFocus(): Boolean =
|
||||
editor.contentComponent == IdeFocusManager.findInstance().focusOwner && ApplicationManager.getApplication().isActive
|
||||
|
||||
private fun runLoop() {
|
||||
while (true) {
|
||||
if (pos == endPos || stopTimer) break
|
||||
@@ -267,7 +270,7 @@ class RetypeSession(
|
||||
|
||||
private fun typeNextInEDT(timerTick: Long, expectedTimerTick: Long) {
|
||||
if (retypePaused) {
|
||||
if (editor.contentComponent == IdeFocusManager.findInstance().focusOwner) {
|
||||
if (inFocus()) {
|
||||
// Resume retyping on editor focus
|
||||
retypePaused = false
|
||||
}
|
||||
@@ -307,7 +310,7 @@ class RetypeSession(
|
||||
}
|
||||
|
||||
// Do not perform typing if editor is not in focus
|
||||
if (editor.contentComponent != IdeFocusManager.findInstance().focusOwner) retypePaused = true
|
||||
if (!inFocus()) retypePaused = true
|
||||
|
||||
if (retypePaused) {
|
||||
checkStop()
|
||||
|
||||
Reference in New Issue
Block a user