Skip to content

Commit c7d32a4

Browse files
authored
Merge pull request microsoft#184604 from yshaojun/fix/183736
fix: cursor not visible at column 1 in mergeEditor(microsoft#183736)
2 parents 9fb499c + 1621d38 commit c7d32a4

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,13 @@ export class BaseCodeEditorView extends CodeEditorView {
9595
}
9696

9797
const blockClassNames = ['merge-editor-block'];
98+
let blockPadding: [top: number, right: number, bottom: number, left: number] = [0, 0, 0, 0];
9899
if (isHandled) {
99100
blockClassNames.push('handled');
100101
}
101102
if (modifiedBaseRange === activeModifiedBaseRange) {
102103
blockClassNames.push('focused');
104+
blockPadding = [0, 2, 0, 2];
103105
}
104106
blockClassNames.push('base');
105107

@@ -139,6 +141,7 @@ export class BaseCodeEditorView extends CodeEditorView {
139141
options: {
140142
showIfCollapsed: true,
141143
blockClassName: blockClassNames.join(' '),
144+
blockPadding,
142145
blockIsAfterEnd: range.startLineNumber > textModel.getLineCount(),
143146
description: 'Merge Editor',
144147
minimap: {

src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,14 @@ export class InputCodeEditorView extends CodeEditorView {
135135
}
136136

137137
const blockClassNames = ['merge-editor-block'];
138+
let blockPadding: [top: number, right: number, bottom: number, left: number] = [0, 0, 0, 0];
138139
const isHandled = model.isInputHandled(modifiedBaseRange, this.inputNumber).read(reader);
139140
if (isHandled) {
140141
blockClassNames.push('handled');
141142
}
142143
if (modifiedBaseRange === activeModifiedBaseRange) {
143144
blockClassNames.push('focused');
145+
blockPadding = [0, 2, 0, 2];
144146
}
145147
if (modifiedBaseRange.isConflicting) {
146148
blockClassNames.push('conflicting');
@@ -161,6 +163,7 @@ export class InputCodeEditorView extends CodeEditorView {
161163
options: {
162164
showIfCollapsed: true,
163165
blockClassName: blockClassNames.join(' '),
166+
blockPadding,
164167
blockIsAfterEnd: range.startLineNumber > textModel.getLineCount(),
165168
description: 'Merge Editor',
166169
minimap: {

src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,14 @@ export class ResultCodeEditorView extends CodeEditorView {
155155

156156
if (modifiedBaseRange) {
157157
const blockClassNames = ['merge-editor-block'];
158+
let blockPadding: [top: number, right: number, bottom: number, left: number] = [0, 0, 0, 0];
158159
const isHandled = model.isHandled(modifiedBaseRange).read(reader);
159160
if (isHandled) {
160161
blockClassNames.push('handled');
161162
}
162163
if (modifiedBaseRange === activeModifiedBaseRange) {
163164
blockClassNames.push('focused');
165+
blockPadding = [0, 2, 0, 2];
164166
}
165167
if (modifiedBaseRange.isConflicting) {
166168
blockClassNames.push('conflicting');
@@ -177,6 +179,7 @@ export class ResultCodeEditorView extends CodeEditorView {
177179
options: {
178180
showIfCollapsed: true,
179181
blockClassName: blockClassNames.join(' '),
182+
blockPadding,
180183
blockIsAfterEnd: range.startLineNumber > textModel.getLineCount(),
181184
description: 'Result Diff',
182185
minimap: {

0 commit comments

Comments
 (0)