unify naming, adjust addon version, fix interface description
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xterm-addon-webgl",
|
"name": "xterm-addon-webgl",
|
||||||
"version": "0.5.0",
|
"version": "0.5.1",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "The xterm.js authors",
|
"name": "The xterm.js authors",
|
||||||
"url": "https://xtermjs.org/"
|
"url": "https://xtermjs.org/"
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ export class CursorRenderLayer extends BaseRenderLayer {
|
|||||||
const viewportRelativeCursorY = cursorY - terminal.buffer.viewportY;
|
const viewportRelativeCursorY = cursorY - terminal.buffer.viewportY;
|
||||||
|
|
||||||
// in case cursor.x == cols adjust visual cursor to cols - 1
|
// in case cursor.x == cols adjust visual cursor to cols - 1
|
||||||
const correctedX = Math.min(terminal.buffer.cursorX, terminal.cols - 1);
|
const cursorX = Math.min(terminal.buffer.cursorX, terminal.cols - 1);
|
||||||
|
|
||||||
// Don't draw the cursor if it's off-screen
|
// Don't draw the cursor if it's off-screen
|
||||||
if (viewportRelativeCursorY < 0 || viewportRelativeCursorY >= terminal.rows) {
|
if (viewportRelativeCursorY < 0 || viewportRelativeCursorY >= terminal.rows) {
|
||||||
@@ -138,7 +138,7 @@ export class CursorRenderLayer extends BaseRenderLayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Need fast buffer API for loading cell
|
// TODO: Need fast buffer API for loading cell
|
||||||
(terminal as any)._core.buffer.lines.get(cursorY).loadCell(correctedX, this._cell);
|
(terminal as any)._core.buffer.lines.get(cursorY).loadCell(cursorX, this._cell);
|
||||||
if (this._cell.content === undefined) {
|
if (this._cell.content === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -149,12 +149,12 @@ export class CursorRenderLayer extends BaseRenderLayer {
|
|||||||
this._ctx.fillStyle = this._colors.cursor.css;
|
this._ctx.fillStyle = this._colors.cursor.css;
|
||||||
const cursorStyle = terminal.getOption('cursorStyle');
|
const cursorStyle = terminal.getOption('cursorStyle');
|
||||||
if (cursorStyle && cursorStyle !== 'block') {
|
if (cursorStyle && cursorStyle !== 'block') {
|
||||||
this._cursorRenderers[cursorStyle](terminal, correctedX, viewportRelativeCursorY, this._cell);
|
this._cursorRenderers[cursorStyle](terminal, cursorX, viewportRelativeCursorY, this._cell);
|
||||||
} else {
|
} else {
|
||||||
this._renderBlurCursor(terminal, correctedX, viewportRelativeCursorY, this._cell);
|
this._renderBlurCursor(terminal, cursorX, viewportRelativeCursorY, this._cell);
|
||||||
}
|
}
|
||||||
this._ctx.restore();
|
this._ctx.restore();
|
||||||
this._state.x = correctedX;
|
this._state.x = cursorX;
|
||||||
this._state.y = viewportRelativeCursorY;
|
this._state.y = viewportRelativeCursorY;
|
||||||
this._state.isFocused = false;
|
this._state.isFocused = false;
|
||||||
this._state.style = cursorStyle;
|
this._state.style = cursorStyle;
|
||||||
@@ -170,7 +170,7 @@ export class CursorRenderLayer extends BaseRenderLayer {
|
|||||||
|
|
||||||
if (this._state) {
|
if (this._state) {
|
||||||
// The cursor is already in the correct spot, don't redraw
|
// The cursor is already in the correct spot, don't redraw
|
||||||
if (this._state.x === correctedX &&
|
if (this._state.x === cursorX &&
|
||||||
this._state.y === viewportRelativeCursorY &&
|
this._state.y === viewportRelativeCursorY &&
|
||||||
this._state.isFocused === isTerminalFocused(terminal) &&
|
this._state.isFocused === isTerminalFocused(terminal) &&
|
||||||
this._state.style === terminal.getOption('cursorStyle') &&
|
this._state.style === terminal.getOption('cursorStyle') &&
|
||||||
@@ -181,10 +181,10 @@ export class CursorRenderLayer extends BaseRenderLayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._ctx.save();
|
this._ctx.save();
|
||||||
this._cursorRenderers[terminal.getOption('cursorStyle') || 'block'](terminal, correctedX, viewportRelativeCursorY, this._cell);
|
this._cursorRenderers[terminal.getOption('cursorStyle') || 'block'](terminal, cursorX, viewportRelativeCursorY, this._cell);
|
||||||
this._ctx.restore();
|
this._ctx.restore();
|
||||||
|
|
||||||
this._state.x = correctedX;
|
this._state.x = cursorX;
|
||||||
this._state.y = viewportRelativeCursorY;
|
this._state.y = viewportRelativeCursorY;
|
||||||
this._state.isFocused = false;
|
this._state.isFocused = false;
|
||||||
this._state.style = terminal.getOption('cursorStyle');
|
this._state.style = terminal.getOption('cursorStyle');
|
||||||
|
|||||||
@@ -141,8 +141,8 @@ export class CursorRenderLayer extends BaseRenderLayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// in case cursor.x == cols adjust visual cursor to cols - 1
|
// in case cursor.x == cols adjust visual cursor to cols - 1
|
||||||
const xCorrected = Math.min(this._bufferService.buffer.x, this._bufferService.cols - 1);
|
const cursorX = Math.min(this._bufferService.buffer.x, this._bufferService.cols - 1);
|
||||||
this._bufferService.buffer.lines.get(cursorY)!.loadCell(xCorrected, this._cell);
|
this._bufferService.buffer.lines.get(cursorY)!.loadCell(cursorX, this._cell);
|
||||||
if (this._cell.content === undefined) {
|
if (this._cell.content === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -153,12 +153,12 @@ export class CursorRenderLayer extends BaseRenderLayer {
|
|||||||
this._ctx.fillStyle = this._colors.cursor.css;
|
this._ctx.fillStyle = this._colors.cursor.css;
|
||||||
const cursorStyle = this._optionsService.options.cursorStyle;
|
const cursorStyle = this._optionsService.options.cursorStyle;
|
||||||
if (cursorStyle && cursorStyle !== 'block') {
|
if (cursorStyle && cursorStyle !== 'block') {
|
||||||
this._cursorRenderers[cursorStyle](xCorrected, viewportRelativeCursorY, this._cell);
|
this._cursorRenderers[cursorStyle](cursorX, viewportRelativeCursorY, this._cell);
|
||||||
} else {
|
} else {
|
||||||
this._renderBlurCursor(xCorrected, viewportRelativeCursorY, this._cell);
|
this._renderBlurCursor(cursorX, viewportRelativeCursorY, this._cell);
|
||||||
}
|
}
|
||||||
this._ctx.restore();
|
this._ctx.restore();
|
||||||
this._state.x = xCorrected;
|
this._state.x = cursorX;
|
||||||
this._state.y = viewportRelativeCursorY;
|
this._state.y = viewportRelativeCursorY;
|
||||||
this._state.isFocused = false;
|
this._state.isFocused = false;
|
||||||
this._state.style = cursorStyle;
|
this._state.style = cursorStyle;
|
||||||
@@ -174,7 +174,7 @@ export class CursorRenderLayer extends BaseRenderLayer {
|
|||||||
|
|
||||||
if (this._state) {
|
if (this._state) {
|
||||||
// The cursor is already in the correct spot, don't redraw
|
// The cursor is already in the correct spot, don't redraw
|
||||||
if (this._state.x === xCorrected &&
|
if (this._state.x === cursorX &&
|
||||||
this._state.y === viewportRelativeCursorY &&
|
this._state.y === viewportRelativeCursorY &&
|
||||||
this._state.isFocused === this._coreBrowserService.isFocused &&
|
this._state.isFocused === this._coreBrowserService.isFocused &&
|
||||||
this._state.style === this._optionsService.options.cursorStyle &&
|
this._state.style === this._optionsService.options.cursorStyle &&
|
||||||
@@ -185,10 +185,10 @@ export class CursorRenderLayer extends BaseRenderLayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._ctx.save();
|
this._ctx.save();
|
||||||
this._cursorRenderers[this._optionsService.options.cursorStyle || 'block'](xCorrected, viewportRelativeCursorY, this._cell);
|
this._cursorRenderers[this._optionsService.options.cursorStyle || 'block'](cursorX, viewportRelativeCursorY, this._cell);
|
||||||
this._ctx.restore();
|
this._ctx.restore();
|
||||||
|
|
||||||
this._state.x = xCorrected;
|
this._state.x = cursorX;
|
||||||
this._state.y = viewportRelativeCursorY;
|
this._state.y = viewportRelativeCursorY;
|
||||||
this._state.isFocused = false;
|
this._state.isFocused = false;
|
||||||
this._state.style = this._optionsService.options.cursorStyle;
|
this._state.style = this._optionsService.options.cursorStyle;
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1177,7 +1177,7 @@ declare module 'xterm' {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The x position of the cursor. This ranges between `0` (left side) and
|
* The x position of the cursor. This ranges between `0` (left side) and
|
||||||
* `Terminal.cols - 1` (right side).
|
* `Terminal.cols` (behind last cell of the row).
|
||||||
*/
|
*/
|
||||||
readonly cursorX: number;
|
readonly cursorX: number;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user