diff --git a/Source/Engine/Gramambular/Node.h b/Source/Engine/Gramambular/Node.h index c167083a..d4b7b432 100644 --- a/Source/Engine/Gramambular/Node.h +++ b/Source/Engine/Gramambular/Node.h @@ -90,7 +90,7 @@ namespace Formosa { , m_selectedUnigramIndex(0) , m_score(0.0) { - sort(m_unigrams.begin(), m_unigrams.end(), Unigram::ScoreCompare); + stable_sort(m_unigrams.begin(), m_unigrams.end(), Unigram::ScoreCompare); if (m_unigrams.size()) { m_score = m_unigrams[0].score; diff --git a/Source/InputMethodController.mm b/Source/InputMethodController.mm index 81a046f6..d7ad2119 100644 --- a/Source/InputMethodController.mm +++ b/Source/InputMethodController.mm @@ -1043,7 +1043,7 @@ public: vector nodes = _builder->grid().nodesCrossingOrEndingAt(cursorIndex); // sort the nodes, so that longer nodes (representing longer phrases) are placed at the top of the candidate list - sort(nodes.begin(), nodes.end(), NodeAnchorDescendingSorter()); + stable_sort(nodes.begin(), nodes.end(), NodeAnchorDescendingSorter()); // then use the C++ trick to retrieve the candidates for each node at/crossing the cursor for (vector::iterator ni = nodes.begin(), ne = nodes.end(); ni != ne; ++ni) {