diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/AutoComplete.cxx | 2 | ||||
-rw-r--r-- | src/AutoComplete.h | 4 | ||||
-rw-r--r-- | src/ContractionState.cxx | 8 | ||||
-rw-r--r-- | src/ContractionState.h | 8 | ||||
-rw-r--r-- | src/Decoration.cxx | 16 | ||||
-rw-r--r-- | src/Decoration.h | 20 | ||||
-rw-r--r-- | src/Document.cxx | 12 | ||||
-rw-r--r-- | src/Document.h | 4 | ||||
-rw-r--r-- | src/EditView.cxx | 46 | ||||
-rw-r--r-- | src/EditView.h | 2 | ||||
-rw-r--r-- | src/Editor.cxx | 53 | ||||
-rw-r--r-- | src/Editor.h | 8 | ||||
-rw-r--r-- | src/PositionCache.cxx | 29 | ||||
-rw-r--r-- | src/RunStyles.cxx | 1 | ||||
-rw-r--r-- | src/ScintillaBase.cxx | 12 | ||||
-rw-r--r-- | src/ScintillaBase.h | 4 | ||||
-rw-r--r-- | src/SparseVector.h | 38 |
17 files changed, 136 insertions, 131 deletions
diff --git a/src/AutoComplete.cxx b/src/AutoComplete.cxx index a5aa50afe..966df7d47 100644 --- a/src/AutoComplete.cxx +++ b/src/AutoComplete.cxx @@ -54,7 +54,7 @@ bool AutoComplete::Active() const { } void AutoComplete::Start(Window &parent, int ctrlID, - Sci::Position position, Point location, int startLen_, + Sci::Position position, Point location, Sci::Position startLen_, int lineHeight, bool unicodeMode, int technology) { if (active) { Cancel(); diff --git a/src/AutoComplete.h b/src/AutoComplete.h index 2d957f6e5..ed14f1776 100644 --- a/src/AutoComplete.h +++ b/src/AutoComplete.h @@ -27,7 +27,7 @@ public: bool chooseSingle; std::unique_ptr<ListBox> lb; Sci::Position posStart; - int startLen; + Sci::Position startLen; /// Should autocompletion be canceled if editor's currentPos <= startPos? bool cancelAtStartPos; bool autoHide; @@ -49,7 +49,7 @@ public: /// Display the auto completion list positioned to be near a character position void Start(Window &parent, int ctrlID, Sci::Position position, Point location, - int startLen_, int lineHeight, bool unicodeMode, int technology); + Sci::Position startLen_, int lineHeight, bool unicodeMode, int technology); /// The stop chars are characters which, when typed, cause the auto completion list to disappear void SetStopChars(const char *stopChars_); diff --git a/src/ContractionState.cxx b/src/ContractionState.cxx index a378c89bc..da94b0302 100644 --- a/src/ContractionState.cxx +++ b/src/ContractionState.cxx @@ -35,11 +35,11 @@ ContractionState::~ContractionState() { void ContractionState::EnsureData() { if (OneToOne()) { - visible.reset(new RunStyles<int, int>()); - expanded.reset(new RunStyles<int, int>()); - heights.reset(new RunStyles<int, int>()); + visible.reset(new RunStyles<Sci::Line, char>()); + expanded.reset(new RunStyles<Sci::Line, char>()); + heights.reset(new RunStyles<Sci::Line, int>()); foldDisplayTexts.reset(new SparseVector<UniqueString>()); - displayLines.reset(new Partitioning<int>(4)); + displayLines.reset(new Partitioning<Sci::Line>(4)); InsertLines(0, linesInDocument); } } diff --git a/src/ContractionState.h b/src/ContractionState.h index 7f11196ea..eb141ea33 100644 --- a/src/ContractionState.h +++ b/src/ContractionState.h @@ -17,11 +17,11 @@ class SparseVector; */ class ContractionState { // These contain 1 element for every document line. - std::unique_ptr<RunStyles<int, int>> visible; - std::unique_ptr<RunStyles<int, int>> expanded; - std::unique_ptr<RunStyles<int, int>> heights; + std::unique_ptr<RunStyles<Sci::Line, char>> visible; + std::unique_ptr<RunStyles<Sci::Line, char>> expanded; + std::unique_ptr<RunStyles<Sci::Line, int>> heights; std::unique_ptr<SparseVector<UniqueString>> foldDisplayTexts; - std::unique_ptr<Partitioning<int>> displayLines; + std::unique_ptr<Partitioning<Sci::Line>> displayLines; Sci::Line linesInDocument; void EnsureData(); diff --git a/src/Decoration.cxx b/src/Decoration.cxx index bca2d6cb0..09d8a8062 100644 --- a/src/Decoration.cxx +++ b/src/Decoration.cxx @@ -53,7 +53,7 @@ Decoration *DecorationList::DecorationFromIndicator(int indicator) { return nullptr; } -Decoration *DecorationList::Create(int indicator, int length) { +Decoration *DecorationList::Create(int indicator, Sci::Position length) { currentIndicator = indicator; std::unique_ptr<Decoration> decoNew(new Decoration(indicator)); decoNew->rs.InsertSpace(0, length); @@ -90,7 +90,7 @@ void DecorationList::SetCurrentValue(int value) { currentValue = value ? value : 1; } -bool DecorationList::FillRange(int &position, int value, int &fillLength) { +bool DecorationList::FillRange(Sci::Position &position, int value, Sci::Position &fillLength) { if (!current) { current = DecorationFromIndicator(currentIndicator); if (!current) { @@ -104,7 +104,7 @@ bool DecorationList::FillRange(int &position, int value, int &fillLength) { return changed; } -void DecorationList::InsertSpace(int position, int insertLength) { +void DecorationList::InsertSpace(Sci::Position position, Sci::Position insertLength) { const bool atEnd = position == lengthDocument; lengthDocument += insertLength; for (const std::unique_ptr<Decoration> &deco : decorationList) { @@ -115,7 +115,7 @@ void DecorationList::InsertSpace(int position, int insertLength) { } } -void DecorationList::DeleteRange(int position, int deleteLength) { +void DecorationList::DeleteRange(Sci::Position position, Sci::Position deleteLength) { lengthDocument -= deleteLength; for (const std::unique_ptr<Decoration> &deco : decorationList) { deco->rs.DeleteRange(position, deleteLength); @@ -155,7 +155,7 @@ void DecorationList::SetView() { } } -int DecorationList::AllOnFor(int position) const { +int DecorationList::AllOnFor(Sci::Position position) const { int mask = 0; for (const std::unique_ptr<Decoration> &deco : decorationList) { if (deco->rs.ValueAt(position)) { @@ -167,7 +167,7 @@ int DecorationList::AllOnFor(int position) const { return mask; } -int DecorationList::ValueAt(int indicator, int position) { +int DecorationList::ValueAt(int indicator, Sci::Position position) { const Decoration *deco = DecorationFromIndicator(indicator); if (deco) { return deco->rs.ValueAt(position); @@ -175,7 +175,7 @@ int DecorationList::ValueAt(int indicator, int position) { return 0; } -int DecorationList::Start(int indicator, int position) { +Sci::Position DecorationList::Start(int indicator, Sci::Position position) { const Decoration *deco = DecorationFromIndicator(indicator); if (deco) { return deco->rs.StartRun(position); @@ -183,7 +183,7 @@ int DecorationList::Start(int indicator, int position) { return 0; } -int DecorationList::End(int indicator, int position) { +Sci::Position DecorationList::End(int indicator, Sci::Position position) { const Decoration *deco = DecorationFromIndicator(indicator); if (deco) { return deco->rs.EndRun(position); diff --git a/src/Decoration.h b/src/Decoration.h index 79ee9ef73..0d799920e 100644 --- a/src/Decoration.h +++ b/src/Decoration.h @@ -12,7 +12,7 @@ namespace Scintilla { class Decoration { int indicator; public: - RunStyles<int, int> rs; + RunStyles<Sci::Position, int> rs; explicit Decoration(int indicator_); ~Decoration(); @@ -27,14 +27,14 @@ class DecorationList { int currentIndicator; int currentValue; Decoration *current; // Cached so FillRange doesn't have to search for each call. - int lengthDocument; + Sci::Position lengthDocument; // Ordered by indicator std::vector<std::unique_ptr<Decoration>> decorationList; std::vector<const Decoration*> decorationView; // Read-only view of decorationList bool clickNotified; Decoration *DecorationFromIndicator(int indicator); - Decoration *Create(int indicator, int length); + Decoration *Create(int indicator, Sci::Position length); void Delete(int indicator); void DeleteAnyEmpty(); void SetView(); @@ -52,17 +52,17 @@ public: int GetCurrentValue() const { return currentValue; } // Returns true if some values may have changed - bool FillRange(int &position, int value, int &fillLength); + bool FillRange(Sci::Position &position, int value, Sci::Position &fillLength); - void InsertSpace(int position, int insertLength); - void DeleteRange(int position, int deleteLength); + void InsertSpace(Sci::Position position, Sci::Position insertLength); + void DeleteRange(Sci::Position position, Sci::Position deleteLength); void DeleteLexerDecorations(); - int AllOnFor(int position) const; - int ValueAt(int indicator, int position); - int Start(int indicator, int position); - int End(int indicator, int position); + int AllOnFor(Sci::Position position) const; + int ValueAt(int indicator, Sci::Position position); + Sci::Position Start(int indicator, Sci::Position position); + Sci::Position End(int indicator, Sci::Position position); bool ClickNotified() const { return clickNotified; diff --git a/src/Document.cxx b/src/Document.cxx index bda8c0f93..6018ca96c 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -586,7 +586,7 @@ int Document::LenChar(Sci::Position pos) { const int widthCharBytes = UTF8BytesOfLead[leadByte]; const Sci::Position lengthDoc = static_cast<Sci::Position>(Length()); if ((pos + widthCharBytes) > lengthDoc) - return lengthDoc - pos; + return static_cast<int>(lengthDoc - pos); else return widthCharBytes; } else if (dbcsCodePage) { @@ -833,7 +833,7 @@ Document::CharacterExtracted Document::CharacterBefore(Sci::Position position) c Sci::Position startUTF = position; Sci::Position endUTF = position; if (InGoodUTF8(position, startUTF, endUTF)) { - const int widthCharBytes = endUTF - startUTF; + const int widthCharBytes = static_cast<int>(endUTF - startUTF); unsigned char charBytes[UTF8MaxBytes] = { 0, 0, 0, 0 }; for (int b = 0; b<widthCharBytes; b++) charBytes[b] = static_cast<unsigned char>(cb.CharAt(startUTF + b)); @@ -1346,7 +1346,7 @@ int SCI_METHOD Document::GetLineIndentation(Sci_Position line) { if (ch == ' ') indent++; else if (ch == '\t') - indent = NextTab(indent, tabInChars); + indent = static_cast<int>(NextTab(indent, tabInChars)); else return indent; } @@ -1848,7 +1848,7 @@ Document::CharacterExtracted Document::ExtractCharacter(Sci::Position position) * searches (just pass minPos > maxPos to do a backward search) * Has not been tested with backwards DBCS searches yet. */ -long Document::FindText(Sci::Position minPos, Sci::Position maxPos, const char *search, +Sci::Position Document::FindText(Sci::Position minPos, Sci::Position maxPos, const char *search, int flags, Sci::Position *length) { if (*length <= 0) return minPos; @@ -2518,7 +2518,7 @@ public: ~BuiltinRegex() override { } - long FindText(Document *doc, Sci::Position minPos, Sci::Position maxPos, const char *s, + Sci::Position FindText(Document *doc, Sci::Position minPos, Sci::Position maxPos, const char *s, bool caseSensitive, bool word, bool wordStart, int flags, Sci::Position *length) override; @@ -2978,7 +2978,7 @@ Sci::Position Cxx11RegexFindText(Document *doc, Sci::Position minPos, Sci::Posit } -long BuiltinRegex::FindText(Document *doc, Sci::Position minPos, Sci::Position maxPos, const char *s, +Sci::Position BuiltinRegex::FindText(Document *doc, Sci::Position minPos, Sci::Position maxPos, const char *s, bool caseSensitive, bool, bool, int flags, Sci::Position *length) { diff --git a/src/Document.h b/src/Document.h index 6f803fecf..5293fb25e 100644 --- a/src/Document.h +++ b/src/Document.h @@ -88,7 +88,7 @@ class RegexSearchBase { public: virtual ~RegexSearchBase() {} - virtual long FindText(Document *doc, Sci::Position minPos, Sci::Position maxPos, const char *s, + virtual Sci::Position FindText(Document *doc, Sci::Position minPos, Sci::Position maxPos, const char *s, bool caseSensitive, bool word, bool wordStart, int flags, Sci::Position *length) = 0; ///@return String with the substitutions, must remain valid until the next call or destruction @@ -403,7 +403,7 @@ public: bool MatchesWordOptions(bool word, bool wordStart, Sci::Position pos, Sci::Position length) const; bool HasCaseFolder() const; void SetCaseFolder(CaseFolder *pcf_); - long FindText(Sci::Position minPos, Sci::Position maxPos, const char *search, int flags, Sci::Position *length); + Sci::Position FindText(Sci::Position minPos, Sci::Position maxPos, const char *search, int flags, Sci::Position *length); const char *SubstituteByPosition(const char *text, Sci::Position *length); Sci::Line LinesTotal() const; diff --git a/src/EditView.cxx b/src/EditView.cxx index 293f7737a..f3df80dc9 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -339,7 +339,7 @@ LineLayout *EditView::RetrieveLineLayout(Sci::Line lineNumber, const EditModel & PLATFORM_ASSERT(posLineEnd >= posLineStart); const Sci::Line lineCaret = static_cast<Sci::Line>(model.pdoc->LineFromPosition(model.sel.MainCaret())); return llc.Retrieve(lineNumber, lineCaret, - posLineEnd - posLineStart, model.pdoc->GetStyleClock(), + static_cast<int>(posLineEnd - posLineStart), model.pdoc->GetStyleClock(), model.LinesOnScreen() + 1, model.pdoc->LinesTotal()); } @@ -410,19 +410,20 @@ void EditView::LayoutLine(const EditModel &model, Sci::Line line, Surface *surfa ll->widthLine = LineLayout::wrapWidthInfinite; ll->lines = 1; if (vstyle.edgeState == EDGE_BACKGROUND) { - ll->edgeColumn = model.pdoc->FindColumn(line, vstyle.theEdge.column); - if (ll->edgeColumn >= posLineStart) { - ll->edgeColumn -= posLineStart; + Sci::Position edgePosition = model.pdoc->FindColumn(line, vstyle.theEdge.column); + if (edgePosition >= posLineStart) { + edgePosition -= posLineStart; } + ll->edgeColumn = static_cast<int>(edgePosition); } else { ll->edgeColumn = -1; } // Fill base line layout - const int lineLength = posLineEnd - posLineStart; + const int lineLength = static_cast<int>(posLineEnd - posLineStart); model.pdoc->GetCharRange(ll->chars.get(), posLineStart, lineLength); model.pdoc->GetStyleRange(ll->styles.get(), posLineStart, lineLength); - const int numCharsBeforeEOL = static_cast<Sci::Position>(model.pdoc->LineEnd(line)) - posLineStart; + const int numCharsBeforeEOL = static_cast<int>(model.pdoc->LineEnd(line) - posLineStart); const int numCharsInLine = (vstyle.viewEOL) ? lineLength : numCharsBeforeEOL; for (Sci::Position styleInLine = 0; styleInLine < numCharsInLine; styleInLine++) { const unsigned char styleByte = ll->styles[styleInLine]; @@ -541,10 +542,10 @@ void EditView::LayoutLine(const EditModel &model, Sci::Line line, Surface *surfa ll->wrapIndent = vstyle.aveCharWidth; // Indent to show start visual ll->lines = 0; // Calculate line start positions based upon width. - int lastGoodBreak = 0; - int lastLineStart = 0; + Sci::Position lastGoodBreak = 0; + Sci::Position lastLineStart = 0; XYACCUMULATOR startOffset = 0; - int p = 0; + Sci::Position p = 0; while (p < ll->numCharsInLine) { if ((ll->positions[p + 1] - startOffset) >= width) { if (lastGoodBreak == lastLineStart) { @@ -561,7 +562,7 @@ void EditView::LayoutLine(const EditModel &model, Sci::Line line, Surface *surfa } lastLineStart = lastGoodBreak; ll->lines++; - ll->SetLineStart(ll->lines, lastGoodBreak); + ll->SetLineStart(ll->lines, static_cast<int>(lastGoodBreak)); startOffset = ll->positions[lastGoodBreak]; // take into account the space for start wrap mark and indent startOffset -= ll->wrapIndent; @@ -604,7 +605,7 @@ Point EditView::LocationFromPosition(Surface *surface, const EditModel &model, S AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc, model)); if (surface && ll) { LayoutLine(model, lineDoc, surface, vs, ll, model.wrapWidth); - const int posInLine = pos.Position() - posLineStart; + const int posInLine = static_cast<int>(pos.Position() - posLineStart); pt = ll->PointFromPosition(posInLine, vs.lineHeight, pe); pt.y += (lineVisible - topLine) * vs.lineHeight; pt.x += vs.textStart - model.xOffset; @@ -624,7 +625,7 @@ Range EditView::RangeDisplayLine(Surface *surface, const EditModel &model, Sci:: if (surface && ll) { LayoutLine(model, lineDoc, surface, vs, ll, model.wrapWidth); const Sci::Line lineStartSet = model.cs.DisplayFromDoc(lineDoc); - const int subLine = lineVisible - lineStartSet; + const int subLine = static_cast<int>(lineVisible - lineStartSet); if (subLine < ll->lines) { rangeSubLine = ll->SubLineRange(subLine); if (subLine == ll->lines-1) { @@ -654,7 +655,7 @@ SelectionPosition EditView::SPositionFromLocation(Surface *surface, const EditMo if (surface && ll) { LayoutLine(model, lineDoc, surface, vs, ll, model.wrapWidth); const Sci::Line lineStartSet = model.cs.DisplayFromDoc(lineDoc); - const int subLine = visibleLine - lineStartSet; + const int subLine = static_cast<int>(visibleLine - lineStartSet); if (subLine < ll->lines) { const Range rangeSubLine = ll->SubLineRange(subLine); const XYPOSITION subLineStart = ll->positions[rangeSubLine.start]; @@ -787,7 +788,8 @@ static ColourDesired TextBackground(const EditModel &model, const ViewStyle &vsD void EditView::DrawIndentGuide(Surface *surface, Sci::Line lineVisible, int lineHeight, Sci::Position start, PRectangle rcSegment, bool highlight) { const Point from = Point::FromInts(0, ((lineVisible & 1) && (lineHeight & 1)) ? 1 : 0); - const PRectangle rcCopyArea = PRectangle::FromInts(start + 1, static_cast<int>(rcSegment.top), start + 2, static_cast<int>(rcSegment.bottom)); + const PRectangle rcCopyArea = PRectangle::FromInts(static_cast<int>(start + 1), static_cast<int>(rcSegment.top), + static_cast<int>(start + 2), static_cast<int>(rcSegment.bottom)); surface->Copy(rcCopyArea, from, highlight ? *pixmapIndentGuideHighlight : *pixmapIndentGuide); } @@ -1305,7 +1307,7 @@ static void DrawBlockCaret(Surface *surface, const EditModel &model, const ViewS FontAlias fontText = vsDraw.styles[styleMain].font; surface->DrawTextClipped(rcCaret, fontText, rcCaret.top + vsDraw.maxAscent, &ll->chars[offsetFirstChar], - numCharsToDraw, vsDraw.styles[styleMain].back, + static_cast<int>(numCharsToDraw), vsDraw.styles[styleMain].back, caretColour); } @@ -1326,7 +1328,7 @@ void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewSt else posCaret.SetPosition(model.pdoc->MovePositionOutsideChar(posCaret.Position()-1, -1)); } - const int offset = posCaret.Position() - posLineStart; + const int offset = static_cast<int>(posCaret.Position() - posLineStart); const XYPOSITION spaceWidth = vsDraw.styles[ll->EndLineStyle()].spaceWidth; const XYPOSITION virtualOffset = posCaret.VirtualSpace() * spaceWidth; if (ll->InLine(offset, subLine) && offset <= ll->numCharsBeforeEOL) { @@ -1740,11 +1742,11 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi if (phasesDraw != phasesOne) { surface->DrawTextTransparent(rcSegment, textFont, rcSegment.top + vsDraw.maxAscent, &ll->chars[ts.start], - i - ts.start + 1, textFore); + static_cast<int>(i - ts.start + 1), textFore); } else { surface->DrawTextNoClip(rcSegment, textFont, rcSegment.top + vsDraw.maxAscent, &ll->chars[ts.start], - i - ts.start + 1, textFore, textBack); + static_cast<int>(i - ts.start + 1), textFore, textBack); } } if (vsDraw.viewWhitespace != wsInvisible || @@ -1821,7 +1823,7 @@ void EditView::DrawIndentGuidesOverEmpty(Surface *surface, const EditModel &mode // Find the most recent line with some text Sci::Line lineLastWithText = line; - while (lineLastWithText > std::max(line - 20, 0) && model.pdoc->IsWhiteLine(lineLastWithText)) { + while (lineLastWithText > std::max(line - 20, static_cast<Sci::Line>(0)) && model.pdoc->IsWhiteLine(lineLastWithText)) { lineLastWithText--; } if (lineLastWithText < line) { @@ -2038,7 +2040,7 @@ void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, PRectan // Only visible lines should be handled by the code within the loop PLATFORM_ASSERT(model.cs.GetVisible(lineDoc)); const Sci::Line lineStartSet = model.cs.DisplayFromDoc(lineDoc); - const int subLine = visibleLine - lineStartSet; + const int subLine = static_cast<int>(visibleLine - lineStartSet); // Copy this line and its styles from the document into local arrays // and determine the x position at which each character starts. @@ -2189,7 +2191,7 @@ static ColourDesired InvertedLight(ColourDesired orig) { return ColourDesired(std::min(r, 0xffu), std::min(g, 0xffu), std::min(b, 0xffu)); } -long EditView::FormatRange(bool draw, Sci_RangeToFormat *pfr, Surface *surface, Surface *surfaceMeasure, +Sci::Position EditView::FormatRange(bool draw, Sci_RangeToFormat *pfr, Surface *surface, Surface *surfaceMeasure, const EditModel &model, const ViewStyle &vs) { // Can't use measurements cached for screen posCache.Clear(); @@ -2298,7 +2300,7 @@ long EditView::FormatRange(bool draw, Sci_RangeToFormat *pfr, Surface *surface, // Copy this line and its styles from the document into local arrays // and determine the x position at which each character starts. - LineLayout ll(static_cast<Sci::Position>(model.pdoc->LineStart(lineDoc + 1) - model.pdoc->LineStart(lineDoc) + 1)); + LineLayout ll(static_cast<int>(model.pdoc->LineStart(lineDoc + 1) - model.pdoc->LineStart(lineDoc) + 1)); LayoutLine(model, lineDoc, surfaceMeasure, vsPrint, &ll, widthPrint); ll.containsCaret = false; diff --git a/src/EditView.h b/src/EditView.h index 067b9299a..8a194236d 100644 --- a/src/EditView.h +++ b/src/EditView.h @@ -145,7 +145,7 @@ public: const ViewStyle &vsDraw); void FillLineRemainder(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, Sci::Line line, PRectangle rcArea, int subLine) const; - long FormatRange(bool draw, Sci_RangeToFormat *pfr, Surface *surface, Surface *surfaceMeasure, + Sci::Position FormatRange(bool draw, Sci_RangeToFormat *pfr, Surface *surface, Surface *surfaceMeasure, const EditModel &model, const ViewStyle &vs); }; diff --git a/src/Editor.cxx b/src/Editor.cxx index c27cc380c..2c32d671c 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -932,7 +932,7 @@ Point Editor::PointMainCaret() { */ void Editor::SetLastXChosen() { const Point pt = PointMainCaret(); - lastXChosen = static_cast<Sci::Position>(pt.x) + xOffset; + lastXChosen = static_cast<int>(pt.x) + xOffset; } void Editor::ScrollTo(Sci::Line line, bool moveThumb) { @@ -1080,7 +1080,7 @@ void Editor::MoveCaretInsideView(bool ensureVisible) { } else if ((pt.y + vs.lineHeight - 1) > rcClient.bottom) { const Sci::Position yOfLastLineFullyDisplayed = static_cast<Sci::Position>(rcClient.top) + (LinesOnScreen() - 1) * vs.lineHeight; MovePositionTo(SPositionFromLocation( - Point::FromInts(lastXChosen - xOffset, static_cast<int>(rcClient.top) + yOfLastLineFullyDisplayed), + Point::FromInts(lastXChosen - xOffset, static_cast<int>(rcClient.top + yOfLastLineFullyDisplayed)), false, false, UserVirtualSpace()), Selection::noSel, ensureVisible); } @@ -1157,7 +1157,7 @@ Editor::XYScrollPosition Editor::XYScrollToMakeVisible(const SelectionRange &ran if ((options & xysVertical) && (pt.y < rcClient.top || ptBottomCaret.y >= rcClient.bottom || (caretYPolicy & CARET_STRICT) != 0)) { const Sci::Line lineCaret = DisplayFromPosition(range.caret.Position()); const Sci::Line linesOnScreen = LinesOnScreen(); - const Sci::Line halfScreen = std::max(linesOnScreen - 1, 2) / 2; + const Sci::Line halfScreen = std::max(linesOnScreen - 1, static_cast<Sci::Line>(2)) / 2; const bool bSlop = (caretYPolicy & CARET_SLOP) != 0; const bool bStrict = (caretYPolicy & CARET_STRICT) != 0; const bool bJump = (caretYPolicy & CARET_JUMPS) != 0; @@ -1364,8 +1364,8 @@ Editor::XYScrollPosition Editor::XYScrollToMakeVisible(const SelectionRange &ran newXY.xOffset = std::max(newXY.xOffset, minOffset); } else { // Shift to right to show anchor or as much of range as possible - const int minOffset = static_cast<Sci::Position>(ptAnchor.x + xOffset - rcClient.right) + 1; - const int maxOffset = static_cast<Sci::Position>(pt.x + xOffset - rcClient.left) - 1; + const int minOffset = static_cast<int>(ptAnchor.x + xOffset - rcClient.right) + 1; + const int maxOffset = static_cast<int>(pt.x + xOffset - rcClient.left) - 1; newXY.xOffset = std::max(newXY.xOffset, minOffset); newXY.xOffset = std::min(newXY.xOffset, maxOffset); } @@ -1391,7 +1391,7 @@ void Editor::SetXYScroll(XYScrollPosition newXY) { const PRectangle rcText = GetTextRectangle(); if (horizontalScrollBarVisible && rcText.Width() + xOffset > scrollWidth) { - scrollWidth = xOffset + static_cast<Sci::Position>(rcText.Width()); + scrollWidth = xOffset + static_cast<int>(rcText.Width()); SetScrollBars(); } } @@ -1515,7 +1515,7 @@ bool Editor::WrapLines(WrapScope ws) { Sci::Line lineToWrap = wrapPending.start; Sci::Line lineToWrapEnd = std::min(wrapPending.end, pdoc->LinesTotal()); const Sci::Line lineDocTop = cs.DocFromDisplay(topLine); - const int subLineTop = topLine - cs.DisplayFromDoc(lineDocTop); + const int subLineTop = static_cast<int>(topLine - cs.DisplayFromDoc(lineDocTop)); if (ws == WrapScope::wsVisible) { lineToWrap = Sci::clamp(lineDocTop-5, wrapPending.start, pdoc->LinesTotal()); // Priority wrap to just after visible area. @@ -1786,7 +1786,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { // This is mostly copied from the Paint method but with some things omitted // such as the margin markers, line numbers, selection and caret // Should be merged back into a combined Draw method. -long Editor::FormatRange(bool draw, Sci_RangeToFormat *pfr) { +Sci::Position Editor::FormatRange(bool draw, Sci_RangeToFormat *pfr) { if (!pfr) return 0; @@ -2620,7 +2620,7 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) { if (mh.modificationType & SC_MOD_CHANGEANNOTATION) { const Sci::Line lineDoc = static_cast<Sci::Line>(pdoc->LineFromPosition(mh.position)); if (vs.annotationVisible) { - if (cs.SetHeight(lineDoc, cs.GetHeight(lineDoc) + mh.annotationLinesAdded)) { + if (cs.SetHeight(lineDoc, static_cast<int>(cs.GetHeight(lineDoc) + mh.annotationLinesAdded))) { SetScrollBars(); } Redraw(); @@ -2690,7 +2690,7 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) { scn.line = mh.line; scn.foldLevelNow = mh.foldLevelNow; scn.foldLevelPrev = mh.foldLevelPrev; - scn.token = mh.token; + scn.token = static_cast<int>(mh.token); scn.annotationLinesAdded = mh.annotationLinesAdded; NotifyParent(scn); } @@ -2850,7 +2850,7 @@ void Editor::PageMove(int direction, Selection::selTypes selt, bool stuttered) { const Sci::Line topStutterLine = topLine + caretYSlop; const Sci::Line bottomStutterLine = static_cast<Sci::Line>( pdoc->LineFromPosition(PositionFromLocation( - Point::FromInts(lastXChosen - xOffset, direction * vs.lineHeight * LinesToScroll()))) + Point::FromInts(lastXChosen - xOffset, direction * vs.lineHeight * static_cast<int>(LinesToScroll())))) - caretYSlop - 1); if (stuttered && (direction < 0 && currentLine > topStutterLine)) { @@ -2860,7 +2860,7 @@ void Editor::PageMove(int direction, Selection::selTypes selt, bool stuttered) { } else if (stuttered && (direction > 0 && currentLine < bottomStutterLine)) { topLineNew = topLine; - newPos = SPositionFromLocation(Point::FromInts(lastXChosen - xOffset, vs.lineHeight * (LinesToScroll() - caretYSlop)), + newPos = SPositionFromLocation(Point::FromInts(lastXChosen - xOffset, vs.lineHeight * static_cast<int>(LinesToScroll() - caretYSlop)), false, false, UserVirtualSpace()); } else { @@ -2869,7 +2869,8 @@ void Editor::PageMove(int direction, Selection::selTypes selt, bool stuttered) { topLineNew = Sci::clamp( topLine + direction * LinesToScroll(), static_cast<Sci::Line>(0), MaxScrollPos()); newPos = SPositionFromLocation( - Point::FromInts(lastXChosen - xOffset, static_cast<int>(pt.y) + direction * (vs.lineHeight * LinesToScroll())), + Point::FromInts(lastXChosen - xOffset, static_cast<int>(pt.y) + + direction * (vs.lineHeight * static_cast<int>(LinesToScroll()))), false, false, UserVirtualSpace()); } @@ -3098,10 +3099,10 @@ SelectionPosition Editor::PositionUpOrDown(SelectionPosition spStart, int direct const Sci::Line newY = static_cast<Sci::Line>(pt.y) + (1 + skipLines) * direction * vs.lineHeight; if (lastX < 0) { - lastX = static_cast<Sci::Position>(pt.x) + xOffset; + lastX = static_cast<int>(pt.x) + xOffset; } SelectionPosition posNew = SPositionFromLocation( - Point::FromInts(lastX - xOffset, newY), false, false, UserVirtualSpace()); + Point::FromInts(lastX - xOffset, static_cast<int>(newY)), false, false, UserVirtualSpace()); if (direction < 0) { // Line wrapping may lead to a location on the same line, so @@ -4017,7 +4018,7 @@ CaseFolder *Editor::CaseFolderForEncoding() { * Search of a text in the document, in the given range. * @return The position of the found text, -1 if not found. */ -long Editor::FindText( +Sci::Position Editor::FindText( uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD, ///< @c SCFIND_WORDSTART, @c SCFIND_REGEXP or @c SCFIND_POSIX. sptr_t lParam) { ///< @c Sci_TextToFind structure: The text to search for in the given range. @@ -4027,15 +4028,15 @@ long Editor::FindText( if (!pdoc->HasCaseFolder()) pdoc->SetCaseFolder(CaseFolderForEncoding()); try { - const long pos = pdoc->FindText( + const Sci::Position pos = pdoc->FindText( static_cast<Sci::Position>(ft->chrg.cpMin), static_cast<Sci::Position>(ft->chrg.cpMax), ft->lpstrText, static_cast<int>(wParam), &lengthFound); if (pos != -1) { - ft->chrgText.cpMin = pos; - ft->chrgText.cpMax = pos + lengthFound; + ft->chrgText.cpMin = static_cast<Sci_PositionCR>(pos); + ft->chrgText.cpMax = static_cast<Sci_PositionCR>(pos + lengthFound); } return static_cast<int>(pos); } catch (RegexError &) { @@ -4064,14 +4065,14 @@ void Editor::SearchAnchor() { * Used for next text and previous text requests. * @return The position of the found text, -1 if not found. */ -long Editor::SearchText( +Sci::Position Editor::SearchText( unsigned int iMessage, ///< Accepts both @c SCI_SEARCHNEXT and @c SCI_SEARCHPREV. uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD, ///< @c SCFIND_WORDSTART, @c SCFIND_REGEXP or @c SCFIND_POSIX. sptr_t lParam) { ///< The text to search for. const char *txt = reinterpret_cast<char *>(lParam); - long pos; + Sci::Position pos; Sci::Position lengthFound = istrlen(txt); if (!pdoc->HasCaseFolder()) pdoc->SetCaseFolder(CaseFolderForEncoding()); @@ -4090,7 +4091,7 @@ long Editor::SearchText( return -1; } if (pos != -1) { - SetSelection(static_cast<int>(pos), static_cast<int>(pos + lengthFound)); + SetSelection(pos, pos + lengthFound); } return pos; @@ -4117,18 +4118,18 @@ std::string Editor::CaseMapString(const std::string &s, int caseMapping) { * Search for text in the target range of the document. * @return The position of the found text, -1 if not found. */ -long Editor::SearchInTarget(const char *text, Sci::Position length) { +Sci::Position Editor::SearchInTarget(const char *text, Sci::Position length) { Sci::Position lengthFound = length; if (!pdoc->HasCaseFolder()) pdoc->SetCaseFolder(CaseFolderForEncoding()); try { - const long pos = pdoc->FindText(targetStart, targetEnd, text, + const Sci::Position pos = pdoc->FindText(targetStart, targetEnd, text, searchFlags, &lengthFound); if (pos != -1) { - targetStart = static_cast<int>(pos); - targetEnd = static_cast<int>(pos + lengthFound); + targetStart = pos; + targetEnd = pos + lengthFound; } return pos; } catch (RegexError &) { diff --git a/src/Editor.h b/src/Editor.h index 44255016a..2e8ac1503 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -378,7 +378,7 @@ protected: // ScintillaBase subclass needs access to much of Editor void PaintSelMargin(Surface *surfaceWindow, PRectangle &rc); void RefreshPixMaps(Surface *surfaceWindow); void Paint(Surface *surfaceWindow, PRectangle rcArea); - long FormatRange(bool draw, Sci_RangeToFormat *pfr); + Sci::Position FormatRange(bool draw, Sci_RangeToFormat *pfr); int TextWidth(int style, const char *text); virtual void SetVerticalScrollPos() = 0; @@ -473,10 +473,10 @@ protected: // ScintillaBase subclass needs access to much of Editor void Indent(bool forwards); virtual CaseFolder *CaseFolderForEncoding(); - long FindText(uptr_t wParam, sptr_t lParam); + Sci::Position FindText(uptr_t wParam, sptr_t lParam); void SearchAnchor(); - long SearchText(unsigned int iMessage, uptr_t wParam, sptr_t lParam); - long SearchInTarget(const char *text, Sci::Position length); + Sci::Position SearchText(unsigned int iMessage, uptr_t wParam, sptr_t lParam); + Sci::Position SearchInTarget(const char *text, Sci::Position length); void GoToLine(Sci::Line lineNo); virtual void CopyToClipboard(const SelectionText &selectedText) = 0; diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index 60dc3c070..cb83cf3ef 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -143,14 +143,14 @@ void LineLayout::SetLineStart(int line, int start) { void LineLayout::SetBracesHighlight(Range rangeLine, const Sci::Position braces[], char bracesMatchStyle, int xHighlight, bool ignoreStyle) { if (!ignoreStyle && rangeLine.ContainsCharacter(braces[0])) { - const int braceOffset = braces[0] - rangeLine.start; + const Sci::Position braceOffset = braces[0] - rangeLine.start; if (braceOffset < numCharsInLine) { bracePreviousStyles[0] = styles[braceOffset]; styles[braceOffset] = bracesMatchStyle; } } if (!ignoreStyle && rangeLine.ContainsCharacter(braces[1])) { - const int braceOffset = braces[1] - rangeLine.start; + const Sci::Position braceOffset = braces[1] - rangeLine.start; if (braceOffset < numCharsInLine) { bracePreviousStyles[1] = styles[braceOffset]; styles[braceOffset] = bracesMatchStyle; @@ -164,13 +164,13 @@ void LineLayout::SetBracesHighlight(Range rangeLine, const Sci::Position braces[ void LineLayout::RestoreBracesHighlight(Range rangeLine, const Sci::Position braces[], bool ignoreStyle) { if (!ignoreStyle && rangeLine.ContainsCharacter(braces[0])) { - const int braceOffset = braces[0] - rangeLine.start; + const Sci::Position braceOffset = braces[0] - rangeLine.start; if (braceOffset < numCharsInLine) { styles[braceOffset] = bracePreviousStyles[0]; } } if (!ignoreStyle && rangeLine.ContainsCharacter(braces[1])) { - const int braceOffset = braces[1] - rangeLine.start; + const Sci::Position braceOffset = braces[1] - rangeLine.start; if (braceOffset < numCharsInLine) { styles[braceOffset] = bracePreviousStyles[1]; } @@ -193,7 +193,7 @@ int LineLayout::FindBefore(XYPOSITION x, int lower, int upper) const { int LineLayout::FindPositionFromX(XYPOSITION x, Range range, bool charPosition) const { - int pos = FindBefore(x, range.start, range.end); + int pos = FindBefore(x, static_cast<int>(range.start), static_cast<int>(range.end)); while (pos < range.end) { if (charPosition) { if (x < (positions[pos + 1])) { @@ -206,7 +206,7 @@ int LineLayout::FindPositionFromX(XYPOSITION x, Range range, bool charPosition) } pos++; } - return range.end; + return static_cast<int>(range.end); } Point LineLayout::PointFromPosition(int posInLine, int lineHeight, PointEnd pe) const { @@ -439,7 +439,7 @@ BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, Range lin ll(ll_), lineRange(lineRange_), posLineStart(posLineStart_), - nextBreak(lineRange_.start), + nextBreak(static_cast<int>(lineRange_.start)), saeCurrentPos(0), saeNext(0), subBreak(-1), @@ -450,7 +450,7 @@ BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, Range lin // Search for first visible break // First find the first visible character if (xStart > 0.0f) - nextBreak = ll->FindBefore(static_cast<XYPOSITION>(xStart), lineRange.start, lineRange.end); + nextBreak = ll->FindBefore(static_cast<XYPOSITION>(xStart), static_cast<int>(lineRange.start), static_cast<int>(lineRange.end)); // Now back to a style break while ((nextBreak > lineRange.start) && (ll->styles[nextBreak] == ll->styles[nextBreak - 1])) { nextBreak--; @@ -464,9 +464,9 @@ BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, Range lin const SelectionSegment portion = psel->Range(r).Intersect(segmentLine); if (!(portion.start == portion.end)) { if (portion.start.IsValid()) - Insert(portion.start.Position() - posLineStart); + Insert(static_cast<int>(portion.start.Position() - posLineStart)); if (portion.end.IsValid()) - Insert(portion.end.Position() - posLineStart); + Insert(static_cast<int>(portion.end.Position() - posLineStart)); } } } @@ -475,14 +475,14 @@ BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, Range lin if (pvsDraw->indicators[deco->Indicator()].OverridesTextFore()) { Sci::Position startPos = deco->rs.EndRun(posLineStart); while (startPos < (posLineStart + lineRange.end)) { - Insert(startPos - posLineStart); + Insert(static_cast<int>(startPos - posLineStart)); startPos = deco->rs.EndRun(startPos); } } } } Insert(ll->edgeColumn); - Insert(lineRange.end); + Insert(static_cast<int>(lineRange.end)); saeNext = (!selAndEdge.empty()) ? selAndEdge[0] : -1; } @@ -495,7 +495,8 @@ TextSegment BreakFinder::Next() { while (nextBreak < lineRange.end) { int charWidth = 1; if (encodingFamily == efUnicode) - charWidth = UTF8DrawBytes(reinterpret_cast<unsigned char *>(&ll->chars[nextBreak]), lineRange.end - nextBreak); + charWidth = UTF8DrawBytes(reinterpret_cast<unsigned char *>(&ll->chars[nextBreak]), + static_cast<int>(lineRange.end - nextBreak)); else if (encodingFamily == efDBCS) charWidth = pdoc->IsDBCSLeadByte(ll->chars[nextBreak]) ? 2 : 1; const Representation *repr = preprs->RepresentationFromCharacter(&ll->chars[nextBreak], charWidth); @@ -504,7 +505,7 @@ TextSegment BreakFinder::Next() { (nextBreak == saeNext)) { while ((nextBreak >= saeNext) && (saeNext < lineRange.end)) { saeCurrentPos++; - saeNext = (saeCurrentPos < selAndEdge.size()) ? selAndEdge[saeCurrentPos] : lineRange.end; + saeNext = static_cast<int>((saeCurrentPos < selAndEdge.size()) ? selAndEdge[saeCurrentPos] : lineRange.end); } if ((nextBreak > prev) || repr) { // Have a segment to report diff --git a/src/RunStyles.cxx b/src/RunStyles.cxx index f3939bbd2..ce25cf144 100644 --- a/src/RunStyles.cxx +++ b/src/RunStyles.cxx @@ -304,3 +304,4 @@ void RunStyles<DISTANCE, STYLE>::Check() const { } template class Scintilla::RunStyles<int, int>; +template class Scintilla::RunStyles<int, char>; diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index e367449ee..46804e7b3 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -212,7 +212,7 @@ void ScintillaBase::ListNotify(ListBoxEvent *plbe) { } } -void ScintillaBase::AutoCompleteInsert(Sci::Position startPos, int removeLen, const char *text, int textLen) { +void ScintillaBase::AutoCompleteInsert(Sci::Position startPos, Sci::Position removeLen, const char *text, Sci::Position textLen) { UndoGroup ug(pdoc); if (multiAutoCMode == SC_MULTIAUTOC_ONCE) { pdoc->DeleteChars(startPos, removeLen); @@ -240,15 +240,15 @@ void ScintillaBase::AutoCompleteInsert(Sci::Position startPos, int removeLen, co } } -void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) { +void ScintillaBase::AutoCompleteStart(Sci::Position lenEntered, const char *list) { //Platform::DebugPrintf("AutoComplete %s\n", list); ct.CallTipCancel(); if (ac.chooseSingle && (listType == 0)) { if (list && !strchr(list, ac.GetSeparator())) { const char *typeSep = strchr(list, ac.GetTypesep()); - const int lenInsert = typeSep ? - static_cast<int>(typeSep-list) : static_cast<int>(strlen(list)); + const Sci::Position lenInsert = typeSep ? + static_cast<Sci::Position>(typeSep-list) : static_cast<Sci::Position>(strlen(list)); if (ac.ignoreCase) { // May need to convert the case before invocation, so remove lenEntered characters AutoCompleteInsert(sel.MainCaret() - lenEntered, lenEntered, list, lenInsert); @@ -424,7 +424,7 @@ void ScintillaBase::AutoCompleteCompleted(char ch, unsigned int completionMethod endPos = pdoc->ExtendWordSelect(endPos, 1, true); if (endPos < firstPos) return; - AutoCompleteInsert(firstPos, endPos - firstPos, selected.c_str(), static_cast<int>(selected.length())); + AutoCompleteInsert(firstPos, endPos - firstPos, selected.c_str(), static_cast<Sci::Position>(selected.length())); SetLastXChosen(); scn.nmhdr.code = SCN_AUTOCCOMPLETED; @@ -847,7 +847,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara switch (iMessage) { case SCI_AUTOCSHOW: listType = 0; - AutoCompleteStart(static_cast<int>(wParam), reinterpret_cast<const char *>(lParam)); + AutoCompleteStart(static_cast<Sci::Position>(wParam), reinterpret_cast<const char *>(lParam)); break; case SCI_AUTOCCANCEL: diff --git a/src/ScintillaBase.h b/src/ScintillaBase.h index bd7787357..f2633ba90 100644 --- a/src/ScintillaBase.h +++ b/src/ScintillaBase.h @@ -64,8 +64,8 @@ protected: void CancelModes() override; int KeyCommand(unsigned int iMessage) override; - void AutoCompleteInsert(Sci::Position startPos, int removeLen, const char *text, int textLen); - void AutoCompleteStart(int lenEntered, const char *list); + void AutoCompleteInsert(Sci::Position startPos, Sci::Position removeLen, const char *text, Sci::Position textLen); + void AutoCompleteStart(Sci::Position lenEntered, const char *list); void AutoCompleteCancel(); void AutoCompleteMove(int delta); int AutoCompleteGetCurrent() const; diff --git a/src/SparseVector.h b/src/SparseVector.h index 0f9f4ad1c..4e28996fc 100644 --- a/src/SparseVector.h +++ b/src/SparseVector.h @@ -15,42 +15,42 @@ namespace Scintilla { template <typename T> class SparseVector { private: - std::unique_ptr<Partitioning<int>> starts; + std::unique_ptr<Partitioning<Sci::Position>> starts; std::unique_ptr<SplitVector<T>> values; T empty; // Deleted so SparseVector objects can not be copied. SparseVector(const SparseVector &) = delete; void operator=(const SparseVector &) = delete; - void ClearValue(int partition) { + void ClearValue(Sci::Position partition) { values->SetValueAt(partition, T()); } public: SparseVector() : empty() { - starts.reset(new Partitioning<int>(8)); + starts.reset(new Partitioning<Sci::Position>(8)); values.reset(new SplitVector<T>()); values->InsertEmpty(0, 2); } ~SparseVector() { starts.reset(); // starts dead here but not used by ClearValue. - for (int part = 0; part < values->Length(); part++) { + for (Sci::Position part = 0; part < values->Length(); part++) { ClearValue(part); } values.reset(); } - int Length() const { + Sci::Position Length() const { return starts->PositionFromPartition(starts->Partitions()); } - int Elements() const { + Sci::Position Elements() const { return starts->Partitions(); } - int PositionOfElement(int element) const { + Sci::Position PositionOfElement(int element) const { return starts->PositionFromPartition(element); } - const T& ValueAt(int position) const { + const T& ValueAt(Sci::Position position) const { assert(position < Length()); - const int partition = starts->PartitionFromPosition(position); - const int startPartition = starts->PositionFromPartition(partition); + const Sci::Position partition = starts->PartitionFromPosition(position); + const Sci::Position startPartition = starts->PositionFromPartition(partition); if (startPartition == position) { return values->ValueAt(partition); } else { @@ -58,10 +58,10 @@ public: } } template <typename ParamType> - void SetValueAt(int position, ParamType &&value) { + void SetValueAt(Sci::Position position, ParamType &&value) { assert(position < Length()); - const int partition = starts->PartitionFromPosition(position); - const int startPartition = starts->PositionFromPartition(partition); + const Sci::Position partition = starts->PartitionFromPosition(position); + const Sci::Position startPartition = starts->PositionFromPartition(partition); if (value == T()) { // Setting the empty value is equivalent to deleting the position if (position == 0) { @@ -85,10 +85,10 @@ public: } } } - void InsertSpace(int position, int insertLength) { + void InsertSpace(Sci::Position position, Sci::Position insertLength) { assert(position <= Length()); // Only operation that works at end. - const int partition = starts->PartitionFromPosition(position); - const int startPartition = starts->PositionFromPartition(partition); + const Sci::Position partition = starts->PartitionFromPosition(position); + const Sci::Position startPartition = starts->PositionFromPartition(partition); if (startPartition == position) { const bool positionOccupied = values->ValueAt(partition) != T(); // Inserting at start of run so make previous longer @@ -111,10 +111,10 @@ public: starts->InsertText(partition, insertLength); } } - void DeletePosition(int position) { + void DeletePosition(Sci::Position position) { assert(position < Length()); - int partition = starts->PartitionFromPosition(position); - const int startPartition = starts->PositionFromPartition(partition); + Sci::Position partition = starts->PartitionFromPosition(position); + const Sci::Position startPartition = starts->PositionFromPartition(partition); if (startPartition == position) { if (partition == 0) { ClearValue(0); |