Skip to content

Commit e6cb8b7

Browse files
authored
properly detect when all lines want to be hidden (microsoft#188392)
1 parent fdef134 commit e6cb8b7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/vs/workbench/contrib/inlineChat/browser/inlineChatLivePreviewWidget.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,13 @@ export class InlineChatLivePreviewWidget extends ZoneWidget {
252252
return;
253253
}
254254

255-
let hiddenRanges = lineRanges.map(lineRangeAsRange);
256-
if (LineRange.fromRange(hiddenRanges.reduce(Range.plusRange)).equals(LineRange.ofLength(1, editor.getModel().getLineCount()))) {
257-
// TODO not every line can be hidden, keep the first line around
255+
let hiddenRanges: Range[];
256+
const hiddenLinesCount = lineRanges.reduce((p, c) => p + c.length, 0); // assumes no overlap
257+
if (hiddenLinesCount >= editor.getModel().getLineCount()) {
258+
// TODO: not every line can be hidden, keep the first line around
258259
hiddenRanges = [editor.getModel().getFullModelRange().delta(1)];
260+
} else {
261+
hiddenRanges = lineRanges.map(lineRangeAsRange);
259262
}
260263
editor.setHiddenAreas(hiddenRanges, InlineChatLivePreviewWidget._hideId);
261264
this._logService.debug(`[IE] diff HIDING ${hiddenRanges} for ${editor.getId()} with ${String(editor.getModel()?.uri)}`);

0 commit comments

Comments
 (0)