Skip to content

Commit

Permalink
Merge pull request #4500 from Tyriar/4487
Browse files Browse the repository at this point in the history
Clear whole cursor layer on Firefox
  • Loading branch information
Tyriar committed May 2, 2023
2 parents 2fdb469 + 0a101a0 commit 16f82cb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions addons/xterm-addon-canvas/src/CursorRenderLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { IEventEmitter } from 'common/EventEmitter';
import { ICoreBrowserService, IThemeService } from 'browser/services/Services';
import { Terminal } from 'xterm';
import { toDisposable } from 'common/Lifecycle';
import { isFirefox } from 'common/Platform';

interface ICursorState {
x: number;
Expand Down Expand Up @@ -190,8 +191,9 @@ export class CursorRenderLayer extends BaseRenderLayer {

private _clearCursor(): void {
if (this._state) {
// Avoid potential rounding errors when device pixel ratio is less than 1
if (this._coreBrowserService.dpr < 1) {
// Avoid potential rounding errors when browser is Firefox (#4487) or device pixel ratio is
// less than 1
if (isFirefox || this._coreBrowserService.dpr < 1) {
this._clearAll();
} else {
this._clearCells(this._state.x, this._state.y, this._state.width, 1);
Expand Down
6 changes: 4 additions & 2 deletions addons/xterm-addon-webgl/src/renderLayer/CursorRenderLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { IEventEmitter } from 'common/EventEmitter';
import { ICoreBrowserService, IThemeService } from 'browser/services/Services';
import { ICoreService, IOptionsService } from 'common/services/Services';
import { toDisposable } from 'common/Lifecycle';
import { isFirefox } from 'common/Platform';

interface ICursorState {
x: number;
Expand Down Expand Up @@ -190,8 +191,9 @@ export class CursorRenderLayer extends BaseRenderLayer {

private _clearCursor(): void {
if (this._state) {
// Avoid potential rounding errors when device pixel ratio is less than 1
if (this._coreBrowserService.dpr < 1) {
// Avoid potential rounding errors when browser is Firefox (#4487) or device pixel ratio is
// less than 1
if (isFirefox || this._coreBrowserService.dpr < 1) {
this._clearAll();
} else {
this._clearCells(this._state.x, this._state.y, this._state.width, 1);
Expand Down

0 comments on commit 16f82cb

Please sign in to comment.