fix: refresh scroller layout when tool confirmation dialog is cancelled#254
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates the cancel-confirmation UI flow so the chat panel properly collapses after a tool invocation is canceled, even when no further messages arrive to trigger another layout pass.
Changes:
- After cancellation, traverses ancestor composites to find the
ChatContentViewer. - Calls
ChatContentViewer.refreshScrollerLayout()to recompute the scroller’s minimum size so the panel can shrink.
|
Thanks for tracking down the root cause. I agree that the missing piece is recomputing the I would prefer not to inject a layout callback into
That should fix the stuck subagent panel for cancel, accept, and programmatic cancellation uniformly, while keeping scroller-specific behavior out of |
When the user cancels a subagent tool confirmation dialog, the subagent panel stays expanded at its pre-cancel height. This happens because cancelConfirmation() only called parent.layout() (relaying the turn widget's children), but never updated the ScrolledComposite's minimum size via refreshScrollerLayout(). On the Continue path this goes unnoticed because subsequent subagent messages trigger a layout refresh; on the Cancel path no further messages arrive, so the panel is stuck. Fix by passing a Runnable callback from BaseTurnWidget into the dialog at construction time. BaseTurnWidget walks up the ancestor chain once to find ChatContentViewer and captures refreshScrollerLayout() as the callback. cancelConfirmation() calls it after disposal, which recomputes setMinHeight() in a single layout pass and collapses the panel correctly. This also removes the redundant parent.layout() call that preceded the deep layout(true,true) inside refreshScrollerLayout(). Fixes microsoft#169
40f0998 to
82643d2
Compare
When the user cancels a subagent tool confirmation dialog, the subagent panel stays expanded at its pre-cancel height. This happens because cancelConfirmation() only called parent.layout() (relaying the turn widget's children), but never updated the ScrolledComposite's minimum size via refreshScrollerLayout(). On the Continue path this goes unnoticed because subsequent subagent messages trigger a layout refresh; on the Cancel path no further messages arrive, so the panel is stuck. Fix by adding a dispose listener on the dialog in BaseTurnWidget that walks up to the nearest ChatContentViewer and calls requestRefreshScrollerLayout(), a new coalesced async helper that schedules a single refreshScrollerLayout() after pending SWT mutations settle. InvokeToolConfirmationDialog remains self-contained: both the accept and cancel paths use a private disposeAndRequestParentLayout() helper, keeping scroller-specific behaviour out of the dialog. Fixes microsoft#169
|
@jdneo Thanks for the detailed feedback — that's a much cleaner split of responsibilities. I've updated the implementation:
|
jdneo
left a comment
There was a problem hiding this comment.
Thank you for your contribution!
Summary
cancelConfirmation()callsparent.layout()(relays the turn widget's children) but never updates theScrolledComposite's minimum size viarefreshScrollerLayout()Fix
Pass a
Runnablecallback fromBaseTurnWidgetintoInvokeToolConfirmationDialogat construction.BaseTurnWidgetwalks up the ancestor chain once to findChatContentViewerand capturesrefreshScrollerLayout()as the callback.cancelConfirmation()calls it after disposal, which recomputessetMinHeight()in a single layout pass and collapses the panel correctly. This also removes the redundantparent.layout()call that preceded the deeplayout(true,true)insiderefreshScrollerLayout().Test plan
Fixes #169