Skip to content

Commit df04676

Browse files
author
Carlos Cabanero
committed
Clipboard gets overwritten after restart.
Fixes #1956 #1205
1 parent bcd05df commit df04676

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

Blink/TermController.swift

+7-1
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,10 @@ extension TermController: SuspendableSession {
496496
if view.bounds.size != _sessionParams.viewSize {
497497
_session?.sigwinch()
498498
}
499+
500+
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
501+
self._termView.setClipboardWrite(true)
502+
}
499503
}
500504

501505

@@ -518,7 +522,9 @@ extension TermController: SuspendableSession {
518522
_session?.sigwinch()
519523
}
520524

521-
_termView.setClipboardWrite(true)
525+
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
526+
self._termView.setClipboardWrite(true)
527+
}
522528
}
523529

524530
func suspendedSession(with archiver: NSKeyedArchiver) {

Resources/term.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,9 @@ function term_setup(accessibilityEnabled) {
113113
t.onTerminalReady = function() {
114114
window.installKB(t, t.scrollPort_.screen_);
115115
term_setAutoCarriageReturn(true);
116+
term_setClipboardWrite(false);
117+
116118
t.setCursorVisible(true);
117-
118119
t.io.onTerminalResize = function(cols, rows) {
119120
_postMessage('sigwinch', {cols, rows});
120121
if (t.prompt) {
@@ -342,11 +343,7 @@ function term_setClipboardWrite(state) {
342343
if (state === false) {
343344
t.vt.enableClipboardWrite = false;
344345
} else {
345-
setTimeout(() => {
346-
// Delay a tiny bit so operations that reset the clipboard
347-
// can have a tiny bit more margin. #1205
348-
t.vt.enableClipboardWrite = true;
349-
}, 500);
346+
t.vt.enableClipboardWrite = true;
350347
}
351348
}
352349

0 commit comments

Comments
 (0)