mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Fixes conflict block rendering bug. (#162162)
This commit is contained in:
parent
b0f88c162c
commit
a1e8a52697
|
@ -82,10 +82,20 @@ export class BlockDecorations extends ViewPart {
|
|||
block = this.blocks[count] = createFastDomNode(document.createElement('div'));
|
||||
this.domNode.appendChild(block);
|
||||
}
|
||||
const top = ctx.getVerticalOffsetForLineNumber(decoration.range.startLineNumber, true);
|
||||
const bottom = decoration.range.isEmpty()
|
||||
? ctx.getVerticalOffsetForLineNumber(decoration.range.startLineNumber, false)
|
||||
: ctx.getVerticalOffsetAfterLineNumber(decoration.range.endLineNumber, true);
|
||||
|
||||
let top: number;
|
||||
let bottom: number;
|
||||
|
||||
if (decoration.options.blockIsAfterEnd) {
|
||||
// range must be empty
|
||||
top = ctx.getVerticalOffsetAfterLineNumber(decoration.range.endLineNumber, false);
|
||||
bottom = ctx.getVerticalOffsetAfterLineNumber(decoration.range.endLineNumber, true);
|
||||
} else {
|
||||
top = ctx.getVerticalOffsetForLineNumber(decoration.range.startLineNumber, true);
|
||||
bottom = decoration.range.isEmpty()
|
||||
? ctx.getVerticalOffsetForLineNumber(decoration.range.startLineNumber, false)
|
||||
: ctx.getVerticalOffsetAfterLineNumber(decoration.range.endLineNumber, true);
|
||||
}
|
||||
|
||||
block.setClassName('blockDecorations-block ' + decoration.options.blockClassName);
|
||||
block.setLeft(ctx.scrollLeft);
|
||||
|
|
|
@ -92,6 +92,11 @@ export interface IModelDecorationOptions {
|
|||
*/
|
||||
className?: string | null;
|
||||
blockClassName?: string | null;
|
||||
/**
|
||||
* Indicates if this block should be rendered after the last line.
|
||||
* In this case, the range must be empty and set to the last line.
|
||||
*/
|
||||
blockIsAfterEnd?: boolean | null;
|
||||
/**
|
||||
* Message to be rendered when hovering over the glyph margin decoration.
|
||||
*/
|
||||
|
|
|
@ -2231,6 +2231,7 @@ export class ModelDecorationOptions implements model.IModelDecorationOptions {
|
|||
|
||||
readonly description: string;
|
||||
readonly blockClassName: string | null;
|
||||
readonly blockIsAfterEnd: boolean | null;
|
||||
readonly stickiness: model.TrackedRangeStickiness;
|
||||
readonly zIndex: number;
|
||||
readonly className: string | null;
|
||||
|
@ -2258,6 +2259,7 @@ export class ModelDecorationOptions implements model.IModelDecorationOptions {
|
|||
private constructor(options: model.IModelDecorationOptions) {
|
||||
this.description = options.description;
|
||||
this.blockClassName = options.blockClassName ? cleanClassName(options.blockClassName) : null;
|
||||
this.blockIsAfterEnd = options.blockIsAfterEnd ?? null;
|
||||
this.stickiness = options.stickiness || model.TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges;
|
||||
this.zIndex = options.zIndex || 0;
|
||||
this.className = options.className ? cleanClassName(options.className) : null;
|
||||
|
|
5
src/vs/monaco.d.ts
vendored
5
src/vs/monaco.d.ts
vendored
|
@ -1488,6 +1488,11 @@ declare namespace monaco.editor {
|
|||
*/
|
||||
className?: string | null;
|
||||
blockClassName?: string | null;
|
||||
/**
|
||||
* Indicates if this block should be rendered after the last line.
|
||||
* In this case, the range must be empty and set to the last line.
|
||||
*/
|
||||
blockIsAfterEnd?: boolean | null;
|
||||
/**
|
||||
* Message to be rendered when hovering over the glyph margin decoration.
|
||||
*/
|
||||
|
|
|
@ -158,6 +158,7 @@ export class InputCodeEditorView extends CodeEditorView {
|
|||
options: {
|
||||
showIfCollapsed: true,
|
||||
blockClassName: blockClassNames.join(' '),
|
||||
blockIsAfterEnd: range.startLineNumber > this.editor.getModel()!.getLineCount(),
|
||||
description: 'Merge Editor',
|
||||
minimap: {
|
||||
position: MinimapPosition.Gutter,
|
||||
|
|
Loading…
Reference in a new issue