aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-textedit
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/desktop-utils/lumina-textedit')
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/MainUI.cpp14
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp25
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/syntax_rules/python.syntax2
3 files changed, 21 insertions, 20 deletions
diff --git a/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp b/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp
index c8d5cbc2..65979c46 100644
--- a/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp
+++ b/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp
@@ -119,7 +119,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){
}
MainUI::~MainUI(){
-
+
}
void MainUI::LoadArguments(QStringList args){ //CLI arguments
@@ -157,7 +157,7 @@ void MainUI::updateIcons(){
ui->tool_replace_all->setIcon(LXDG::findIcon("arrow-down-double"));
ui->tool_hideReplaceGroup->setIcon(LXDG::findIcon("dialog-close",""));
//ui->tool_find_next->setIcon(LXDG::findIcon(""));
-
+
QTimer::singleShot(0,colorDLG, SLOT(updateIcons()) );
}
@@ -308,7 +308,7 @@ void MainUI::wrapLines(bool wrap){
/*for(int i=0; i<tabWidget->count(); i++){
PlainTextEditor *edit = static_cast<PlainTextEditor*>(tabWidget->widget(i));
edit->setLineWrapMode( wrap ? QPlainTextEdit::WidgetWidth : QPlainTextEdit::NoWrap);
- }*/
+ }*/
}
void MainUI::ModifyColors(){
@@ -394,7 +394,7 @@ void MainUI::tabDraggedOut(int tab, Qt::DropAction act){
void MainUI::closeFindReplace(){
ui->groupReplace->setVisible(false);
PlainTextEditor *cur = currentEditor();
- if(cur!=0){ cur->setFocus(); }
+ if(cur!=0){ cur->setFocus(); }
}
void MainUI::openFind(){
@@ -402,8 +402,8 @@ void MainUI::openFind(){
if(cur==0){ return; }
ui->groupReplace->setVisible(true);
ui->line_find->setText( cur->textCursor().selectedText() );
- ui->line_replace->setText("");
- ui->line_find->setFocus();
+ ui->line_replace->setText("");
+ ui->line_find->setFocus();
}
void MainUI::openReplace(){
@@ -411,7 +411,7 @@ void MainUI::openReplace(){
if(cur==0){ return; }
ui->groupReplace->setVisible(true);
ui->line_find->setText( cur->textCursor().selectedText() );
- ui->line_replace->setText("");
+ ui->line_replace->setText("");
ui->line_replace->setFocus();
}
diff --git a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
index 57bc35a6..653bd0e8 100644
--- a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
+++ b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
@@ -43,7 +43,7 @@ PlainTextEditor::PlainTextEditor(QSettings *set, QWidget *parent) : QPlainTextEd
}
PlainTextEditor::~PlainTextEditor(){
-
+
}
void PlainTextEditor::showLineNumbers(bool show){
@@ -60,13 +60,14 @@ void PlainTextEditor::LoadSyntaxRule(QString type){
SYNTAX->loadRules(files[i]);
break;
}
+ if(i==files.length()-1){ SyntaxFile dummy; SYNTAX->loadRules(dummy); }
}
SYNTAX->rehighlight();
}
void PlainTextEditor::updateSyntaxColors(){
SYNTAX->reloadRules();
- SYNTAX->rehighlight();
+ SYNTAX->rehighlight();
}
//File loading/setting options
@@ -77,7 +78,7 @@ void PlainTextEditor::LoadFile(QString filepath){
this->clear();
QList<SyntaxFile> files = SyntaxFile::availableFiles(settings);
for(int i=0; i<files.length(); i++){
- if(files[i].supportsFile(filepath) ){
+ if(files[i].supportsFile(filepath) ){
files[i].SetupDocument(this);
SYNTAX->loadRules(files[i]);
break;
@@ -125,7 +126,7 @@ QString PlainTextEditor::currentFile(){
}
bool PlainTextEditor::hasChange(){
- return hasChanges;
+ return hasChanges;
}
//Functions for managing the line number widget
@@ -171,7 +172,7 @@ void PlainTextEditor::paintLNW(QPaintEvent *ev){
bTop = bBottom;
}
}
-
+
//==============
// PRIVATE
//==============
@@ -190,7 +191,7 @@ void PlainTextEditor::clearMatchData(){
void PlainTextEditor::highlightMatch(QChar ch, bool forward, int fromPos, QChar startch){
if(forward){ matchleft = fromPos; }
else{ matchright = fromPos; }
-
+
int nested = 1; //always start within the first nest (the primary nest)
int tmpFromPos = fromPos;
//if(!forward){ tmpFromPos++; } //need to include the initial location
@@ -205,7 +206,7 @@ void PlainTextEditor::highlightMatch(QChar ch, bool forward, int fromPos, QChar
}else{ break; }
}else{
QTextCursor cur = this->document()->find(ch, tmpFromPos, QTextDocument::FindBackward);
- if(!cur.isNull()){
+ if(!cur.isNull()){
QString mid = doc.mid(cur.position()-1, tmpFromPos-cur.position()+1);
//qDebug() << "Found backwards match:" << nested << startch << ch << mid;
//qDebug() << doc.mid(cur.position(),1) << doc.mid(tmpFromPos,1);
@@ -215,10 +216,10 @@ void PlainTextEditor::highlightMatch(QChar ch, bool forward, int fromPos, QChar
}else{ break; }
}
}
-
+
//Now highlight the two characters
- QList<QTextEdit::ExtraSelection> sels = this->extraSelections();
- if(matchleft>=0){
+ QList<QTextEdit::ExtraSelection> sels = this->extraSelections();
+ if(matchleft>=0){
QTextEdit::ExtraSelection sel;
if(matchright>=0){ sel.format.setBackground( QColor(settings->value("colors/bracket-found").toString()) ); }
else{ sel.format.setBackground( QColor(settings->value("colors/bracket-missing").toString()) ); }
@@ -238,7 +239,7 @@ void PlainTextEditor::highlightMatch(QChar ch, bool forward, int fromPos, QChar
if(!forward){ cur.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor); }
else{ cur.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor); }
sel.cursor = cur;
- sels << sel;
+ sels << sel;
}
this->setExtraSelections(sels);
}
@@ -327,7 +328,7 @@ void PlainTextEditor::fileChanged(){
text.append("\n");
text.append( tr("(Note: You will lose all currently-unsaved changes)") );
text.append("\n\n%1");
-
+
if(!update){
update = (QMessageBox::Yes == QMessageBox::question(this, tr("File Modified"),text.arg(currentFile()) , QMessageBox::Yes | QMessageBox::No, QMessageBox::No) );
}
diff --git a/src-qt5/desktop-utils/lumina-textedit/syntax_rules/python.syntax b/src-qt5/desktop-utils/lumina-textedit/syntax_rules/python.syntax
index e93230c3..f6973603 100644
--- a/src-qt5/desktop-utils/lumina-textedit/syntax_rules/python.syntax
+++ b/src-qt5/desktop-utils/lumina-textedit/syntax_rules/python.syntax
@@ -7,7 +7,7 @@
{
"meta": {
- "name": "Python (Experimental)",
+ "name": "Python",
"file_suffix": ["py", "pyc"]
},
"format": {
bgstack15