terminal: misc improvement for xterm.js settings/prefs
Adds code to respect copy-on-select and enable-clipboard-notice. When
xterm.js is being used, hide some low-usage/value settings items that it
is non-trivial to support for xterm.js: font-smoothing,
scrollbar-visible, and scroll-on-keystroke.
Bug: b/236205389
Change-Id: I39e26c81b3f624eaa440c8974f71c8de223ad1d3
Reviewed-on: https://chromium-review.googlesource.com/c/apps/libapps/+/3949180
Reviewed-by: Joel Hockey <joelhockey@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
diff --git a/terminal/js/terminal_emulator.js b/terminal/js/terminal_emulator.js
index 294e254..913ef49 100644
--- a/terminal/js/terminal_emulator.js
+++ b/terminal/js/terminal_emulator.js
@@ -366,7 +366,11 @@
this.term.onData((data) => this.io.onVTKeystroke(data));
this.term.onBinary((data) => this.io.onVTKeystroke(data));
this.term.onTitleChange((title) => this.setWindowTitle(title));
- this.term.onSelectionChange(() => this.copySelection_());
+ this.term.onSelectionChange(() => {
+ if (this.prefs_.get('copy-on-select')) {
+ this.copySelection_();
+ }
+ });
this.term.onBell(() => this.ringBell());
/**
@@ -814,10 +818,14 @@
return;
}
navigator.clipboard?.writeText(data);
- if (!this.copyNotice_) {
- this.copyNotice_ = document.createElement('terminal-copy-notice');
+
+ if (this.prefs_.get('enable-clipboard-notice')) {
+ if (!this.copyNotice_) {
+ this.copyNotice_ = document.createElement('terminal-copy-notice');
+ }
+ setTimeout(() => this.showOverlay(lib.notNull(this.copyNotice_), 500),
+ 200);
}
- setTimeout(() => this.showOverlay(lib.notNull(this.copyNotice_), 500), 200);
}
/**