Skip to content

Commit

Permalink
Fix selection direction + selection css (microsoft#228869)
Browse files Browse the repository at this point in the history
* fix selection direction + selection css

* rm todo comment
  • Loading branch information
Yoyokrazy authored Sep 17, 2024
1 parent 130a8e4 commit 2925ed9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ export class NotebookMultiCursorController extends Disposable implements INotebo
deltaEndCol: e.selection.endColumn - e.oldSelections[0].endColumn,
deltaEndLine: e.selection.endLineNumber - e.oldSelections[0].endLineNumber,
};
const translationDir = e.selection.getDirection();

this.trackedMatches.forEach(match => {
const controller = this.cursorsControllers.get(match.cellViewModel.uri);
Expand All @@ -301,7 +302,7 @@ export class NotebookMultiCursorController extends Disposable implements INotebo
const newStartLine = selection.startLineNumber + translation.deltaStartLine;
const newEndCol = selection.endColumn + translation.deltaEndCol;
const newEndLine = selection.endLineNumber + translation.deltaEndLine;
return new Selection(newStartLine, newStartCol, newEndLine, newEndCol);
return Selection.createWithDirection(newStartLine, newStartCol, newEndLine, newEndCol, translationDir);
});

controller.setSelections(new ViewModelEventsCollector(), e.source, newSelections, CursorChangeReason.Explicit);
Expand Down Expand Up @@ -615,6 +616,7 @@ export class NotebookMultiCursorController extends Disposable implements INotebo
}
controller.setSelections(new ViewModelEventsCollector(), undefined, delSelections, CursorChangeReason.Explicit);
});
this.updateLazyDecorations();
}

public async deleteRight(): Promise<void> {
Expand Down Expand Up @@ -644,6 +646,7 @@ export class NotebookMultiCursorController extends Disposable implements INotebo
}

});
this.updateLazyDecorations();
}

async undo() {
Expand Down
3 changes: 1 addition & 2 deletions src/vs/workbench/contrib/notebook/browser/media/notebook.css
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,7 @@
.nb-multicursor-selection {
top: 0;
min-width: 1.9px;
background-color: var(--vscode-notebook-symbolHighlightBackground);
/* TODO@Yoyokrazy: ^^highlight/selection color */
background-color: var(--vscode-editor-selectionBackground);

/* unsure about these two */
overflow: hidden;
Expand Down

0 comments on commit 2925ed9

Please sign in to comment.