diff options
-rw-r--r-- | include/Scintilla.h | 3 | ||||
-rw-r--r-- | include/Scintilla.iface | 3 | ||||
-rw-r--r-- | src/Document.cxx | 20 | ||||
-rw-r--r-- | src/Document.h | 2 | ||||
-rw-r--r-- | src/Editor.cxx | 9 |
5 files changed, 25 insertions, 12 deletions
diff --git a/include/Scintilla.h b/include/Scintilla.h index 816edb36f..144402ba6 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -694,7 +694,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_MULTILINEUNDOREDO 0x1000 #define SC_STARTACTION 0x2000 #define SC_MOD_CHANGEINDICATOR 0x4000 -#define SC_MODEVENTMASKALL 0x6FFF +#define SC_MOD_CHANGELINESTATE 0x8000 +#define SC_MODEVENTMASKALL 0xFFFF #define SCEN_CHANGE 768 #define SCEN_SETFOCUS 512 #define SCEN_KILLFOCUS 256 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 8e2910cb9..fde3335fe 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -1857,7 +1857,8 @@ val SC_MOD_BEFOREDELETE=0x800 val SC_MULTILINEUNDOREDO=0x1000 val SC_STARTACTION=0x2000 val SC_MOD_CHANGEINDICATOR=0x4000 -val SC_MODEVENTMASKALL=0x6FFF +val SC_MOD_CHANGELINESTATE=0x8000 +val SC_MODEVENTMASKALL=0xFFFF # For compatibility, these go through the COMMAND notification rather than NOTIFY # and should have had exactly the same values as the EN_* constants. diff --git a/src/Document.cxx b/src/Document.cxx index 686758d92..db9949edc 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -113,7 +113,6 @@ void Document::SetSavePoint() { int Document::AddMark(int line, int markerNum) { int prev = cb.AddMark(line, markerNum); DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); - mh.line = line; NotifyModified(mh); return prev; } @@ -124,14 +123,12 @@ void Document::AddMarkSet(int line, int valueSet) { if (m & 1) cb.AddMark(line, i); DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); - mh.line = line; NotifyModified(mh); } void Document::DeleteMark(int line, int markerNum) { cb.DeleteMark(line, markerNum); DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); - mh.line = line; NotifyModified(mh); } @@ -191,8 +188,7 @@ int Document::SetLevel(int line, int level) { int prev = cb.SetLevel(line, level); if (prev != level) { DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER, - LineStart(line), 0, 0, 0); - mh.line = line; + LineStart(line), 0, 0, 0, line); mh.foldLevelNow = level; mh.foldLevelPrev = prev; NotifyModified(mh); @@ -1335,11 +1331,17 @@ void Document::EnsureStyledTo(int pos) { } } -void Document::IncrementStyleClock() { - styleClock++; - if (styleClock > 0x100000) { - styleClock = 0; +int Document::SetLineState(int line, int state) { + int statePrevious = cb.SetLineState(line, state); + if (state != statePrevious) { + DocModification mh(SC_MOD_CHANGELINESTATE, 0, 0, 0, 0, line); + NotifyModified(mh); } + return statePrevious; +} + +void Document::IncrementStyleClock() { + styleClock = (styleClock + 1) % 0x100000; } void Document::DecorationFillRange(int position, int value, int fillLength) { diff --git a/src/Document.h b/src/Document.h index 4b13da060..c13114b75 100644 --- a/src/Document.h +++ b/src/Document.h @@ -224,7 +224,7 @@ public: void IncrementStyleClock(); void DecorationFillRange(int position, int value, int fillLength); - int SetLineState(int line, int state) { return cb.SetLineState(line, state); } + int SetLineState(int line, int state); int GetLineState(int line) { return cb.GetLineState(line); } int GetMaxLineState() { return cb.GetMaxLineState(); } diff --git a/src/Editor.cxx b/src/Editor.cxx index 9d9b4b4f2..187503256 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -3731,6 +3731,15 @@ void Editor::NotifyModified(Document*, DocModification mh, void *) { if (paintState == painting) { CheckForChangeOutsidePaint(Range(mh.position, mh.position + mh.length)); } + if (mh.modificationType & SC_MOD_CHANGELINESTATE) { + if (paintState == painting) { + CheckForChangeOutsidePaint( + Range(pdoc->LineStart(mh.line), pdoc->LineStart(mh.line+1))); + } else { + // Could check that change is before last visible line. + Redraw(); + } + } if (mh.modificationType & (SC_MOD_CHANGESTYLE|SC_MOD_CHANGEINDICATOR)) { if (mh.modificationType & SC_MOD_CHANGESTYLE) { pdoc->IncrementStyleClock(); |