forked from qt-creator/qt-creator
TextEditor: Move some enums to namespace scope
In preparation for the final s/BaseTextEditor/TextEditor. Change-Id: Ie18db9817ec9eec53d805443605ca55423c64c93 Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
@@ -849,9 +849,9 @@ void BookmarkManager::loadBookmarks()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BookmarkManager::handleBookmarkRequest(TextEditorWidget *widget, int line,
|
void BookmarkManager::handleBookmarkRequest(TextEditorWidget *widget, int line,
|
||||||
BaseTextEditor::MarkRequestKind kind)
|
TextMarkRequestKind kind)
|
||||||
{
|
{
|
||||||
if (kind == BaseTextEditor::BookmarkRequest && widget->textDocument())
|
if (kind == BookmarkRequest && widget->textDocument())
|
||||||
toggleBookmark(widget->textDocument()->filePath(), line);
|
toggleBookmark(widget->textDocument()->filePath(), line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -94,7 +94,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
void handleBookmarkRequest(TextEditor::TextEditorWidget *widget, int line,
|
void handleBookmarkRequest(TextEditor::TextEditorWidget *widget, int line,
|
||||||
TextEditor::BaseTextEditor::MarkRequestKind kind);
|
TextEditor::TextMarkRequestKind kind);
|
||||||
|
|
||||||
void handleBookmarkTooltipRequest(TextEditor::TextEditorWidget *widget,
|
void handleBookmarkTooltipRequest(TextEditor::TextEditorWidget *widget,
|
||||||
const QPoint &pos, int line);
|
const QPoint &pos, int line);
|
||||||
|
@@ -235,12 +235,11 @@ AssistInterface *ClangCompletionAssistProvider::createAssistInterface(
|
|||||||
// ------------------------
|
// ------------------------
|
||||||
// ClangAssistProposalModel
|
// ClangAssistProposalModel
|
||||||
// ------------------------
|
// ------------------------
|
||||||
class ClangAssistProposalModel : public TextEditor::GenericProposalModel
|
class ClangAssistProposalModel : public GenericProposalModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ClangAssistProposalModel()
|
ClangAssistProposalModel()
|
||||||
: TextEditor::GenericProposalModel()
|
: m_sortable(false)
|
||||||
, m_sortable(false)
|
|
||||||
, m_completionOperator(T_EOF_SYMBOL)
|
, m_completionOperator(T_EOF_SYMBOL)
|
||||||
, m_replaceDotForArrow(false)
|
, m_replaceDotForArrow(false)
|
||||||
{}
|
{}
|
||||||
@@ -254,11 +253,11 @@ public:
|
|||||||
// -------------------
|
// -------------------
|
||||||
// ClangAssistProposal
|
// ClangAssistProposal
|
||||||
// -------------------
|
// -------------------
|
||||||
class ClangAssistProposal : public TextEditor::GenericProposal
|
class ClangAssistProposal : public GenericProposal
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ClangAssistProposal(int cursorPos, TextEditor::GenericProposalModel *model)
|
ClangAssistProposal(int cursorPos, GenericProposalModel *model)
|
||||||
: TextEditor::GenericProposal(cursorPos, model)
|
: GenericProposal(cursorPos, model)
|
||||||
, m_replaceDotForArrow(static_cast<ClangAssistProposalModel *>(model)->m_replaceDotForArrow)
|
, m_replaceDotForArrow(static_cast<ClangAssistProposalModel *>(model)->m_replaceDotForArrow)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@@ -277,7 +276,7 @@ private:
|
|||||||
// ----------------------
|
// ----------------------
|
||||||
// ClangFunctionHintModel
|
// ClangFunctionHintModel
|
||||||
// ----------------------
|
// ----------------------
|
||||||
class ClangFunctionHintModel : public TextEditor::IFunctionHintProposalModel
|
class ClangFunctionHintModel : public IFunctionHintProposalModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ClangFunctionHintModel(const QList<CodeCompletionResult> functionSymbols)
|
ClangFunctionHintModel(const QList<CodeCompletionResult> functionSymbols)
|
||||||
@@ -345,13 +344,13 @@ int ClangFunctionHintModel::activeArgument(const QString &prefix) const
|
|||||||
return argnr;
|
return argnr;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ClangAssistProposalItem : public TextEditor::AssistProposalItem
|
class ClangAssistProposalItem : public AssistProposalItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ClangAssistProposalItem() {}
|
ClangAssistProposalItem() {}
|
||||||
|
|
||||||
virtual bool prematurelyApplies(const QChar &c) const;
|
virtual bool prematurelyApplies(const QChar &c) const;
|
||||||
virtual void applyContextualContent(TextEditor::TextEditorWidget *editorWidget,
|
virtual void applyContextualContent(TextEditorWidget *editorWidget,
|
||||||
int basePosition) const;
|
int basePosition) const;
|
||||||
|
|
||||||
void keepCompletionOperator(unsigned compOp) { m_completionOperator = compOp; }
|
void keepCompletionOperator(unsigned compOp) { m_completionOperator = compOp; }
|
||||||
@@ -508,7 +507,7 @@ void ClangAssistProposalItem::applyContextualContent(TextEditorWidget *editorWid
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Avoid inserting characters that are already there
|
// Avoid inserting characters that are already there
|
||||||
const int endsPosition = editorWidget->position(TextEditor::BaseTextEditor::EndOfLine);
|
const int endsPosition = editorWidget->position(EndOfLinePosition);
|
||||||
const QString existingText = editorWidget->textAt(editorWidget->position(), endsPosition - editorWidget->position());
|
const QString existingText = editorWidget->textAt(editorWidget->position(), endsPosition - editorWidget->position());
|
||||||
int existLength = 0;
|
int existLength = 0;
|
||||||
if (!existingText.isEmpty()) {
|
if (!existingText.isEmpty()) {
|
||||||
|
@@ -301,7 +301,7 @@ void CppAssistProposalItem::applyContextualContent(TextEditorWidget *editorWidge
|
|||||||
|
|
||||||
// Determine the length of characters that should just be kept on the editor, but do
|
// Determine the length of characters that should just be kept on the editor, but do
|
||||||
// not consider content that ends as an identifier (which could be undesired).
|
// not consider content that ends as an identifier (which could be undesired).
|
||||||
const int lineEnd = editorWidget->position(BaseTextEditor::EndOfLine);
|
const int lineEnd = editorWidget->position(EndOfLinePosition);
|
||||||
const QString inEditor = editorWidget->textAt(editorWidget->position(), lineEnd - editorWidget->position());
|
const QString inEditor = editorWidget->textAt(editorWidget->position(), lineEnd - editorWidget->position());
|
||||||
int preserveLength = 0;
|
int preserveLength = 0;
|
||||||
if (!inEditor.isEmpty()) {
|
if (!inEditor.isEmpty()) {
|
||||||
|
@@ -836,7 +836,7 @@ public slots:
|
|||||||
void updateBreakMenuItem(Core::IEditor *editor);
|
void updateBreakMenuItem(Core::IEditor *editor);
|
||||||
void setBusyCursor(bool busy);
|
void setBusyCursor(bool busy);
|
||||||
void requestMark(TextEditor::TextEditorWidget *widget, int lineNumber,
|
void requestMark(TextEditor::TextEditorWidget *widget, int lineNumber,
|
||||||
TextEditor::BaseTextEditor::MarkRequestKind kind);
|
TextEditor::TextMarkRequestKind kind);
|
||||||
void requestContextMenu(TextEditor::TextEditorWidget *widget,
|
void requestContextMenu(TextEditor::TextEditorWidget *widget,
|
||||||
int lineNumber, QMenu *menu);
|
int lineNumber, QMenu *menu);
|
||||||
|
|
||||||
@@ -2039,9 +2039,9 @@ void DebuggerPluginPrivate::toggleBreakpointByAddress(quint64 address,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPluginPrivate::requestMark(TextEditorWidget *widget, int lineNumber,
|
void DebuggerPluginPrivate::requestMark(TextEditorWidget *widget, int lineNumber,
|
||||||
BaseTextEditor::MarkRequestKind kind)
|
TextMarkRequestKind kind)
|
||||||
{
|
{
|
||||||
if (kind != BaseTextEditor::BreakpointRequest)
|
if (kind != BreakpointRequest)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TextDocument *document = widget->textDocument();
|
TextDocument *document = widget->textDocument();
|
||||||
|
@@ -155,7 +155,7 @@ void QmakeManager::addLibrary(const QString &fileName, BaseTextEditor *editor)
|
|||||||
if (!editor)
|
if (!editor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const int endOfDoc = editor->position(BaseTextEditor::EndOfDoc);
|
const int endOfDoc = editor->position(EndOfDocPosition);
|
||||||
editor->setCursorPosition(endOfDoc);
|
editor->setCursorPosition(endOfDoc);
|
||||||
QString snippet = wizard.snippet();
|
QString snippet = wizard.snippet();
|
||||||
|
|
||||||
|
@@ -2448,28 +2448,28 @@ void TextEditorWidget::gotoLine(int line, int column, bool centerLine)
|
|||||||
d->saveCurrentCursorPositionForNavigation();
|
d->saveCurrentCursorPositionForNavigation();
|
||||||
}
|
}
|
||||||
|
|
||||||
int TextEditorWidget::position(BaseTextEditor::PositionOperation posOp, int at) const
|
int TextEditorWidget::position(TextPositionOperation posOp, int at) const
|
||||||
{
|
{
|
||||||
QTextCursor tc = textCursor();
|
QTextCursor tc = textCursor();
|
||||||
|
|
||||||
if (at != -1)
|
if (at != -1)
|
||||||
tc.setPosition(at);
|
tc.setPosition(at);
|
||||||
|
|
||||||
if (posOp == BaseTextEditor::Current)
|
if (posOp == CurrentPosition)
|
||||||
return tc.position();
|
return tc.position();
|
||||||
|
|
||||||
switch (posOp) {
|
switch (posOp) {
|
||||||
case BaseTextEditor::EndOfLine:
|
case EndOfLinePosition:
|
||||||
tc.movePosition(QTextCursor::EndOfLine);
|
tc.movePosition(QTextCursor::EndOfLine);
|
||||||
return tc.position();
|
return tc.position();
|
||||||
case BaseTextEditor::StartOfLine:
|
case StartOfLinePosition:
|
||||||
tc.movePosition(QTextCursor::StartOfLine);
|
tc.movePosition(QTextCursor::StartOfLine);
|
||||||
return tc.position();
|
return tc.position();
|
||||||
case BaseTextEditor::Anchor:
|
case AnchorPosition:
|
||||||
if (tc.hasSelection())
|
if (tc.hasSelection())
|
||||||
return tc.anchor();
|
return tc.anchor();
|
||||||
break;
|
break;
|
||||||
case BaseTextEditor::EndOfDoc:
|
case EndOfDocPosition:
|
||||||
tc.movePosition(QTextCursor::End);
|
tc.movePosition(QTextCursor::End);
|
||||||
return tc.position();
|
return tc.position();
|
||||||
default:
|
default:
|
||||||
@@ -5087,11 +5087,11 @@ void TextEditorWidget::extraAreaMouseEvent(QMouseEvent *e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
int line = n + 1;
|
int line = n + 1;
|
||||||
BaseTextEditor::MarkRequestKind kind;
|
TextMarkRequestKind kind;
|
||||||
if (QApplication::keyboardModifiers() & Qt::ShiftModifier)
|
if (QApplication::keyboardModifiers() & Qt::ShiftModifier)
|
||||||
kind = BaseTextEditor::BookmarkRequest;
|
kind = BookmarkRequest;
|
||||||
else
|
else
|
||||||
kind = BaseTextEditor::BreakpointRequest;
|
kind = BreakpointRequest;
|
||||||
|
|
||||||
emit markRequested(this, line, kind);
|
emit markRequested(this, line, kind);
|
||||||
}
|
}
|
||||||
@@ -5224,8 +5224,8 @@ void TextEditorWidgetPrivate::handleBackspaceKey()
|
|||||||
cursorWithinSnippet = snippetCheckCursor(snippetCursor);
|
cursorWithinSnippet = snippetCheckCursor(snippetCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
const TextEditor::TabSettings &tabSettings = m_document->tabSettings();
|
const TabSettings &tabSettings = m_document->tabSettings();
|
||||||
const TextEditor::TypingSettings &typingSettings = m_document->typingSettings();
|
const TypingSettings &typingSettings = m_document->typingSettings();
|
||||||
|
|
||||||
if (typingSettings.m_autoIndent && m_autoCompleter->autoBackspace(cursor))
|
if (typingSettings.m_autoIndent && m_autoCompleter->autoBackspace(cursor))
|
||||||
return;
|
return;
|
||||||
@@ -6154,7 +6154,7 @@ void TextEditorWidget::setMarginSettings(const MarginSettings &ms)
|
|||||||
extraArea()->update();
|
extraArea()->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextEditorWidget::setBehaviorSettings(const TextEditor::BehaviorSettings &bs)
|
void TextEditorWidget::setBehaviorSettings(const BehaviorSettings &bs)
|
||||||
{
|
{
|
||||||
d->m_behaviorSettings = bs;
|
d->m_behaviorSettings = bs;
|
||||||
}
|
}
|
||||||
@@ -6169,7 +6169,7 @@ void TextEditorWidget::setStorageSettings(const StorageSettings &storageSettings
|
|||||||
d->m_document->setStorageSettings(storageSettings);
|
d->m_document->setStorageSettings(storageSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextEditorWidget::setCompletionSettings(const TextEditor::CompletionSettings &completionSettings)
|
void TextEditorWidget::setCompletionSettings(const CompletionSettings &completionSettings)
|
||||||
{
|
{
|
||||||
d->m_autoCompleter->setAutoParenthesesEnabled(completionSettings.m_autoInsertBrackets);
|
d->m_autoCompleter->setAutoParenthesesEnabled(completionSettings.m_autoInsertBrackets);
|
||||||
d->m_autoCompleter->setSurroundWithEnabled(completionSettings.m_autoInsertBrackets
|
d->m_autoCompleter->setSurroundWithEnabled(completionSettings.m_autoInsertBrackets
|
||||||
@@ -6588,7 +6588,7 @@ void TextEditorWidget::appendStandardContextMenuActions(QMenu *menu)
|
|||||||
BaseTextEditor::BaseTextEditor()
|
BaseTextEditor::BaseTextEditor()
|
||||||
: d(new BaseTextEditorPrivate)
|
: d(new BaseTextEditorPrivate)
|
||||||
{
|
{
|
||||||
addContext(TextEditor::Constants::C_TEXTEDITOR);
|
addContext(Constants::C_TEXTEDITOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseTextEditor::~BaseTextEditor()
|
BaseTextEditor::~BaseTextEditor()
|
||||||
@@ -6660,7 +6660,7 @@ int BaseTextEditor::rowCount() const
|
|||||||
return editorWidget()->rowCount();
|
return editorWidget()->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
int BaseTextEditor::position(BaseTextEditor::PositionOperation posOp, int at) const
|
int BaseTextEditor::position(TextPositionOperation posOp, int at) const
|
||||||
{
|
{
|
||||||
return editorWidget()->position(posOp, at);
|
return editorWidget()->position(posOp, at);
|
||||||
}
|
}
|
||||||
@@ -7067,7 +7067,7 @@ bool BaseTextEditor::open(QString *errorString, const QString &fileName, const Q
|
|||||||
{
|
{
|
||||||
if (!editorWidget()->open(errorString, fileName, realFileName))
|
if (!editorWidget()->open(errorString, fileName, realFileName))
|
||||||
return false;
|
return false;
|
||||||
textDocument()->setMimeType(Core::MimeDatabase::findByFile(QFileInfo(fileName)).type());
|
textDocument()->setMimeType(MimeDatabase::findByFile(QFileInfo(fileName)).type());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7187,7 +7187,7 @@ void TextEditorWidget::setupAsPlainEditor()
|
|||||||
setMarksVisible(true);
|
setMarksVisible(true);
|
||||||
setLineSeparatorsAllowed(true);
|
setLineSeparatorsAllowed(true);
|
||||||
|
|
||||||
textDocument()->setMimeType(QLatin1String(TextEditor::Constants::C_TEXTEDITOR_MIMETYPE_TEXT));
|
textDocument()->setMimeType(QLatin1String(Constants::C_TEXTEDITOR_MIMETYPE_TEXT));
|
||||||
|
|
||||||
connect(textDocument(), &IDocument::filePathChanged,
|
connect(textDocument(), &IDocument::filePathChanged,
|
||||||
d, &TextEditorWidgetPrivate::reconfigure);
|
d, &TextEditorWidgetPrivate::reconfigure);
|
||||||
@@ -7258,8 +7258,8 @@ void TextEditorFactory::setSyntaxHighlighterCreator(const SyntaxHighLighterCreat
|
|||||||
void TextEditorFactory::setGenericSyntaxHighlighter(const QString &mimeType)
|
void TextEditorFactory::setGenericSyntaxHighlighter(const QString &mimeType)
|
||||||
{
|
{
|
||||||
m_syntaxHighlighterCreator = [this, mimeType]() -> SyntaxHighlighter * {
|
m_syntaxHighlighterCreator = [this, mimeType]() -> SyntaxHighlighter * {
|
||||||
Highlighter *highlighter = new TextEditor::Highlighter();
|
Highlighter *highlighter = new Highlighter;
|
||||||
setMimeTypeForHighlighter(highlighter, Core::MimeDatabase::findByType(mimeType));
|
setMimeTypeForHighlighter(highlighter, MimeDatabase::findByType(mimeType));
|
||||||
return highlighter;
|
return highlighter;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -112,30 +112,32 @@ private:
|
|||||||
int _last;
|
int _last;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum TextPositionOperation
|
||||||
|
{
|
||||||
|
CurrentPosition = 1,
|
||||||
|
EndOfLinePosition = 2,
|
||||||
|
StartOfLinePosition = 3,
|
||||||
|
AnchorPosition = 4,
|
||||||
|
EndOfDocPosition = 5
|
||||||
|
};
|
||||||
|
|
||||||
|
enum TextMarkRequestKind
|
||||||
|
{
|
||||||
|
BreakpointRequest,
|
||||||
|
BookmarkRequest,
|
||||||
|
TaskMarkRequest
|
||||||
|
};
|
||||||
|
|
||||||
class TEXTEDITOR_EXPORT BaseTextEditor : public Core::IEditor
|
class TEXTEDITOR_EXPORT BaseTextEditor : public Core::IEditor
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum PositionOperation {
|
|
||||||
Current = 1,
|
|
||||||
EndOfLine = 2,
|
|
||||||
StartOfLine = 3,
|
|
||||||
Anchor = 4,
|
|
||||||
EndOfDoc = 5
|
|
||||||
};
|
|
||||||
|
|
||||||
BaseTextEditor();
|
BaseTextEditor();
|
||||||
~BaseTextEditor();
|
~BaseTextEditor();
|
||||||
|
|
||||||
virtual void finalizeInitialization() {}
|
virtual void finalizeInitialization() {}
|
||||||
|
|
||||||
enum MarkRequestKind {
|
|
||||||
BreakpointRequest,
|
|
||||||
BookmarkRequest,
|
|
||||||
TaskMarkRequest
|
|
||||||
};
|
|
||||||
|
|
||||||
static BaseTextEditor *currentTextEditor();
|
static BaseTextEditor *currentTextEditor();
|
||||||
|
|
||||||
TextEditorWidget *editorWidget() const;
|
TextEditorWidget *editorWidget() const;
|
||||||
@@ -174,7 +176,7 @@ public:
|
|||||||
int rowCount() const;
|
int rowCount() const;
|
||||||
|
|
||||||
/*! Returns the position at \a posOp in characters from the beginning of the document */
|
/*! Returns the position at \a posOp in characters from the beginning of the document */
|
||||||
virtual int position(PositionOperation posOp = Current, int at = -1) const;
|
virtual int position(TextPositionOperation posOp = CurrentPosition, int at = -1) const;
|
||||||
|
|
||||||
/*! Converts the \a pos in characters from beginning of document to \a line and \a column */
|
/*! Converts the \a pos in characters from beginning of document to \a line and \a column */
|
||||||
virtual void convertPosition(int pos, int *line, int *column) const;
|
virtual void convertPosition(int pos, int *line, int *column) const;
|
||||||
@@ -220,7 +222,7 @@ public:
|
|||||||
QByteArray saveState() const;
|
QByteArray saveState() const;
|
||||||
bool restoreState(const QByteArray &state);
|
bool restoreState(const QByteArray &state);
|
||||||
void gotoLine(int line, int column = 0, bool centerLine = true);
|
void gotoLine(int line, int column = 0, bool centerLine = true);
|
||||||
int position(BaseTextEditor::PositionOperation posOp = BaseTextEditor::Current,
|
int position(TextPositionOperation posOp = CurrentPosition,
|
||||||
int at = -1) const;
|
int at = -1) const;
|
||||||
void convertPosition(int pos, int *line, int *column) const;
|
void convertPosition(int pos, int *line, int *column) const;
|
||||||
using QPlainTextEdit::cursorRect;
|
using QPlainTextEdit::cursorRect;
|
||||||
@@ -592,7 +594,7 @@ protected:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void markRequested(TextEditor::TextEditorWidget *widget,
|
void markRequested(TextEditor::TextEditorWidget *widget,
|
||||||
int line, TextEditor::BaseTextEditor::MarkRequestKind kind);
|
int line, TextEditor::TextMarkRequestKind kind);
|
||||||
void markContextMenuRequested(TextEditor::TextEditorWidget *widget,
|
void markContextMenuRequested(TextEditor::TextEditorWidget *widget,
|
||||||
int line, QMenu *menu);
|
int line, QMenu *menu);
|
||||||
void tooltipOverrideRequested(TextEditor::TextEditorWidget *widget,
|
void tooltipOverrideRequested(TextEditor::TextEditorWidget *widget,
|
||||||
|
@@ -211,18 +211,18 @@ void TextEditorPlugin::updateSearchResultsFont(const FontSettings &settings)
|
|||||||
{
|
{
|
||||||
if (auto window = SearchResultWindow::instance()) {
|
if (auto window = SearchResultWindow::instance()) {
|
||||||
window->setTextEditorFont(QFont(settings.family(), settings.fontSize() * settings.fontZoom() / 100),
|
window->setTextEditorFont(QFont(settings.family(), settings.fontSize() * settings.fontZoom() / 100),
|
||||||
settings.formatFor(TextEditor::C_TEXT).foreground(),
|
settings.formatFor(C_TEXT).foreground(),
|
||||||
settings.formatFor(TextEditor::C_TEXT).background(),
|
settings.formatFor(C_TEXT).background(),
|
||||||
settings.formatFor(TextEditor::C_SEARCH_RESULT).foreground(),
|
settings.formatFor(C_SEARCH_RESULT).foreground(),
|
||||||
settings.formatFor(TextEditor::C_SEARCH_RESULT).background());
|
settings.formatFor(C_SEARCH_RESULT).background());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextEditorPlugin::updateCurrentSelection(const QString &text)
|
void TextEditorPlugin::updateCurrentSelection(const QString &text)
|
||||||
{
|
{
|
||||||
if (BaseTextEditor *editor = qobject_cast<BaseTextEditor *>(EditorManager::currentEditor())) {
|
if (BaseTextEditor *editor = BaseTextEditor::currentTextEditor()) {
|
||||||
const int pos = editor->position();
|
const int pos = editor->position();
|
||||||
int anchor = editor->position(BaseTextEditor::Anchor);
|
int anchor = editor->position(AnchorPosition);
|
||||||
if (anchor < 0) // no selection
|
if (anchor < 0) // no selection
|
||||||
anchor = pos;
|
anchor = pos;
|
||||||
int selectionLength = pos - anchor;
|
int selectionLength = pos - anchor;
|
||||||
|
Reference in New Issue
Block a user