aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Editor.cxx26
-rw-r--r--src/Editor.h3
2 files changed, 22 insertions, 7 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index e9a30ee72..89c67b433 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -175,7 +175,8 @@ Editor::Editor() {
lengthForEncode = -1;
- needUpdateUI = true;
+ needUpdateUI = 0;
+ ContainerNeedsUpdate(SC_UPDATE_CONTENT);
braces[0] = invalidPosition;
braces[1] = invalidPosition;
bracesMatchStyle = STYLE_BRACEBAD;
@@ -434,7 +435,10 @@ int Editor::LineFromLocation(Point pt) {
}
void Editor::SetTopLine(int topLineNew) {
- topLine = topLineNew;
+ if (topLine != topLineNew) {
+ topLine = topLineNew;
+ ContainerNeedsUpdate(SC_UPDATE_V_SCROLL);
+ }
posTopLine = pdoc->LineStart(cs.DocFromDisplay(topLine));
}
@@ -741,7 +745,7 @@ void Editor::InvalidateSelection(SelectionRange newMain, bool invalidateWholeSel
lastAffected = Platform::Maximum(lastAffected, sel.Range(r).anchor.Position());
}
}
- needUpdateUI = true;
+ ContainerNeedsUpdate(SC_UPDATE_SELECTION);
InvalidateRange(firstAffected, lastAffected);
}
@@ -982,6 +986,7 @@ void Editor::HorizontalScrollTo(int xPos) {
xPos = 0;
if ((wrapState == eWrapNone) && (xOffset != xPos)) {
xOffset = xPos;
+ ContainerNeedsUpdate(SC_UPDATE_H_SCROLL);
SetHorizontalScrollPos();
RedrawRect(GetClientRectangle());
}
@@ -1291,6 +1296,7 @@ void Editor::SetXYScroll(XYScrollPosition newXY) {
}
if (newXY.xOffset != xOffset) {
xOffset = newXY.xOffset;
+ ContainerNeedsUpdate(SC_UPDATE_H_SCROLL);
if (newXY.xOffset > 0) {
PRectangle rcText = GetTextRectangle();
if (horizontalScrollBarVisible &&
@@ -3307,7 +3313,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
surfaceWindow->SetPalette(&palTemp, true);
NotifyUpdateUI();
- needUpdateUI = false;
+ needUpdateUI = 0;
RefreshStyleData();
RefreshPixMaps(surfaceWindow);
@@ -4213,6 +4219,7 @@ void Editor::NotifyHotSpotReleaseClick(int position, bool shift, bool ctrl, bool
void Editor::NotifyUpdateUI() {
SCNotification scn = {0};
scn.nmhdr.code = SCN_UPDATEUI;
+ scn.updated = needUpdateUI;
NotifyParent(scn);
}
@@ -4329,7 +4336,7 @@ static inline int MovePositionForDeletion(int position, int startDeletion, int l
}
void Editor::NotifyModified(Document *, DocModification mh, void *) {
- needUpdateUI = true;
+ ContainerNeedsUpdate(SC_UPDATE_CONTENT);
if (paintState == painting) {
CheckForChangeOutsidePaint(Range(mh.position, mh.position + mh.length));
}
@@ -4611,6 +4618,11 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lPar
NotifyParent(scn);
}
+// Something has changed that the container should know about
+void Editor::ContainerNeedsUpdate(int flags) {
+ needUpdateUI |= flags;
+}
+
/**
* Force scroll and keep position relative to top of window.
*
@@ -6338,7 +6350,7 @@ void Editor::IdleStyling() {
if (needUpdateUI) {
NotifyUpdateUI();
- needUpdateUI = false;
+ needUpdateUI = 0;
}
styleNeeded.Reset();
}
@@ -6995,6 +7007,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_SETXOFFSET:
xOffset = wParam;
+ ContainerNeedsUpdate(SC_UPDATE_H_SCROLL);
SetHorizontalScrollPos();
Redraw();
break;
@@ -7459,6 +7472,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
break;
}
xOffset = 0;
+ ContainerNeedsUpdate(SC_UPDATE_H_SCROLL);
InvalidateStyleRedraw();
ReconfigureScrollBars();
break;
diff --git a/src/Editor.h b/src/Editor.h
index 288addee0..a618e1e40 100644
--- a/src/Editor.h
+++ b/src/Editor.h
@@ -208,7 +208,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
int posTopLine;
int lengthForEncode;
- bool needUpdateUI;
+ int needUpdateUI;
Position braces[2];
int bracesMatchStyle;
int highlightGuideColumn;
@@ -438,6 +438,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void NotifyErrorOccurred(Document *doc, void *userData, int status);
void NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
+ void ContainerNeedsUpdate(int flags);
void PageMove(int direction, Selection::selTypes sel=Selection::noSel, bool stuttered = false);
enum { cmSame, cmUpper, cmLower } caseMap;
virtual std::string CaseMapString(const std::string &s, int caseMapping);