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
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,16 @@ public CompletableFuture<LanguageModelToolConfirmationResult> requestToolExecuti
reset();

this.confirmDialog = new InvokeToolConfirmationDialog(this, content, input);
this.confirmDialog.addDisposeListener(e -> {
Composite ancestor = this.getParent();
while (ancestor != null && !ancestor.isDisposed()) {
if (ancestor instanceof ChatContentViewer) {
((ChatContentViewer) ancestor).requestRefreshScrollerLayout();
break;
}
ancestor = ancestor.getParent();
}
});
CompletableFuture<LanguageModelToolConfirmationResult> toolConfirmationFuture = this.confirmDialog
.getConfirmationFuture();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,14 @@ public void renderErrorMessage(String errorMessage) {
scrollToLatestUserTurn();
}

/**
* Schedules a single async {@link #refreshScrollerLayout()} call so that multiple dispose/layout
* events that arrive in the same event-loop tick are coalesced into one pass.
*/
public void requestRefreshScrollerLayout() {
SwtUtils.invokeOnDisplayThreadAsync(() -> refreshScrollerLayout(), this);
}

/**
* Update the size of scrolled composite when there are content updates.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,7 @@ public void cancelConfirmation() {
&& StringUtils.isNotEmpty(this.cancelMessage)) {
new AgentToolCancelLabel(parent, SWT.NONE, this.cancelMessage);
}
this.dispose();
if (parent != null && !parent.isDisposed()) {
parent.requestLayout();
}
disposeAndRequestParentLayout();
}, this);
}
}
Expand Down Expand Up @@ -318,6 +315,10 @@ private void acceptAndDispose(ConfirmationAction action) {
new LanguageModelToolConfirmationResult(
ToolConfirmationResult.ACCEPT));

disposeAndRequestParentLayout();
}

private void disposeAndRequestParentLayout() {
Composite parent = this.getParent();
this.dispose();
if (parent != null && !parent.isDisposed()) {
Expand Down
Loading