Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/DiffEngineTray.Tests/OwnedInlineHostTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,30 @@ public async Task FocusRidesBackOnTheNextListing()
await Assert.That(second.Window).IsNull();
}

/// <summary>
/// A plain List does not take the stashed window command. It is the documented IDE plugin API
/// - InlineQueueClient.TryListKeys - and has no window to raise, so taking the command threw
/// it away: whoever asked could not act on it, and the attached viewer polling beside it never
/// raised for the new snapshot.
/// </summary>
[Test]
public async Task APlainListingLeavesTheWindowCommandForAViewer()
{
using var owner = new Owner();
owner.Queue();
var snapshot = owner.Host.List().Single();

owner.Host.Focus(snapshot);

var plain = owner.Send(new(ViewerVerb.List));
await Assert.That(plain.Window).IsNull();

// Still there for the surface that has a window
var full = owner.Send(new(ViewerVerb.ListFull));
await Assert.That(full.Window).IsEqualTo(WindowCommand.Focus);
await Assert.That(full.WindowKey).IsEqualTo(snapshot.Key);
}

[Test]
public async Task ClosingTheViewerLeavesTheQueue()
{
Expand Down
24 changes: 19 additions & 5 deletions src/DiffEngineTray/OwnedInlineHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,25 @@ ViewerResponse IQueueOwner.Listing(bool withPatches)

// Taken rather than read, so a focus happens once, on whichever viewer refreshes
// first, rather than five times a second forever.
var command = window;
var key = windowKey;
window = null;
windowKey = null;
return ViewerResponse.Listing(items, command, key, moves, deletes);
//
// Only for a listing that carries patches, which is the one a viewer asks for. A plain
// List is the documented IDE plugin API - InlineQueueClient.TryListKeys - and has no
// window to raise, so handing it the stashed command threw the command away: the
// attached viewer polling beside it never raised for the new snapshot, and the plugin
// did nothing with what it was given.
ViewerResponse response;
if (withPatches)
{
response = ViewerResponse.Listing(items, window, windowKey, moves, deletes);
window = null;
windowKey = null;
}
else
{
response = ViewerResponse.Listing(items, null, null, moves, deletes);
}

return response;
}
}

Expand Down
Loading