chatviewtextprocessor: fix missing #include and simplify sort

Signed-off-by: Jared Van Bortel <jared@nomic.ai>
This commit is contained in:
Jared Van Bortel 2024-06-28 11:46:20 -04:00 committed by AT
parent f6f265f968
commit 1712830228

View File

@ -23,6 +23,9 @@
#include <Qt> #include <Qt>
#include <QtGlobal> #include <QtGlobal>
#include <algorithm>
#include <functional>
enum Language { enum Language {
None, None,
Python, Python,
@ -1191,9 +1194,7 @@ void ChatViewTextProcessor::handleMarkdown()
if (!hasAlreadyProcessedMarkdown) { if (!hasAlreadyProcessedMarkdown) {
std::sort(codeBlockPositions.begin(), codeBlockPositions.end(), [](const QPair<int, int> &a, const QPair<int, int> &b) { std::sort(codeBlockPositions.begin(), codeBlockPositions.end(), std::greater<>());
return a.first > b.first;
});
int lastIndex = doc->characterCount() - 1; int lastIndex = doc->characterCount() - 1;
for (const auto &pos : codeBlockPositions) { for (const auto &pos : codeBlockPositions) {