Skip to content

Commit

Permalink
When DomRenderer focus,render the cursor line.
Browse files Browse the repository at this point in the history
  • Loading branch information
tisilent committed Sep 7, 2023
1 parent 29dd30a commit c03cb2b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions demo/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ if (document.location.pathname === '/test') {
document.getElementById('bce').addEventListener('click', coloredErase);
addVtButtons();
initImageAddonExposed();
testEvents();
}

function createTerminal(): void {
Expand Down Expand Up @@ -1335,3 +1336,8 @@ function initImageAddonExposed(): void {
canvas?.toBlob(data => window.open(URL.createObjectURL(data), '_blank'));
});
}

function testEvents(): void {
document.getElementById('event-focus').addEventListener('click', ()=> term.focus());
document.getElementById('event-blur').addEventListener('click', ()=> term.blur());
}
4 changes: 4 additions & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ <h3>Test</h3>
<dd><button id="image-demo1">snake (sixel)</button></dd>
<dd><button id="image-demo2">oranges (sixel)</button></dd>
<dd><button id="image-demo3">palette (iip)</button></dd>

<dt>Events Test</dt>
<dd><button id="event-focus">focus</button></dd>
<dd><button id="event-blur">blur</button></dd>
</dl>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/browser/renderer/dom/DomRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ export class DomRenderer extends Disposable implements IRenderer {

public handleFocus(): void {
this._rowContainer.classList.add(FOCUS_CLASS);
this.renderRows(this._bufferService.buffer.y, this._bufferService.buffer.y);
}

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

0 comments on commit c03cb2b

Please sign in to comment.