Commit 26a33037 authored by Laurent Montel's avatar Laurent Montel 😁

Merge remote-tracking branch 'origin/release/20.04'

parents 96f597d5 687eeb50
Pipeline #26159 passed with stage
in 10 minutes and 33 seconds
...@@ -482,17 +482,21 @@ void AutoCorrection::addNonBreakingSpace() ...@@ -482,17 +482,21 @@ void AutoCorrection::addNonBreakingSpace()
} }
} else { } else {
//°C (degres) //°C (degres)
const QChar previousChar = text.at(mCursor.position() - 2 - block.position()); const int pos = mCursor.position() - 2 - block.position();
if (lastChar == QLatin1Char('C') && previousChar == QChar(0x000B0)) { if (pos >= 0) {
const int pos = mCursor.position() - 3 - block.position(); const QChar previousChar = text.at(pos);
if (pos >= 0) {
const QChar previousChar = text.at(pos); if (lastChar == QLatin1Char('C') && previousChar == QChar(0x000B0)) {
if (previousChar.isSpace()) { const int pos = mCursor.position() - 3 - block.position();
QTextCursor cursor(mCursor); if (pos >= 0) {
cursor.setPosition(pos); const QChar previousChar = text.at(pos);
cursor.setPosition(pos + 1, QTextCursor::KeepAnchor); if (previousChar.isSpace()) {
cursor.deleteChar(); QTextCursor cursor(mCursor);
mCursor.insertText(mNonBreakingSpace); cursor.setPosition(pos);
cursor.setPosition(pos + 1, QTextCursor::KeepAnchor);
cursor.deleteChar();
mCursor.insertText(mNonBreakingSpace);
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment