- enhancement: check syntax/parse symbols when modifed and cursor's line changed.
This commit is contained in:
parent
53085e36a3
commit
731a10a1d6
1
NEWS.md
1
NEWS.md
|
@ -16,6 +16,7 @@ Version 0.7.8
|
||||||
- enhancement: can set editor's default background / foreground color. They must be setted to make the custom color schemes correctly.
|
- enhancement: can set editor's default background / foreground color. They must be setted to make the custom color schemes correctly.
|
||||||
- enhancement: can set the color for the current line's number in the gutter
|
- enhancement: can set the color for the current line's number in the gutter
|
||||||
- all predefined color schemes updated.
|
- all predefined color schemes updated.
|
||||||
|
- enhancement: check syntax/parse symbols when modifed and cursor's line changed.
|
||||||
|
|
||||||
Version 0.7.7
|
Version 0.7.7
|
||||||
- enhancement: Problem Set
|
- enhancement: Problem Set
|
||||||
|
|
|
@ -159,7 +159,7 @@
|
||||||
"Breakpoint" : {
|
"Breakpoint" : {
|
||||||
},
|
},
|
||||||
"Error" : {
|
"Error" : {
|
||||||
"foreground" : "#ff2f32"
|
"foreground" : "#ff5053"
|
||||||
},
|
},
|
||||||
"Active Breakpoint" : {
|
"Active Breakpoint" : {
|
||||||
"foreground" : "#FFFFCE",
|
"foreground" : "#FFFFCE",
|
||||||
|
|
|
@ -78,6 +78,7 @@ Editor::Editor(QWidget *parent, const QString& filename,
|
||||||
mCurrentHighlightedWord(),
|
mCurrentHighlightedWord(),
|
||||||
mSaving(false)
|
mSaving(false)
|
||||||
{
|
{
|
||||||
|
mCurrentLineModified = false;
|
||||||
mUseCppSyntax = pSettings->editor().defaultFileCpp();
|
mUseCppSyntax = pSettings->editor().defaultFileCpp();
|
||||||
if (mFilename.isEmpty()) {
|
if (mFilename.isEmpty()) {
|
||||||
mFilename = tr("untitled")+QString("%1").arg(getNewFileNumber());
|
mFilename = tr("untitled")+QString("%1").arg(getNewFileNumber());
|
||||||
|
@ -1355,25 +1356,29 @@ Editor::PSyntaxIssue Editor::getSyntaxIssueAtPosition(const BufferCoord &pos)
|
||||||
return PSyntaxIssue();
|
return PSyntaxIssue();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::onModificationChanged(bool) {
|
|
||||||
updateCaption();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Editor::onStatusChanged(SynStatusChanges changes)
|
void Editor::onStatusChanged(SynStatusChanges changes)
|
||||||
{
|
{
|
||||||
if (!changes.testFlag(SynStatusChange::scReadOnly)
|
if ((!changes.testFlag(SynStatusChange::scReadOnly)
|
||||||
&& !changes.testFlag(SynStatusChange::scInsertMode)
|
&& !changes.testFlag(SynStatusChange::scInsertMode)
|
||||||
&& (lines()->count()!=mLineCount)
|
&& (lines()->count()!=mLineCount)
|
||||||
&& (lines()->count()!=0) && ((mLineCount>0) || (lines()->count()>1))) {
|
&& (lines()->count()!=0) && ((mLineCount>0) || (lines()->count()>1)))
|
||||||
|
||
|
||||||
|
(mCurrentLineModified
|
||||||
|
&& !changes.testFlag(SynStatusChange::scReadOnly)
|
||||||
|
&& changes.testFlag(SynStatusChange::scCaretY))) {
|
||||||
|
mCurrentLineModified = false;
|
||||||
reparse();
|
reparse();
|
||||||
if (pSettings->editor().syntaxCheckWhenLineChanged())
|
if (pSettings->editor().syntaxCheckWhenLineChanged())
|
||||||
checkSyntaxInBack();
|
checkSyntaxInBack();
|
||||||
reparseTodo();
|
reparseTodo();
|
||||||
}
|
}
|
||||||
mLineCount = lines()->count();
|
mLineCount = lines()->count();
|
||||||
if (changes.testFlag(scModified)) {
|
if (changes.testFlag(scModifyChanged)) {
|
||||||
updateCaption();
|
updateCaption();
|
||||||
}
|
}
|
||||||
|
if (changes.testFlag(scModified)) {
|
||||||
|
mCurrentLineModified = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (changes.testFlag(SynStatusChange::scCaretX)
|
if (changes.testFlag(SynStatusChange::scCaretX)
|
||||||
|| changes.testFlag(SynStatusChange::scCaretY)) {
|
|| changes.testFlag(SynStatusChange::scCaretY)) {
|
||||||
|
|
|
@ -173,7 +173,6 @@ public:
|
||||||
void tab() override;
|
void tab() override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onModificationChanged(bool status) ;
|
|
||||||
void onStatusChanged(SynStatusChanges changes);
|
void onStatusChanged(SynStatusChanges changes);
|
||||||
void onGutterClicked(Qt::MouseButton button, int x, int y, int line);
|
void onGutterClicked(Qt::MouseButton button, int x, int y, int line);
|
||||||
void onTipEvalValueReady(const QString& value);
|
void onTipEvalValueReady(const QString& value);
|
||||||
|
@ -263,7 +262,7 @@ private:
|
||||||
QString mCurrentHighlightedWord;
|
QString mCurrentHighlightedWord;
|
||||||
|
|
||||||
bool mSaving;
|
bool mSaving;
|
||||||
|
bool mCurrentLineModified;
|
||||||
int mXOffsetSince;
|
int mXOffsetSince;
|
||||||
int mTabStopBegin;
|
int mTabStopBegin;
|
||||||
int mTabStopEnd;
|
int mTabStopEnd;
|
||||||
|
|
|
@ -5977,14 +5977,16 @@ bool SynEdit::modified() const
|
||||||
|
|
||||||
void SynEdit::setModified(bool Value)
|
void SynEdit::setModified(bool Value)
|
||||||
{
|
{
|
||||||
if (Value)
|
if (Value) {
|
||||||
mLastModifyTime = QDateTime::currentDateTime();
|
mLastModifyTime = QDateTime::currentDateTime();
|
||||||
|
emit statusChanged(SynStatusChange::scModified);
|
||||||
|
}
|
||||||
if (Value != mModified) {
|
if (Value != mModified) {
|
||||||
mModified = Value;
|
mModified = Value;
|
||||||
if (mOptions.testFlag(SynEditorOption::eoGroupUndo) && (!Value) && mUndoList->CanUndo())
|
if (mOptions.testFlag(SynEditorOption::eoGroupUndo) && (!Value) && mUndoList->CanUndo())
|
||||||
mUndoList->AddGroupBreak();
|
mUndoList->AddGroupBreak();
|
||||||
mUndoList->setInitialState(!Value);
|
mUndoList->setInitialState(!Value);
|
||||||
emit statusChanged(SynStatusChange::scModified);
|
emit statusChanged(SynStatusChange::scModifyChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,10 +40,11 @@ enum SynStatusChange {
|
||||||
scLeftChar = 0x0008,
|
scLeftChar = 0x0008,
|
||||||
scTopLine = 0x0010,
|
scTopLine = 0x0010,
|
||||||
scInsertMode = 0x0020,
|
scInsertMode = 0x0020,
|
||||||
scModified = 0x0040,
|
scModifyChanged = 0x0040,
|
||||||
scSelection = 0x0080,
|
scSelection = 0x0080,
|
||||||
scReadOnly = 0x0100,
|
scReadOnly = 0x0100,
|
||||||
scOpenFile = 0x0200
|
scOpenFile = 0x0200,
|
||||||
|
scModified = 0x0400
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_FLAGS(SynStatusChanges, SynStatusChange)
|
Q_DECLARE_FLAGS(SynStatusChanges, SynStatusChange)
|
||||||
|
|
|
@ -857,5 +857,5 @@ QByteArray getHTTPBody(const QByteArray& content) {
|
||||||
bool haveGoodContrast(const QColor& c1, const QColor &c2) {
|
bool haveGoodContrast(const QColor& c1, const QColor &c2) {
|
||||||
int lightness1 = qGray(c1.rgb());
|
int lightness1 = qGray(c1.rgb());
|
||||||
int lightness2 = qGray(c2.rgb());
|
int lightness2 = qGray(c2.rgb());
|
||||||
return std::abs(lightness1 - lightness2)>=100;
|
return std::abs(lightness1 - lightness2)>=120;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue