aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-06-09 14:04:11 -0400
committerKen Moore <ken@ixsystems.com>2017-06-09 14:04:11 -0400
commitbbf81abc29e626b654366b7083babe9f355709ea (patch)
treef62602228809158e4e48d465f58f323b453a673c /src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
parentGet the SyntaxFile loading mechanisms all setup. (diff)
downloadlumina-bbf81abc29e626b654366b7083babe9f355709ea.tar.gz
lumina-bbf81abc29e626b654366b7083babe9f355709ea.tar.bz2
lumina-bbf81abc29e626b654366b7083babe9f355709ea.zip
Get the new syntax highlighting support framework functional with the C++ rules files as the example (still need to convert the other existing rulesets over to the new format).
Diffstat (limited to 'src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp')
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
index a0aff9cc..e62ff0d4 100644
--- a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
+++ b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
@@ -68,7 +68,15 @@ void PlainTextEditor::LoadFile(QString filepath){
bool diffFile = (filepath != this->whatsThis());
this->setWhatsThis(filepath);
this->clear();
- SYNTAX->loadRules( Custom_Syntax::ruleForFile(filepath.section("/",-1)) );
+ QList<SyntaxFile> files = SyntaxFile::availableFiles(settings);
+ for(int i=0; i<files.length(); i++){
+ if(files[i].supportsFile(filepath) ){
+ files[i].SetupDocument(this);
+ SYNTAX->loadRules(files[i]);
+ break;
+ }
+ }
+ //SYNTAX->loadRules( Custom_Syntax::ruleForFile(filepath.section("/",-1), settings) );
lastSaveContents = LUtils::readFile(filepath).join("\n");
if(diffFile){
this->setPlainText( lastSaveContents );
@@ -94,7 +102,7 @@ void PlainTextEditor::SaveFile(bool newname){
QString file = QFileDialog::getSaveFileName(this, tr("Save File"), this->whatsThis(), tr("Text File (*)"));
if(file.isEmpty()){ return; }
this->setWhatsThis(file);
- SYNTAX->loadRules( Custom_Syntax::ruleForFile(this->whatsThis().section("/",-1)) );
+ SYNTAX->loadRules( Custom_Syntax::ruleForFile(this->whatsThis().section("/",-1), settings) );
SYNTAX->rehighlight();
}
if( !watcher->files().isEmpty() ){ watcher->removePaths(watcher->files()); }
bgstack15