aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2020-07-16 09:27:55 +1000
committerNeil <nyamatongwe@gmail.com>2020-07-16 09:27:55 +1000
commitc2c917c1b04cbe1ad3bc61ca6a0d51d45b32c0d0 (patch)
tree4f0b7cafa66064c6a9c9254b2f50f8ac2c55dd10 /src
parent47aa162ca1136d96dea71ceab3ad440f16ede1fb (diff)
downloadscintilla-mirror-c2c917c1b04cbe1ad3bc61ca6a0d51d45b32c0d0.tar.gz
Rename validLevel to ValidLevel and make an enum class.
Diffstat (limited to 'src')
-rw-r--r--src/EditView.cxx16
-rw-r--r--src/Editor.cxx8
-rw-r--r--src/PositionCache.cxx10
-rw-r--r--src/PositionCache.h6
4 files changed, 20 insertions, 20 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx
index e54899bbd..fe137f2c8 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -387,7 +387,7 @@ void EditView::LayoutLine(const EditModel &model, Sci::Line line, Surface *surfa
if (posLineEnd >(posLineStart + ll->maxLineLength)) {
posLineEnd = posLineStart + ll->maxLineLength;
}
- if (ll->validity == LineLayout::llCheckTextAndStyle) {
+ if (ll->validity == LineLayout::ValidLevel::checkTextAndStyle) {
Sci::Position lineLength = posLineEnd - posLineStart;
if (!vstyle.viewEOL) {
lineLength = model.pdoc->LineEnd(line) - posLineStart;
@@ -412,15 +412,15 @@ void EditView::LayoutLine(const EditModel &model, Sci::Line line, Surface *surfa
}
allSame = allSame && (ll->styles[numCharsInLine] == styleByte); // For eolFilled
if (allSame) {
- ll->validity = LineLayout::llPositions;
+ ll->validity = LineLayout::ValidLevel::positions;
} else {
- ll->validity = LineLayout::llInvalid;
+ ll->validity = LineLayout::ValidLevel::invalid;
}
} else {
- ll->validity = LineLayout::llInvalid;
+ ll->validity = LineLayout::ValidLevel::invalid;
}
}
- if (ll->validity == LineLayout::llInvalid) {
+ if (ll->validity == LineLayout::ValidLevel::invalid) {
ll->widthLine = LineLayout::wrapWidthInfinite;
ll->lines = 1;
if (vstyle.edgeState == EDGE_BACKGROUND) {
@@ -504,13 +504,13 @@ void EditView::LayoutLine(const EditModel &model, Sci::Line line, Surface *surfa
}
ll->numCharsInLine = numCharsInLine;
ll->numCharsBeforeEOL = numCharsBeforeEOL;
- ll->validity = LineLayout::llPositions;
+ ll->validity = LineLayout::ValidLevel::positions;
}
// Hard to cope when too narrow, so just assume there is space
if (width < 20) {
width = 20;
}
- if ((ll->validity == LineLayout::llPositions) || (ll->widthLine != width)) {
+ if ((ll->validity == LineLayout::ValidLevel::positions) || (ll->widthLine != width)) {
ll->widthLine = width;
if (width == LineLayout::wrapWidthInfinite) {
ll->lines = 1;
@@ -593,7 +593,7 @@ void EditView::LayoutLine(const EditModel &model, Sci::Line line, Surface *surfa
}
ll->lines++;
}
- ll->validity = LineLayout::llLines;
+ ll->validity = LineLayout::ValidLevel::lines;
}
}
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 9b5fa9d6f..763940389 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -274,7 +274,7 @@ void Editor::InvalidateStyleData() {
vs.technology = technology;
DropGraphics(false);
AllocateGraphics();
- view.llc.Invalidate(LineLayout::llInvalid);
+ view.llc.Invalidate(LineLayout::ValidLevel::invalid);
view.posCache.Clear();
}
@@ -1477,7 +1477,7 @@ bool Editor::Wrapping() const noexcept {
void Editor::NeedWrapping(Sci::Line docLineStart, Sci::Line docLineEnd) {
//Platform::DebugPrintf("\nNeedWrapping: %0d..%0d\n", docLineStart, docLineEnd);
if (wrapPending.AddRange(docLineStart, docLineEnd)) {
- view.llc.Invalidate(LineLayout::llPositions);
+ view.llc.Invalidate(LineLayout::ValidLevel::positions);
}
// Wrap lines during idle.
if (Wrapping() && wrapPending.NeedsWrap()) {
@@ -2528,7 +2528,7 @@ void Editor::NotifySavePoint(Document *, void *, bool atSavePoint) {
void Editor::CheckModificationForWrap(DocModification mh) {
if (mh.modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) {
- view.llc.Invalidate(LineLayout::llCheckTextAndStyle);
+ view.llc.Invalidate(LineLayout::ValidLevel::checkTextAndStyle);
const Sci::Line lineDoc = pdoc->SciLineFromPosition(mh.position);
const Sci::Line lines = std::max(static_cast<Sci::Line>(0), mh.linesAdded);
if (Wrapping()) {
@@ -2607,7 +2607,7 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) {
}
}
if (mh.modificationType & SC_MOD_CHANGESTYLE) {
- view.llc.Invalidate(LineLayout::llCheckTextAndStyle);
+ view.llc.Invalidate(LineLayout::ValidLevel::checkTextAndStyle);
}
} else {
// Move selection and brace highlights
diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx
index 40dfe5829..ca676ef6e 100644
--- a/src/PositionCache.cxx
+++ b/src/PositionCache.cxx
@@ -60,7 +60,7 @@ LineLayout::LineLayout(int maxLineLength_) :
maxLineLength(-1),
numCharsInLine(0),
numCharsBeforeEOL(0),
- validity(llInvalid),
+ validity(ValidLevel::invalid),
xHighlightGuide(0),
highlightColumn(false),
containsCaret(false),
@@ -108,7 +108,7 @@ void LineLayout::Free() noexcept {
bidiData.reset();
}
-void LineLayout::Invalidate(validLevel validity_) noexcept {
+void LineLayout::Invalidate(ValidLevel validity_) noexcept {
if (validity > validity_)
validity = validity_;
}
@@ -397,14 +397,14 @@ void LineLayoutCache::Deallocate() noexcept {
cache.clear();
}
-void LineLayoutCache::Invalidate(LineLayout::validLevel validity_) noexcept {
+void LineLayoutCache::Invalidate(LineLayout::ValidLevel validity_) noexcept {
if (!cache.empty() && !allInvalidated) {
for (const std::unique_ptr<LineLayout> &ll : cache) {
if (ll) {
ll->Invalidate(validity_);
}
}
- if (validity_ == LineLayout::llInvalid) {
+ if (validity_ == LineLayout::ValidLevel::invalid) {
allInvalidated = true;
}
}
@@ -422,7 +422,7 @@ LineLayout *LineLayoutCache::Retrieve(Sci::Line lineNumber, Sci::Line lineCaret,
Sci::Line linesOnScreen, Sci::Line linesInDoc) {
AllocateForLevel(linesOnScreen, linesInDoc);
if (styleClock != styleClock_) {
- Invalidate(LineLayout::llCheckTextAndStyle);
+ Invalidate(LineLayout::ValidLevel::checkTextAndStyle);
styleClock = styleClock_;
}
allInvalidated = false;
diff --git a/src/PositionCache.h b/src/PositionCache.h
index e5a668875..cdcc3ef74 100644
--- a/src/PositionCache.h
+++ b/src/PositionCache.h
@@ -67,7 +67,7 @@ public:
int maxLineLength;
int numCharsInLine;
int numCharsBeforeEOL;
- enum validLevel { llInvalid, llCheckTextAndStyle, llPositions, llLines } validity;
+ enum class ValidLevel { invalid, checkTextAndStyle, positions, lines } validity;
int xHighlightGuide;
bool highlightColumn;
bool containsCaret;
@@ -97,7 +97,7 @@ public:
void Resize(int maxLineLength_);
void EnsureBidiData();
void Free() noexcept;
- void Invalidate(validLevel validity_) noexcept;
+ void Invalidate(ValidLevel validity_) noexcept;
int LineStart(int line) const noexcept;
int LineLength(int line) const noexcept;
enum class Scope { visibleOnly, includeEnd };
@@ -170,7 +170,7 @@ public:
llcPage=SC_CACHE_PAGE,
llcDocument=SC_CACHE_DOCUMENT
};
- void Invalidate(LineLayout::validLevel validity_) noexcept;
+ void Invalidate(LineLayout::ValidLevel validity_) noexcept;
void SetLevel(int level_) noexcept;
int GetLevel() const noexcept { return level; }
LineLayout *Retrieve(Sci::Line lineNumber, Sci::Line lineCaret, int maxChars, int styleClock_,