Paint secondary cursors with the same opacity as the primary cursor

This commit is contained in:
Alex Dima 2018-01-23 12:25:02 +01:00
parent 36cafba0ac
commit 2140e0320e
3 changed files with 4 additions and 13 deletions

View file

@ -34,7 +34,6 @@ class ViewCursorRenderData {
export class ViewCursor {
private readonly _context: ViewContext;
private readonly _isSecondary: boolean;
private readonly _domNode: FastDomNode<HTMLElement>;
private _cursorStyle: TextEditorCursorStyle;
@ -49,9 +48,8 @@ export class ViewCursor {
private _lastRenderedContent: string;
private _renderData: ViewCursorRenderData;
constructor(context: ViewContext, isSecondary: boolean) {
constructor(context: ViewContext) {
this._context = context;
this._isSecondary = isSecondary;
this._cursorStyle = this._context.configuration.editor.viewInfo.cursorStyle;
this._lineHeight = this._context.configuration.editor.lineHeight;
@ -62,11 +60,7 @@ export class ViewCursor {
// Create the dom node
this._domNode = createFastDomNode(document.createElement('div'));
if (this._isSecondary) {
this._domNode.setClassName('cursor secondary');
} else {
this._domNode.setClassName('cursor');
}
this._domNode.setClassName('cursor');
this._domNode.setHeight(this._lineHeight);
this._domNode.setTop(0);
this._domNode.setLeft(0);

View file

@ -12,9 +12,6 @@
cursor: text;
overflow: hidden;
}
.monaco-editor .cursors-layer > .cursor.secondary {
opacity: 0.6;
}
/* -- block-outline-style -- */
.monaco-editor .cursors-layer.cursor-block-outline-style > .cursor {

View file

@ -49,7 +49,7 @@ export class ViewCursors extends ViewPart {
this._cursorStyle = this._context.configuration.editor.viewInfo.cursorStyle;
this._selectionIsEmpty = true;
this._primaryCursor = new ViewCursor(this._context, false);
this._primaryCursor = new ViewCursor(this._context);
this._secondaryCursors = [];
this._renderData = [];
@ -109,7 +109,7 @@ export class ViewCursors extends ViewPart {
// Create new cursors
let addCnt = secondaryPositions.length - this._secondaryCursors.length;
for (let i = 0; i < addCnt; i++) {
let newCursor = new ViewCursor(this._context, true);
let newCursor = new ViewCursor(this._context);
this._domNode.domNode.insertBefore(newCursor.getDomNode().domNode, this._primaryCursor.getDomNode().domNode.nextSibling);
this._secondaryCursors.push(newCursor);
}