fix: chat UI threading issues (fixes #730)

This commit is contained in:
Carl-Robert Linnupuu 2024-10-09 12:34:29 +03:00
parent 020e1aff7f
commit 6363053277

View file

@ -273,10 +273,10 @@ public class ChatMessageResponseBody extends JPanel {
private void processText(String markdownText, boolean caretVisible) {
var html = convertMdToHtml(markdownText);
if (currentlyProcessedTextPane == null) {
prepareProcessingText(caretVisible);
}
ApplicationManager.getApplication().invokeLater(() -> {
if (currentlyProcessedTextPane == null) {
prepareProcessingText(caretVisible);
}
currentlyProcessedTextPane.setText(html);
});
}
@ -285,17 +285,12 @@ public class ChatMessageResponseBody extends JPanel {
if (highlightedText != null
&& !highlightedText.isEmpty()
&& currentlyProcessedEditorPanel != null) {
ApplicationManager.getApplication().invokeLater(() -> {
currentlyProcessedEditorPanel.showEditorActions();
});
currentlyProcessedEditorPanel.showEditorActions();
}
currentlyProcessedEditorPanel = null;
currentlyProcessedTextPane = createTextPane("", caretVisible);
ApplicationManager.getApplication().invokeLater(() -> {
add(currentlyProcessedTextPane);
});
add(currentlyProcessedTextPane);
}
private void prepareProcessingCode(String code, String markdownLanguage) {