Skip to content

Commit 2fb5223

Browse files
JanJan
Jan
authored and
Jan
committed
fix inputing special characters on OSX
1 parent d159d23 commit 2fb5223

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/qcodeedit/lib/qeditor.cpp

+11-2
Original file line numberDiff line numberDiff line change
@@ -3697,6 +3697,12 @@ void QEditor::inputMethodEvent(QInputMethodEvent* e)
36973697
}
36983698
#endif
36993699
}
3700+
// remove previous text
3701+
if(e->replacementLength()>0){
3702+
for(int k=0;k<e->replacementLength();++k){
3703+
m_cursor.deletePreviousChar();
3704+
}
3705+
}
37003706

37013707
m_cursor.insertText(e->commitString());
37023708

@@ -6148,6 +6154,7 @@ void QEditor::scrollContentsBy(int dx, int dy)
61486154
}
61496155

61506156
QVariant QEditor::inputMethodQuery(Qt::InputMethodQuery property) const {
6157+
qDebug()<<int(property);
61516158
switch(property) {
61526159
case Qt::ImCursorRectangle:
61536160
return cursorMircoFocusRect();
@@ -6158,7 +6165,7 @@ QVariant QEditor::inputMethodQuery(Qt::InputMethodQuery property) const {
61586165
case Qt::ImCursorPosition:
61596166
// TODO find out correct value: qtextcontol uses the following
61606167
//return QVariant(d->cursor.position() - block.position());
6161-
return QVariant();
6168+
return QVariant(cursor().columnNumber());
61626169
case Qt::ImSurroundingText:
61636170
return QVariant(cursor().line().text());
61646171
case Qt::ImCurrentSelection:
@@ -6168,7 +6175,9 @@ QVariant QEditor::inputMethodQuery(Qt::InputMethodQuery property) const {
61686175
case Qt::ImAnchorPosition:
61696176
// TODO find out correct value: qtextcontol uses the following
61706177
//return QVariant(qBound(0, d->cursor.anchor() - block.position(), block.length()));
6171-
return QVariant();
6178+
return QVariant(cursor().anchorColumnNumber());
6179+
case Qt::ImAbsolutePosition:
6180+
return QVariant(cursor().anchorColumnNumber());
61726181
default:
61736182
return QVariant();
61746183
}

0 commit comments

Comments
 (0)