提交 02fa69d2 编写于 作者: A Alex Dima

Fixes #19808: Block cursor is not rendered properly (visual glitches)

上级 0a7e2216
...@@ -220,6 +220,8 @@ export class ViewLine implements IVisibleLine { ...@@ -220,6 +220,8 @@ export class ViewLine implements IVisibleLine {
} }
public getVisibleRangesForRange(startColumn: number, endColumn: number, context: DomReadingContext): HorizontalRange[] { public getVisibleRangesForRange(startColumn: number, endColumn: number, context: DomReadingContext): HorizontalRange[] {
startColumn = Math.min(this._renderedViewLine.input.lineContent.length + 1, Math.max(1, startColumn));
endColumn = Math.min(this._renderedViewLine.input.lineContent.length + 1, Math.max(1, endColumn));
return this._renderedViewLine.getVisibleRangesForRange(startColumn, endColumn, context); return this._renderedViewLine.getVisibleRangesForRange(startColumn, endColumn, context);
} }
...@@ -440,6 +442,11 @@ class RenderedViewLine { ...@@ -440,6 +442,11 @@ class RenderedViewLine {
} }
protected _readPixelOffset(column: number, context: DomReadingContext): number { protected _readPixelOffset(column: number, context: DomReadingContext): number {
if (this._characterMapping.length === 0) {
// This line is empty
return 0;
}
if (this._pixelOffsetCache !== null) { if (this._pixelOffsetCache !== null) {
// the text is LTR // the text is LTR
...@@ -458,11 +465,6 @@ class RenderedViewLine { ...@@ -458,11 +465,6 @@ class RenderedViewLine {
private _actualReadPixelOffset(column: number, context: DomReadingContext): number { private _actualReadPixelOffset(column: number, context: DomReadingContext): number {
if (this._characterMapping.length === 0) {
// This line is empty
return 0;
}
if (column === this._characterMapping.length && this._isWhitespaceOnly) { if (column === this._characterMapping.length && this._isWhitespaceOnly) {
// This branch helps in the case of whitespace only lines which have a width set // This branch helps in the case of whitespace only lines which have a width set
return this.getWidth(); return this.getWidth();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册