Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #199927: Fix terminal tab list drag/drop selection #211482

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

MNouel
Copy link

@MNouel MNouel commented Apr 26, 2024

Issue #199927: Dragging inactive terminal task tab does not work properly

Description: Forcibly sets the dragged tab to be selected if the target instance (the tab it is getting dragged onto) was previously selected before the drag. This fixes the issue where the background color of the previously selected tab remained as the selected background color while the actually active tab was another.

Testing: Open two or more tabs, select one of them, and then drag the inactive tab over to the active tab. The tag you dragged will now become active/selected with appropriate UI.

Video: https://github.com/microsoft/vscode/assets/143637929/7e0afcff-eaba-440b-8170-692b4cd0307d

@MNouel
Copy link
Author

MNouel commented Apr 26, 2024

@microsoft-github-policy-service agree

Comment on lines +711 to +714
// Retrieve the currently active instance asynchronously
let activeInstancePromise = this._terminalService.activeInstance;
let setActiveInstance = async (instance: ITerminalInstance) => {
const activeInstance = await activeInstancePromise; // Ensure the promise is resolved before comparison.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this._terminalService.activeInstance is syunc, so this await doesn't seem to do anything.

Comment on lines +726 to +731
if (targetWasFocus) {
if (targetIndex)
this._listService.lastFocusedList?.setSelection([targetIndex]);
else
this._listService.lastFocusedList?.setSelection([0]);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the problem when dragging the second, inactive tab to the top. But not when dragging the first, inactive tab to the bottom.

@@ -707,10 +708,27 @@ class TerminalTabsDragAndDrop extends Disposable implements IListDragAndDrop<ITe
}

let focused = false;
// Retrieve the currently active instance asynchronously
let activeInstancePromise = this._terminalService.activeInstance;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a bunch of lint warnings about using const instead of let

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants