From e305512e58c726ef1855ffec4af69c90cfc9e396 Mon Sep 17 00:00:00 2001 From: mitchell Date: Thu, 11 Jul 2019 12:49:28 -0400 Subject: Backport: Feature [feature-requests:#1293]. InsertCharacter replaces AddCharUTF. Backport of changeset 7575:e1e9f53b0423. --- qt/ScintillaEditBase/ScintillaEditBase.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'qt/ScintillaEditBase/ScintillaEditBase.cpp') diff --git a/qt/ScintillaEditBase/ScintillaEditBase.cpp b/qt/ScintillaEditBase/ScintillaEditBase.cpp index d7f25dbdc..ea65fb1d3 100644 --- a/qt/ScintillaEditBase/ScintillaEditBase.cpp +++ b/qt/ScintillaEditBase/ScintillaEditBase.cpp @@ -259,7 +259,7 @@ void ScintillaEditBase::keyPressEvent(QKeyEvent *event) QString text = event->text(); if (input && !text.isEmpty() && text[0].isPrint()) { QByteArray utext = sqt->BytesForDocument(text); - sqt->AddCharUTF(utext.data(), utext.size()); + sqt->InsertCharacter(utext.data(), utext.size()); } else { event->ignore(); } @@ -450,7 +450,7 @@ void ScintillaEditBase::DrawImeIndicator(int indicator, int len) { // Emulate the visual style of IME characters with indicators. // Draw an indicator on the character before caret by the character bytes of len - // so it should be called after AddCharUTF(). + // so it should be called after InsertCharacter(). // It does not affect caret positions. if (indicator < 8 || indicator > INDIC_MAX) { return; @@ -548,9 +548,8 @@ void ScintillaEditBase::inputMethodEvent(QInputMethodEvent *event) const unsigned int ucWidth = commitStr.at(i).isHighSurrogate() ? 2 : 1; const QString oneCharUTF16 = commitStr.mid(i, ucWidth); const QByteArray oneChar = sqt->BytesForDocument(oneCharUTF16); - const int oneCharLen = oneChar.length(); - sqt->AddCharUTF(oneChar.data(), oneCharLen); + sqt->InsertCharacter(oneChar.data(), oneChar.length()); i += ucWidth; } @@ -576,7 +575,7 @@ void ScintillaEditBase::inputMethodEvent(QInputMethodEvent *event) const QByteArray oneChar = sqt->BytesForDocument(oneCharUTF16); const int oneCharLen = oneChar.length(); - sqt->AddCharUTF(oneChar.data(), oneCharLen); + sqt->InsertCharacter(oneChar.data(), oneCharLen); DrawImeIndicator(imeIndicator[i], oneCharLen); i += ucWidth; -- cgit v1.2.3