Fixes bugs in bracket guides for wrapped lines.

This commit is contained in:
Henning Dieterichs committed 2022-04-11 10:52:13 +02:00
1 parent 84d6b4a12a
commit 32001ed925
3 files changed
+7 -9

No files matched your search

@@ -416,7 +416,6 @@ export class GuidesTextModelPart extends TextModelPart implements IGuidesTextMod
className,
null,
l === start.lineNumber ? start.column : -1,
// TODO: Investigate if this is correct
l === end.lineNumber ? end.column : -1
)
);
+4 -1
View File
@@ -52,8 +52,11 @@ export class IndentGuide {
* It starts at visibleColumn and continues until endColumn.
*/
public readonly horizontalLine: IndentGuideHorizontalLine | null,
/**
* If set (!= -1), only show this guide for wrapped lines that don't contain this model column, but are after it.
*/
public readonly forWrappedLinesAfterColumn: number | -1,
public readonly forWrappedLinesBeforeColumn: number | -1
public readonly forWrappedLinesBeforeOrAtColumn: number | -1
) {
if ((visibleColumn !== -1) === (column !== -1)) {
throw new Error();
@@ -582,10 +582,6 @@ export class ViewModelLinesFromProjectedModel implements IViewModelLines {
// visibleColumns stay as they are (this is a bug and needs to be fixed, but it is not a regression)
// model-columns must be converted to view-model columns.
const result = bracketGuides.map(g => {
/*if (g.onlyForWrappedLines && !viewLineInfo.isWrappedLineContinuation) {
return undefined;
}*/
if (g.forWrappedLinesAfterColumn !== -1) {
const p = this.modelLineProjections[viewLineInfo.modelLineNumber - 1].getViewPositionOfModelPosition(0, g.forWrappedLinesAfterColumn);
if (p.lineNumber >= viewLineInfo.modelLineWrappedLineIdx) {
@@ -593,9 +589,9 @@ export class ViewModelLinesFromProjectedModel implements IViewModelLines {
}
}
if (g.forWrappedLinesBeforeColumn !== -1) {
const p = this.modelLineProjections[viewLineInfo.modelLineNumber - 1].getViewPositionOfModelPosition(0, g.forWrappedLinesBeforeColumn);
if (p.lineNumber <= viewLineInfo.modelLineWrappedLineIdx) {
if (g.forWrappedLinesBeforeOrAtColumn !== -1) {
const p = this.modelLineProjections[viewLineInfo.modelLineNumber - 1].getViewPositionOfModelPosition(0, g.forWrappedLinesBeforeOrAtColumn);
if (p.lineNumber < viewLineInfo.modelLineWrappedLineIdx) {
return undefined;
}
}