forked from qt-creator/qt-creator
TextEditor: move struct to implementation file
Change-Id: I40ed45ff5ee1f392514e24ab17cd0c3ec7c25dc6 Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
This commit is contained in:
@@ -18,6 +18,11 @@
|
|||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
|
|
||||||
|
struct BlockPreeditData {
|
||||||
|
int position;
|
||||||
|
QString text;
|
||||||
|
};
|
||||||
|
|
||||||
class SyntaxHighlighterRunnerPrivate : public QObject
|
class SyntaxHighlighterRunnerPrivate : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -48,7 +53,7 @@ public:
|
|||||||
void changeDocument(int from,
|
void changeDocument(int from,
|
||||||
int charsRemoved,
|
int charsRemoved,
|
||||||
const QString textAdded,
|
const QString textAdded,
|
||||||
const QMap<int, SyntaxHighlighterRunner::BlockPreeditData> &blocksPreedit)
|
const QMap<int, BlockPreeditData> &blocksPreedit)
|
||||||
{
|
{
|
||||||
QTextCursor cursor(m_document);
|
QTextCursor cursor(m_document);
|
||||||
cursor.setPosition(qMin(m_document->characterCount() - 1, from + charsRemoved));
|
cursor.setPosition(qMin(m_document->characterCount() - 1, from + charsRemoved));
|
||||||
@@ -191,7 +196,7 @@ void SyntaxHighlighterRunner::changeDocument(int from, int charsRemoved, int cha
|
|||||||
{
|
{
|
||||||
QTC_ASSERT(m_document, return);
|
QTC_ASSERT(m_document, return);
|
||||||
m_syntaxInfoUpdated = SyntaxHighlighter::State::InProgress;
|
m_syntaxInfoUpdated = SyntaxHighlighter::State::InProgress;
|
||||||
QMap<int, SyntaxHighlighterRunner::BlockPreeditData> blocksPreedit;
|
QMap<int, BlockPreeditData> blocksPreedit;
|
||||||
QTextBlock block = m_document->findBlock(from);
|
QTextBlock block = m_document->findBlock(from);
|
||||||
const QTextBlock endBlock = m_document->findBlock(from + charsAdded);
|
const QTextBlock endBlock = m_document->findBlock(from + charsAdded);
|
||||||
while (block.isValid() && block != endBlock) {
|
while (block.isValid() && block != endBlock) {
|
||||||
|
@@ -25,10 +25,6 @@ class TEXTEDITOR_EXPORT SyntaxHighlighterRunner : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
using SyntaxHighlighterCreator = std::function<SyntaxHighlighter *()>;
|
using SyntaxHighlighterCreator = std::function<SyntaxHighlighter *()>;
|
||||||
struct BlockPreeditData {
|
|
||||||
int position;
|
|
||||||
QString text;
|
|
||||||
};
|
|
||||||
|
|
||||||
SyntaxHighlighterRunner(SyntaxHighlighterCreator creator,
|
SyntaxHighlighterRunner(SyntaxHighlighterCreator creator,
|
||||||
QTextDocument *document,
|
QTextDocument *document,
|
||||||
|
Reference in New Issue
Block a user