Skip to content

Commit 87e4313

Browse files
committed
Replace text cursor styles with mouse-text class
This reduces code duplication and makes it significantly easier to make changes to the text cursor without having to individually modify several files.
1 parent 4cd01cd commit 87e4313

12 files changed

Lines changed: 15 additions & 18 deletions

File tree

src/vs/editor/browser/controller/textAreaHandler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export class TextAreaHandler extends ViewPart {
117117
// Text Area (The focus will always be in the textarea when the cursor is blinking)
118118
this.textArea = createFastDomNode(document.createElement('textarea'));
119119
PartFingerprints.write(this.textArea, PartFingerprint.TextArea);
120-
this.textArea.setClassName('inputarea');
120+
this.textArea.setClassName('inputarea mouse-text');
121121
this.textArea.setAttribute('wrap', 'off');
122122
this.textArea.setAttribute('autocorrect', 'off');
123123
this.textArea.setAttribute('autocapitalize', 'off');
@@ -279,7 +279,7 @@ export class TextAreaHandler extends ViewPart {
279279
}
280280

281281
// Show the textarea
282-
this.textArea.setClassName('inputarea ime-input');
282+
this.textArea.setClassName('inputarea mouse-text ime-input');
283283

284284
this._viewController.compositionStart('keyboard');
285285
}));
@@ -301,7 +301,7 @@ export class TextAreaHandler extends ViewPart {
301301
this._visibleTextArea = null;
302302
this._render();
303303

304-
this.textArea.setClassName('inputarea');
304+
this.textArea.setClassName('inputarea mouse-text');
305305
this._viewController.compositionEnd('keyboard');
306306
}));
307307

src/vs/editor/browser/viewParts/lines/viewLines.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
}
2424

2525
.monaco-editor .view-lines {
26-
cursor: text;
2726
white-space: nowrap;
2827
}
2928

src/vs/editor/browser/viewParts/lines/viewLines.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export class ViewLines extends ViewPart implements IVisibleLinesHost<ViewLine>,
134134
this._viewLineOptions = new ViewLineOptions(conf, this._context.theme.type);
135135

136136
PartFingerprints.write(this.domNode, PartFingerprint.ViewLines);
137-
this.domNode.setClassName('view-lines');
137+
this.domNode.setClassName('view-lines mouse-text');
138138
Configuration.applyFontInfo(this.domNode, fontInfo);
139139

140140
// --- width & height

src/vs/editor/browser/viewParts/viewCursors/viewCursor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class ViewCursor {
6363

6464
// Create the dom node
6565
this._domNode = createFastDomNode(document.createElement('div'));
66-
this._domNode.setClassName('cursor');
66+
this._domNode.setClassName('cursor mouse-text');
6767
this._domNode.setHeight(this._lineHeight);
6868
this._domNode.setTop(0);
6969
this._domNode.setLeft(0);
@@ -200,7 +200,7 @@ export class ViewCursor {
200200
this._domNode.domNode.textContent = this._lastRenderedContent;
201201
}
202202

203-
this._domNode.setClassName('cursor ' + this._renderData.textContentClassName);
203+
this._domNode.setClassName('cursor mouse-text ' + this._renderData.textContentClassName);
204204

205205
this._domNode.setDisplay('block');
206206
this._domNode.setTop(this._renderData.top);

src/vs/editor/browser/viewParts/viewCursors/viewCursors.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
.monaco-editor .cursors-layer > .cursor {
1111
position: absolute;
12-
cursor: text;
1312
overflow: hidden;
1413
}
1514

src/vs/editor/browser/widget/diffEditorWidget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2095,7 +2095,7 @@ class InlineViewZonesComputer extends ViewZonesComputer {
20952095
maxCharsPerLine += this.modifiedEditorOptions.get(EditorOption.scrollBeyondLastColumn);
20962096

20972097
let domNode = document.createElement('div');
2098-
domNode.className = 'view-lines line-delete';
2098+
domNode.className = 'view-lines line-delete mouse-text';
20992099
domNode.innerHTML = sb.build();
21002100
Configuration.applyFontInfoSlow(domNode, fontInfo);
21012101

src/vs/workbench/browser/media/style.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ body.web {
175175
cursor: default;
176176
}
177177

178+
.monaco-workbench .mouse-text {
179+
cursor: text;
180+
}
181+
178182
/* Custom Dropdown (select) Arrows */
179183

180184
.monaco-workbench select {

src/vs/workbench/contrib/comments/browser/commentNode.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export class CommentNode extends Disposable {
100100

101101
this.createHeader(this._commentDetailsContainer);
102102

103-
this._body = dom.append(this._commentDetailsContainer, dom.$('div.comment-body'));
103+
this._body = dom.append(this._commentDetailsContainer, dom.$('div.comment-body.mouse-text'));
104104
this._md = this.markdownRenderer.render(comment.body).element;
105105
this._body.appendChild(this._md);
106106

@@ -120,7 +120,7 @@ export class CommentNode extends Disposable {
120120
}
121121

122122
private createHeader(commentDetailsContainer: HTMLElement): void {
123-
const header = dom.append(commentDetailsContainer, dom.$('div.comment-title'));
123+
const header = dom.append(commentDetailsContainer, dom.$('div.comment-title.mouse-text'));
124124
const author = dom.append(header, dom.$('strong.author'));
125125
author.innerText = this.comment.userName;
126126

src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
720720
}
721721

722722
private createReplyButton() {
723-
this._reviewThreadReplyButton = <HTMLButtonElement>dom.append(this._commentForm, dom.$('button.review-thread-reply-button'));
723+
this._reviewThreadReplyButton = <HTMLButtonElement>dom.append(this._commentForm, dom.$('button.review-thread-reply-button.mouse-text'));
724724
this._reviewThreadReplyButton.title = this._commentOptions?.prompt || nls.localize('reply', "Reply...");
725725

726726
this._reviewThreadReplyButton.textContent = this._commentOptions?.prompt || nls.localize('reply', "Reply...");

src/vs/workbench/contrib/comments/browser/media/review.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@
257257
line-height: 20px;
258258
white-space: nowrap;
259259
border: 0px;
260-
cursor: text;
261260
outline: 1px solid transparent;
262261
}
263262

0 commit comments

Comments
 (0)