Skip to content

Commit

Permalink
Clipboard gets overwritten after restart.
Browse files Browse the repository at this point in the history
Fixes #1956 #1205
  • Loading branch information
Carlos Cabanero committed Feb 7, 2024
1 parent bcd05df commit df04676
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
8 changes: 7 additions & 1 deletion Blink/TermController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}


Expand All @@ -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) {
Expand Down
9 changes: 3 additions & 6 deletions Resources/term.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
}

Expand Down

0 comments on commit df04676

Please sign in to comment.