42 return (
start == other.start) && (
end == other.end);
62 return (pos <= start && pos >=
end);
71 return (pos < start && pos >=
end);
83 other.Contains(
start) ||
96 bool caseSensitive,
bool word,
bool wordStart,
int flags,
Sci::Position *length) = 0;
111 StyledText(
size_t length_,
const char *text_,
bool multipleStyles_,
int style_,
const unsigned char *styles_) noexcept :
207 ActionDuration(
double duration_,
double minDuration_,
double maxDuration_)
noexcept;
208 void AddSample(
size_t numberActions,
double durationOfActions)
noexcept;
222 watcher(watcher_), userData(userData_) {
225 return (watcher == other.watcher) && (userData == other.userData);
234 std::unique_ptr<CaseFolder>
pcf;
248 std::unique_ptr<PerLine> perLineData[ldSize];
266 character(character_), widthBytes(widthBytes_) {
300 void Init()
override;
305 int LineEndTypesSupported()
const;
306 bool SetDBCSCodePage(
int dbcsCodePage_);
308 bool SetLineEndTypesAllowed(
int lineEndBitSet_);
315 void SCI_METHOD SetErrorStatus(
int status)
override;
326 bool NextCharacter(
Sci::
Position &
pos,
int moveDir) const noexcept;
333 bool SCI_METHOD IsDBCSLeadByte(
char ch) const override;
334 bool IsDBCSLeadByteNoExcept(
char ch) const noexcept;
335 bool IsDBCSLeadByteInvalid(
char ch) const noexcept;
336 bool IsDBCSTrailByteInvalid(
char ch) const noexcept;
337 int DBCSDrawBytes(const
char *
text,
int len) const noexcept;
338 int SafeSegment(const
char *
text,
int length,
int lengthSegment) const noexcept;
343 void CheckReadOnly();
346 void ChangeInsertion(const
char *s,
Sci::
Position length);
348 void *
SCI_METHOD ConvertToDocument() override;
351 bool CanUndo() const noexcept {
return cb.
CanUndo(); }
366 void TentativeUndo();
381 static std::string TransformLineEnds(
const char *s,
size_t len,
int eolModeWanted);
382 void ConvertLineEnds(
int eolModeSet);
386 int Options() const noexcept;
405 void DeleteMarkFromHandle(
int markerHandle);
406 void DeleteAllMarks(
int markerNum);
407 Sci::Line LineFromHandle(
int markerHandle)
const noexcept;
408 int MarkerNumberFromLine(
Sci::Line line,
int which)
const noexcept;
409 int MarkerHandleFromLine(
Sci::Line line,
int which)
const noexcept;
441 bool HasCaseFolder() const noexcept;
442 void SetCaseFolder(
CaseFolder *pcf_) noexcept;
444 const
char *SubstituteByPosition(const
char *
text,
Sci::
Position *length);
445 int LineCharacterIndex() const noexcept;
446 void AllocateLineCharacterIndex(
int lineCharacterIndex);
447 void ReleaseLineCharacterIndex(
int lineCharacterIndex);
448 Sci::
Line LinesTotal() const noexcept;
450 void SetDefaultCharClasses(
bool includeWordClass);
452 int GetCharsOfClass(
CharClassify::cc characterClass,
unsigned char *buffer) const;
453 void SetCharacterCategoryOptimization(
int countCharacters);
454 int CharacterCategoryOptimization() const noexcept;
463 void IncrementStyleClock() noexcept;
464 void SCI_METHOD DecorationSetCurrentIndicator(
int indicator) override;
467 void SetLexInterface(std::unique_ptr<
LexInterface> pLexInterface) noexcept;
471 Sci::
Line GetMaxLineState() const noexcept;
476 void MarginSetStyles(
Sci::
Line line, const
unsigned char *styles);
478 void MarginClearAll();
482 void AnnotationSetStyle(
Sci::
Line line,
int style);
483 void AnnotationSetStyles(
Sci::
Line line, const
unsigned char *styles);
484 int AnnotationLines(
Sci::
Line line) const noexcept;
485 void AnnotationClearAll();
488 void EOLAnnotationSetStyle(
Sci::
Line line,
int style);
490 void EOLAnnotationClearAll();
492 bool AddWatcher(
DocWatcher *watcher,
void *userData);
493 bool RemoveWatcher(
DocWatcher *watcher,
void *userData);
495 CharClassify::cc WordCharacterClass(
unsigned int ch) const;
496 bool IsWordPartSeparator(
unsigned int ch) const;
503 int IndentSize() const noexcept {
return actualIndentInChars; }
507 void NotifyModifyAttempt();
508 void NotifySavePoint(
bool atSavePoint);
517 pdoc(pdoc_), groupNeeded(groupNeeded_) {
558 modificationType(modificationType_),
561 linesAdded(linesAdded_),
566 annotationLinesAdded(0),
570 modificationType(modificationType_),
573 linesAdded(linesAdded_),
574 text(act.data.get()),
578 annotationLinesAdded(0),
static Sci_Position LineEnd(Sci_Position line, Accessor &styler)
static Sci_Position LineStart(Sci_Position line, Accessor &styler)
#define SC_FOLDLEVELNUMBERMASK
The ActionDuration class stores the average time taken for some action such as styling or wrapping a ...
void AddSample(size_t numberActions, double durationOfActions) noexcept
double Duration() const noexcept
ActionDuration(double duration_, double minDuration_, double maxDuration_) noexcept
Actions are used to store all the information required to perform one undo/redo step.
Holder for an expandable array of characters that supports undo and line markers.
bool IsSavePoint() const noexcept
void Allocate(Sci::Position newSize)
bool IsLarge() const noexcept
bool SetUndoCollection(bool collectUndo)
bool IsCollectingUndo() const noexcept
bool ContainsLineEnd(const char *s, Sci::Position length) const noexcept
int GetLineEndTypes() const noexcept
void SetReadOnly(bool set) noexcept
void GetStyleRange(unsigned char *buffer, Sci::Position position, Sci::Position lengthRetrieve) const
void GetCharRange(char *buffer, Sci::Position position, Sci::Position lengthRetrieve) const
char CharAt(Sci::Position position) const noexcept
Retrieving positions outside the range of the buffer works and returns 0.
bool IsReadOnly() const noexcept
const char * RangePointer(Sci::Position position, Sci::Position rangeLength) noexcept
const char * BufferPointer()
bool CanUndo() const noexcept
To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is called that...
bool TentativeActive() const noexcept
Sci::Position Length() const noexcept
Sci::Position GapPosition() const noexcept
void AddUndoAction(Sci::Position token, bool mayCoalesce)
bool CanRedo() const noexcept
char StyleAt(Sci::Position position) const noexcept
To optimise processing of document modifications by DocWatchers, a hint is passed indicating the scop...
DocModification(int modificationType_, Sci::Position position_=0, Sci::Position length_=0, Sci::Line linesAdded_=0, const char *text_=nullptr, Sci::Line line_=0) noexcept
Sci::Line annotationLinesAdded
Sci::Line linesAdded
Negative if lines deleted.
DocModification(int modificationType_, const Action &act, Sci::Line linesAdded_=0) noexcept
const char * text
Only valid for changes to text, not for changes to style.
A class that wants to receive notifications from a Document must be derived from DocWatcher and imple...
virtual void NotifyStyleNeeded(Document *doc, void *userData, Sci::Position endPos)=0
virtual void NotifyLexerChanged(Document *doc, void *userData)=0
virtual void NotifyErrorOccurred(Document *doc, void *userData, int status)=0
virtual void NotifyModified(Document *doc, DocModification mh, void *userData)=0
virtual void NotifyModifyAttempt(Document *doc, void *userData)=0
virtual void NotifyDeleted(Document *doc, void *userData) noexcept=0
virtual void NotifySavePoint(Document *doc, void *userData, bool atSavePoint)=0
Sci::Position GapPosition() const noexcept
char SCI_METHOD StyleAt(Sci_Position position) const override
int GetStyleClock() const noexcept
CharacterCategoryMap charMap
Sci_Position SCI_METHOD Length() const override
int dbcsCodePage
Can also be SC_CP_UTF8 to enable UTF-8 mode.
void GetStyleRange(unsigned char *buffer, Sci::Position position, Sci::Position lengthRetrieve) const
int StyleIndexAt(Sci_Position position) const noexcept
bool SetUndoCollection(bool collectUndo)
std::unique_ptr< IDecorationList > decorations
bool IsCollectingUndo() const noexcept
bool IsLarge() const noexcept
Document(const Document &)=delete
Document & operator=(Document &&)=delete
std::vector< WatcherWithUserData > watchers
bool TentativeActive() const noexcept
bool IsReadOnly() const noexcept
Sci::Position LengthNoExcept() const noexcept
const char * RangePointer(Sci::Position position, Sci::Position rangeLength) noexcept
int GetLineEndTypesActive() const noexcept
void Allocate(Sci::Position newSize)
ActionDuration durationStyleOneLine
bool CanRedo() const noexcept
bool ContainsLineEnd(const char *s, Sci::Position length) const noexcept
void AddUndoAction(Sci::Position token, bool mayCoalesce)
const char *SCI_METHOD BufferPointer() override
void SCI_METHOD GetCharRange(char *buffer, Sci_Position position, Sci_Position lengthRetrieve) const override
void SetReadOnly(bool set)
Document(Document &&)=delete
std::unique_ptr< CaseFolder > pcf
int SCI_METHOD Version() const override
bool IsSavePoint() const noexcept
int GetLineEndTypesAllowed() const noexcept
void operator=(const Document &)=delete
Sci::Line firstChangeableLineBefore
HighlightDelimiter() noexcept
bool IsBodyOfFoldBlock(Sci::Line line) const noexcept
bool IsHeadOfFoldBlock(Sci::Line line) const noexcept
bool IsFoldBlockHighlighted(Sci::Line line) const noexcept
Sci::Line firstChangeableLineAfter
bool NeedsDrawing(Sci::Line line) const noexcept
bool IsTailOfFoldBlock(Sci::Line line) const noexcept
bool performingStyle
Prevent reentrance.
LexInterface(Document *pdoc_) noexcept
virtual int LineEndTypesSupported()
bool UseContainerLexing() const noexcept
void Colourise(Sci::Position start, Sci::Position end)
The range class represents a range of text in a document.
bool Valid() const noexcept
bool operator==(const Range &other) const noexcept
bool ContainsCharacter(Sci::Position pos) const noexcept
bool Contains(Sci::Position pos) const noexcept
Range(Sci::Position start_, Sci::Position end_) noexcept
Sci::Position Last() const noexcept
Sci::Position First() const noexcept
bool Contains(Range other) const noexcept
bool Overlaps(Range other) const noexcept
Range(Sci::Position pos=0) noexcept
Interface class for regular expression searching.
virtual ~RegexSearchBase()
virtual const char * SubstituteByPosition(Document *doc, const char *text, Sci::Position *length)=0
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
UndoGroup(UndoGroup &&)=delete
UndoGroup(Document *pdoc_, bool groupNeeded_=true)
void operator=(const UndoGroup &)=delete
UndoGroup(const UndoGroup &)=delete
bool Needed() const noexcept
UndoGroup & operator=(UndoGroup &&)=delete
A Position is a position within a document between two characters or at the beginning or end.
const Position invalidPosition
Styling buffer using one element for each run rather than using a filled buffer.
RegexSearchBase * CreateRegexSearch(CharClassify *charClassTable)
Factory function for RegexSearchBase.
constexpr int LevelNumber(int level) noexcept
Used to pair watcher pointer with user data.
WatcherWithUserData(DocWatcher *watcher_=nullptr, void *userData_=nullptr) noexcept
bool operator==(const WatcherWithUserData &other) const noexcept
StyledText(size_t length_, const char *text_, bool multipleStyles_, int style_, const unsigned char *styles_) noexcept
size_t StyleAt(size_t i) const noexcept
size_t LineLength(size_t start) const noexcept
const unsigned char * styles