diff options
Diffstat (limited to 'src/widgets/widgets/qwidgetlinecontrol.cpp')
-rw-r--r-- | src/widgets/widgets/qwidgetlinecontrol.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index c9300d3cdd..017cbee219 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -103,11 +103,11 @@ void QWidgetLineControl::updateDisplayText(bool forceUpdate) int cursor = m_cursor - 1; QChar uc = m_text.at(cursor); str[cursor] = uc; - if (cursor > 0 && uc.unicode() >= 0xdc00 && uc.unicode() < 0xe000) { + if (cursor > 0 && uc.isLowSurrogate()) { // second half of a surrogate, check if we have the first half as well, // if yes restore both at once uc = m_text.at(cursor - 1); - if (uc.unicode() >= 0xd800 && uc.unicode() < 0xdc00) + if (uc.isHighSurrogate()) str[cursor - 1] = uc; } } @@ -220,11 +220,11 @@ void QWidgetLineControl::backspace() if (m_maskData) m_cursor = prevMaskBlank(m_cursor); QChar uc = m_text.at(m_cursor); - if (m_cursor > 0 && uc.unicode() >= 0xdc00 && uc.unicode() < 0xe000) { + if (m_cursor > 0 && uc.isLowSurrogate()) { // second half of a surrogate, check if we have the first half as well, // if yes delete both at once uc = m_text.at(m_cursor - 1); - if (uc.unicode() >= 0xd800 && uc.unicode() < 0xdc00) { + if (uc.isHighSurrogate()) { internalDelete(true); --m_cursor; } |