forked from qt-creator/qt-creator
TextEditors: Separate away methods that actually work on a document
Introduces ITextEditorDocument. This is part of a more general "use documents instead of editors whereever possible". It will allow to move to e.g. ITextEditor::openedTextDocumentContents() instead of ITextEditor::openedTextEditorsContents(). Change-Id: I5ebceaa257a0d2c3e8ac4ac51b9b08b6faa42487 Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
@@ -374,7 +374,7 @@ void QmlJSAssistProposalItem::applyContextualContent(TextEditor::BaseTextEditor
|
||||
int replacedLength = 0;
|
||||
for (int i = 0; i < replaceable.length(); ++i) {
|
||||
const QChar a = replaceable.at(i);
|
||||
const QChar b = editor->characterAt(editor->position() + i);
|
||||
const QChar b = editor->textDocument()->characterAt(editor->position() + i);
|
||||
if (a == b)
|
||||
++replacedLength;
|
||||
else
|
||||
|
||||
@@ -1001,7 +1001,7 @@ void QmlJSTextEditorWidget::setFontSettings(const TextEditor::FontSettings &fs)
|
||||
QString QmlJSTextEditorWidget::wordUnderCursor() const
|
||||
{
|
||||
QTextCursor tc = textCursor();
|
||||
const QChar ch = characterAt(tc.position() - 1);
|
||||
const QChar ch = document()->characterAt(tc.position() - 1);
|
||||
// make sure that we're not at the start of the next word.
|
||||
if (ch.isLetterOrNumber() || ch == QLatin1Char('_'))
|
||||
tc.movePosition(QTextCursor::Left);
|
||||
|
||||
@@ -214,7 +214,7 @@ void HoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos)
|
||||
i = j = pos;
|
||||
QString nameAtt;
|
||||
for (;;) {
|
||||
QChar c = qmlEditor->characterAt(j);
|
||||
QChar c = qmlEditor->document()->characterAt(j);
|
||||
if (!c.isLetterOrNumber()) break;
|
||||
nameAtt.append(c);
|
||||
++j;
|
||||
@@ -222,7 +222,7 @@ void HoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos)
|
||||
QStringList qName;
|
||||
while (i>0) {
|
||||
--i;
|
||||
QChar c = qmlEditor->characterAt(i);
|
||||
QChar c = qmlEditor->document()->characterAt(i);
|
||||
if (c.isLetterOrNumber()) {
|
||||
nameAtt.prepend(c);
|
||||
} else if (c == QLatin1Char('.')) {
|
||||
|
||||
Reference in New Issue
Block a user