From df04676bc07fde94b57a9cc7aedf2430ab996e07 Mon Sep 17 00:00:00 2001 From: Carlos Cabanero Date: Wed, 7 Feb 2024 15:19:59 -0500 Subject: [PATCH] Clipboard gets overwritten after restart. Fixes #1956 #1205 --- Blink/TermController.swift | 8 +++++++- Resources/term.js | 9 +++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Blink/TermController.swift b/Blink/TermController.swift index 6c5f06fc9..2c3230ef5 100644 --- a/Blink/TermController.swift +++ b/Blink/TermController.swift @@ -496,6 +496,10 @@ extension TermController: SuspendableSession { if view.bounds.size != _sessionParams.viewSize { _session?.sigwinch() } + + DispatchQueue.main.asyncAfter(deadline: .now() + 2) { + self._termView.setClipboardWrite(true) + } } @@ -518,7 +522,9 @@ extension TermController: SuspendableSession { _session?.sigwinch() } - _termView.setClipboardWrite(true) + DispatchQueue.main.asyncAfter(deadline: .now() + 2) { + self._termView.setClipboardWrite(true) + } } func suspendedSession(with archiver: NSKeyedArchiver) { diff --git a/Resources/term.js b/Resources/term.js index 60b12af15..4702ed287 100644 --- a/Resources/term.js +++ b/Resources/term.js @@ -113,8 +113,9 @@ function term_setup(accessibilityEnabled) { t.onTerminalReady = function() { window.installKB(t, t.scrollPort_.screen_); term_setAutoCarriageReturn(true); + term_setClipboardWrite(false); + t.setCursorVisible(true); - t.io.onTerminalResize = function(cols, rows) { _postMessage('sigwinch', {cols, rows}); if (t.prompt) { @@ -342,11 +343,7 @@ function term_setClipboardWrite(state) { if (state === false) { t.vt.enableClipboardWrite = false; } else { - setTimeout(() => { - // Delay a tiny bit so operations that reset the clipboard - // can have a tiny bit more margin. #1205 - t.vt.enableClipboardWrite = true; - }, 500); + t.vt.enableClipboardWrite = true; } }