diff options
Diffstat (limited to 'src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h')
-rw-r--r-- | src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h b/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h index bffbfd1a..9949a90c 100644 --- a/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h +++ b/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h @@ -46,6 +46,7 @@ public: void SetupDocument(QPlainTextEdit *editor); bool supportsFile(QString file); //does this syntax set support the file? + bool supportsFirstLine(QString line); //is the type of file defined by the first line of the file? ("#!/bin/<something>" for instance) //Main Loading routine (run this before other functions) bool LoadFile(QString file, QSettings *settings); @@ -66,10 +67,13 @@ public: } ~Custom_Syntax(){} + QString loadedRules(){ return syntax.name(); } + static QStringList availableRules(QSettings *settings); static QStringList knownColors(); static void SetupDefaultColors(QSettings *settings); static QString ruleForFile(QString filename, QSettings *settings); + static QString ruleForFirstLine(QString line, QSettings *settings); void loadRules(QString type); void loadRules(SyntaxFile sfile); @@ -77,6 +81,8 @@ public: loadRules( syntax.name() ); } + void setupDocument(QPlainTextEdit *edit){ syntax.SetupDocument(edit); } //simple redirect for the function in the currently-loaded rules + protected: void highlightBlock(const QString &text){ //qDebug() << "Highlight Block:" << text; @@ -159,7 +165,7 @@ protected: int last = text.length()-1; while(last>=0 && (text[last]==' ' || text[last]=='\t' ) ){ last--; } if(last < text.length()-1){ - setFormat(last+1, text.length()-1-last, fmt); + setFormat(last+1, text.length()-1-last, fmt); } } } |