When DomRenderer blue,perform rendering.

This commit is contained in:
tisilent
2023-09-08 18:08:14 +08:00
parent 2e02c37e52
commit 393a8b3a86
3 changed files with 25 additions and 0 deletions
+16
View File
@@ -119,6 +119,8 @@ const actionElements = {
findResults: document.querySelector('#find-results')
};
const paddingElement = document.getElementById('padding') as HTMLInputElement;
const selectionBackgroundElement = document.getElementById('selectionBackground') as HTMLInputElement;
const selectionInactiveBackgroundElement = document.getElementById('selectionInactiveBackground') as HTMLInputElement;
const xtermjsTheme = {
foreground: '#F8F8F8',
@@ -146,6 +148,18 @@ function setPadding(): void {
addons.fit.instance.fit();
}
function setSelectionInactiveBackground(): void {
const theme = { ...term.options.theme };
theme.selectionInactiveBackground = selectionInactiveBackgroundElement.value;
term.options.theme = theme;
}
function setSelectionBackground(): void {
const theme = { ...term.options.theme };
theme.selectionBackground = selectionBackgroundElement.value;
term.options.theme = theme;
}
function getSearchOptions(): ISearchOptions {
return {
regex: (document.getElementById('regex') as HTMLInputElement).checked,
@@ -333,6 +347,8 @@ function createTerminal(): void {
resizeObserver.observe(terminalContainer);
addDomListener(paddingElement, 'change', setPadding);
addDomListener(selectionInactiveBackgroundElement, 'change', setSelectionInactiveBackground);
addDomListener(selectionBackgroundElement, 'change', setSelectionBackground);
addDomListener(actionElements.findNext, 'keydown', (e) => {
if (e.key === 'Enter') {
+8
View File
@@ -75,6 +75,14 @@
<label for="padding">Padding</label>
<input type="number" id="padding" />
</div>
<div style="display: inline-block; margin-right: 16px;">
<label for="selectionBackground">selectionBackground</label>
<input type="text" id="selectionBackground" />
</div>
<div style="display: inline-block; margin-right: 16px;">
<label for="selectionInactiveBackground">SelectionInactiveBackground</label>
<input type="text" id="selectionInactiveBackground" />
</div>
</div>
<div id="test" class="tabContent">
<h3>Test</h3>
+1
View File
@@ -299,6 +299,7 @@ export class DomRenderer extends Disposable implements IRenderer {
public handleBlur(): void {
this._rowContainer.classList.remove(FOCUS_CLASS);
this.renderRows(0, this._bufferService.rows - 1);
}
public handleFocus(): void {