Skip to content

Commit 7b52b8e

Browse files
authoredSep 7, 2023
Merge pull request #4754 from tisilent/DomRenderer-Focus-Cursor
When DomRenderer focus,render the cursor line.
2 parents 29dd30a + c03cb2b commit 7b52b8e

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed
 

‎demo/client.ts

+6
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ if (document.location.pathname === '/test') {
247247
document.getElementById('bce').addEventListener('click', coloredErase);
248248
addVtButtons();
249249
initImageAddonExposed();
250+
testEvents();
250251
}
251252

252253
function createTerminal(): void {
@@ -1335,3 +1336,8 @@ function initImageAddonExposed(): void {
13351336
canvas?.toBlob(data => window.open(URL.createObjectURL(data), '_blank'));
13361337
});
13371338
}
1339+
1340+
function testEvents(): void {
1341+
document.getElementById('event-focus').addEventListener('click', ()=> term.focus());
1342+
document.getElementById('event-blur').addEventListener('click', ()=> term.blur());
1343+
}

‎demo/index.html

+4
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ <h3>Test</h3>
109109
<dd><button id="image-demo1">snake (sixel)</button></dd>
110110
<dd><button id="image-demo2">oranges (sixel)</button></dd>
111111
<dd><button id="image-demo3">palette (iip)</button></dd>
112+
113+
<dt>Events Test</dt>
114+
<dd><button id="event-focus">focus</button></dd>
115+
<dd><button id="event-blur">blur</button></dd>
112116
</dl>
113117
</div>
114118
</div>

‎src/browser/renderer/dom/DomRenderer.ts

+1
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ export class DomRenderer extends Disposable implements IRenderer {
303303

304304
public handleFocus(): void {
305305
this._rowContainer.classList.add(FOCUS_CLASS);
306+
this.renderRows(this._bufferService.buffer.y, this._bufferService.buffer.y);
306307
}
307308

308309
public handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean): void {

0 commit comments

Comments
 (0)
Please sign in to comment.