This commit is contained in:
Don Jayamanne 2024-08-07 22:37:09 +10:00
parent 4a8ef1b244
commit 583053113b
No known key found for this signature in database
GPG key ID: 6E3F5E00E1354B5F
4 changed files with 8 additions and 29 deletions

View file

@ -73,22 +73,14 @@ export class CellDiffPlaceholderElement extends Disposable {
localize('hiddenCells', '{0} hidden cells', placeholder.hiddenCells.length);
templateData.placeholder.innerText = text;
const handler = (e: MouseEvent) => {
this._register(DOM.addDisposableListener(templateData.placeholder, 'dblclick', (e: MouseEvent) => {
if (e.button !== 0) {
return;
}
e.preventDefault();
placeholder.showHiddenCells();
};
templateData.placeholder.addEventListener('dblclick', handler);
this._register({
dispose: () => {
templateData.placeholder.removeEventListener('dblclick', handler);
}
});
this._register(templateData.marginOverlay.onAction(() => {
placeholder.showHiddenCells();
}));
this._register(templateData.marginOverlay.onAction(() => placeholder.showHiddenCells()));
templateData.marginOverlay.show();
}
}
@ -1399,9 +1391,7 @@ export class ModifiedElement extends AbstractElementRenderer {
override buildBody(): void {
super.buildBody();
if (this.cell.unchangedCells) {
this._register(this.templateData.marginOverlay.onAction(() => {
this.cell.hideUnchangedCells();
}));
this._register(this.templateData.marginOverlay.onAction(() => this.cell.hideUnchangedCells()));
this.templateData.marginOverlay.show();
} else {
this.templateData.marginOverlay.hide();
@ -1852,9 +1842,7 @@ export class CollapsedCellOverlayWidget extends Disposable implements IDiffCellM
this._nodes.root.style.display = 'none';
container.appendChild(this._nodes.root);
this._register(DOM.addDisposableListener(this._nodes.content.children[0], 'click', () => {
this._action.fire();
}));
this._register(DOM.addDisposableListener(this._nodes.content.children[0], 'click', () => this._action.fire()));
}
public show() {
this._nodes.root.style.display = 'block';

View file

@ -49,9 +49,7 @@ export abstract class DiffElementViewModelBase extends Disposable {
) {
super();
this._register(this.editorEventDispatcher.onDidChangeLayout(e => {
this._layoutInfoEmitter.fire({ outerWidth: true });
}));
this._register(this.editorEventDispatcher.onDidChangeLayout(e => this._layoutInfoEmitter.fire({ outerWidth: true })));
}
abstract layoutChange(): void;
@ -78,14 +76,13 @@ export class DiffElementPlaceholderViewModel extends DiffElementViewModelBase {
}
get totalHeight() {
return 50;
return 24;
}
getHeight(lineHeight: number): number {
getHeight(_: number): number {
return this.totalHeight;
}
override layoutChange(): void {
//
console.log('layout change in placeholder');
}
showHiddenCells() {
this._unfoldHiddenCells.fire();
@ -222,9 +219,7 @@ export abstract class DiffElementCellViewModelBase extends DiffElementViewModelB
this.metadataFoldingState = PropertyFoldingState.Collapsed;
this.outputFoldingState = PropertyFoldingState.Collapsed;
this._register(this.editorEventDispatcher.onDidChangeLayout(e => {
this._layoutInfoEmitter.fire({ outerWidth: true });
}));
this._register(this.editorEventDispatcher.onDidChangeLayout(e => this._layoutInfoEmitter.fire({ outerWidth: true })));
}
layoutChange() {

View file

@ -436,9 +436,6 @@
background: var(--vscode-diffEditor-unchangedRegionBackground);
color: var(--vscode-diffEditor-unchangedRegionForeground);
min-height: 24px;
/* font-size: 13px;
line-height: 14px; */
}
.notebook-text-diff-editor .cell-placeholder-body div.diff-hidden-cells .center {

View file

@ -102,7 +102,6 @@ export class CellDiffPlaceholderRenderer implements IListRenderer<DiffElementPla
disposeTemplate(templateData: CellDiffPlaceholderRenderTemplate): void {
templateData.container.innerText = '';
templateData.elementDisposables.dispose();
}
disposeElement(element: DiffElementPlaceholderViewModel, index: number, templateData: CellDiffPlaceholderRenderTemplate): void {