Skip to content

Commit

Permalink
adds logging for when the width is 0 (#231121)
Browse files Browse the repository at this point in the history
  • Loading branch information
hediet authored Oct 11, 2024
1 parent 204296f commit c373439
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import { RangeMapping } from '../../../../../common/diff/rangeMapping.js';
export function maxLeftInRange(editor: ObservableCodeEditor, range: LineRange, reader: IReader): number {
editor.layoutInfo.read(reader);
editor.value.read(reader);
const model = editor.model.get()!;

const model = editor.model.read(reader);
if (!model) { return 0; }
let maxLeft = 0;

Expand All @@ -27,6 +28,11 @@ export function maxLeftInRange(editor: ObservableCodeEditor, range: LineRange, r
const left = editor.editor.getOffsetForColumn(i, column);
maxLeft = Math.max(maxLeft, left);
}
const lines = range.mapToLineArray(l => model.getLineContent(l));

if (maxLeft < 5 && lines.some(l => l.length > 0) && model.uri.scheme !== 'file') {
console.error('unexpected width');
}
return maxLeft;
}

Expand Down

0 comments on commit c373439

Please sign in to comment.