File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
OMEdit/OMEdit/OMEditGUI/Editors Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -1583,8 +1583,13 @@ void PlainTextEdit::insertCompletionItem(const QModelIndex &index)
15831583 QStringList completionlength = completerItem.mValue .split (" \n " );
15841584 QTextCursor cursor = textCursor ();
15851585 cursor.beginEditBlock ();
1586- int extra = completionlength[0 ].length () - mpCompleter->completionPrefix ().length ();
1587- cursor.insertText (completionlength[0 ].right (extra));
1586+ /* Ticket #5333#comment:7. Since we allow case insensitive matching so we have to replace the whole word with
1587+ * completion text instead of just completing it.
1588+ */
1589+ cursor.setPosition (cursor.position (), QTextCursor::MoveAnchor);
1590+ cursor.setPosition (cursor.position () - mpCompleter->completionPrefix ().length (), QTextCursor::KeepAnchor);
1591+ cursor.removeSelectedText ();
1592+ cursor.insertText (completionlength[0 ]);
15881593 // store the cursor position to be used for selecting text when inserting code snippets
15891594 int currentpos = cursor.position ();
15901595 int startpos = currentpos-completionlength[0 ].length ();
You can’t perform that action at this time.
0 commit comments