14#include <forward_list>
29MarkerHandleSet::MarkerHandleSet() {
43 m |= (1 << mhn.number);
50 if (mhn.handle == handle) {
76 bool performedDeletion =
false;
78 if ((all || !performedDeletion) && (mhn.
number == markerNum)) {
79 performedDeletion = true;
84 return performedDeletion;
88 mhList.splice_after(mhList.before_begin(), other->mhList);
122 if (markers[
line] && markers[
line]->Contains(markerHandle)) {
130 if (markers.Length() && (
line >= 0) && (
line < markers.Length()) && markers[
line]) {
132 return pnmh ? pnmh->
handle : -1;
138 if (markers.Length() && (
line >= 0) && (
line < markers.Length()) && markers[
line]) {
140 return pnmh ? pnmh->
number : -1;
148 markers[
line] = Sci::make_unique<MarkerHandleSet>();
155 if (markers.Length() && (
line >= 0) && (
line < markers.Length()) && markers[
line])
156 return markers[
line]->MarkValue();
164 const Sci::Line length = markers.Length();
165 for (
Sci::Line iLine = lineStart; iLine < length; iLine++) {
167 if (onLine && ((onLine->
MarkValue() & mask) != 0))
184 markers[
line] = Sci::make_unique<MarkerHandleSet>();
192 bool someChanges =
false;
194 if (markerNum == -1) {
198 someChanges =
markers[
line]->RemoveNumber(markerNum, all);
274 if (levels.Length() && (
line >= 0) && (
line < levels.Length())) {
339constexpr int IndividualStyles = 0x100;
341size_t NumberLines(
const char *
text)
noexcept {
353std::unique_ptr<char[]>AllocateAnnotation(
size_t length,
int style) {
354 const size_t len =
sizeof(
AnnotationHeader) + length + ((style == IndividualStyles) ? length : 0);
355 return Sci::make_unique<char[]>(len);
389 if (annotations.Length() && (
line >= 0) && (
line < annotations.Length()) && annotations[
line])
390 return reinterpret_cast<AnnotationHeader *
>(annotations[
line].get())->style == IndividualStyles;
396 if (annotations.Length() && (
line >= 0) && (
line < annotations.Length()) && annotations[
line])
403 if (annotations.Length() && (
line >= 0) && (
line < annotations.Length()) && annotations[
line])
410 if (annotations.Length() && (
line >= 0) && (
line < annotations.Length()) && annotations[
line] && MultipleStyles(
line))
424 pah->
style =
static_cast<short>(style);
426 pah->
lines =
static_cast<short>(NumberLines(
text));
454 if (pahSource->
style != IndividualStyles) {
455 std::unique_ptr<char[]>allocation = AllocateAnnotation(pahSource->
length, IndividualStyles);
464 pah->
style = IndividualStyles;
470 if (annotations.Length() && (
line >= 0) && (
line < annotations.Length()) && annotations[
line])
477 if (annotations.Length() && (
line >= 0) && (
line < annotations.Length()) && annotations[
line])
512 if (
line < tabstops.Length()) {
531 std::vector<int>::iterator it = std::lower_bound(tl->begin(), tl->end(), x);
533 if (it == tl->end() || *it != x) {
542 if (
line < tabstops.Length()) {
545 for (
const int i : *tl) {
Manages the text of the document.
Data structure used to partition an interval.
Manages data associated with each line of the document.
Defines global type name Position in the Sci internal namespace.
Interface to the edit control.
#define SC_FOLDLEVELHEADERFLAG
Main data structure for holding arrays that handle insertions and deletions efficiently.
void InsertLines(Sci::Line line, Sci::Line lines) override
bool MultipleStyles(Sci::Line line) const noexcept
~LineAnnotation() override
SplitVector< std::unique_ptr< char[]> > annotations
void RemoveLine(Sci::Line line) override
const char * Text(Sci::Line line) const noexcept
void SetText(Sci::Line line, const char *text)
int Length(Sci::Line line) const noexcept
void SetStyles(Sci::Line line, const unsigned char *styles)
int Style(Sci::Line line) const noexcept
void InsertLine(Sci::Line line) override
void SetStyle(Sci::Line line, int style)
const unsigned char * Styles(Sci::Line line) const noexcept
int Lines(Sci::Line line) const noexcept
int SetLevel(Sci::Line line, int level, Sci::Line lines)
SplitVector< int > levels
void InsertLines(Sci::Line line, Sci::Line lines) override
void ExpandLevels(Sci::Line sizeNew=-1)
void InsertLine(Sci::Line line) override
int GetLevel(Sci::Line line) const noexcept
void RemoveLine(Sci::Line line) override
void MergeMarkers(Sci::Line line)
int handleCurrent
Handles are allocated sequentially and should never have to be reused as 32 bit ints are very big.
int HandleFromLine(Sci::Line line, int which) const noexcept
void DeleteMarkFromHandle(int markerHandle)
int AddMark(Sci::Line line, int markerNum, Sci::Line lines)
Sci::Line MarkerNext(Sci::Line lineStart, int mask) const noexcept
void InsertLine(Sci::Line line) override
Sci::Line LineFromHandle(int markerHandle) const noexcept
int NumberFromLine(Sci::Line line, int which) const noexcept
SplitVector< std::unique_ptr< MarkerHandleSet > > markers
int MarkValue(Sci::Line line) const noexcept
void RemoveLine(Sci::Line line) override
void InsertLines(Sci::Line line, Sci::Line lines) override
bool DeleteMark(Sci::Line line, int markerNum, bool all)
void InsertLine(Sci::Line line) override
Sci::Line GetMaxLineState() const noexcept
int GetLineState(Sci::Line line)
int SetLineState(Sci::Line line, int state)
SplitVector< int > lineStates
void InsertLines(Sci::Line line, Sci::Line lines) override
void RemoveLine(Sci::Line line) override
void RemoveLine(Sci::Line line) override
SplitVector< std::unique_ptr< TabstopList > > tabstops
void InsertLine(Sci::Line line) override
bool AddTabstop(Sci::Line line, int x)
void InsertLines(Sci::Line line, Sci::Line lines) override
bool ClearTabstops(Sci::Line line) noexcept
int GetNextTabstop(Sci::Line line, int x) const noexcept
A marker handle set contains any number of MarkerHandleNumbers.
int MarkValue() const noexcept
Bit set of marker numbers.
MarkerHandleNumber const * GetMarkerHandleNumber(int which) const noexcept
void CombineWith(MarkerHandleSet *other) noexcept
bool Contains(int handle) const noexcept
void RemoveHandle(int handle)
bool Empty() const noexcept
bool RemoveNumber(int markerNum, bool all)
std::forward_list< MarkerHandleNumber > mhList
bool InsertHandle(int handle, int markerNum)
Styling buffer using one element for each run rather than using a filled buffer.
std::vector< int > TabstopList
This holds the marker identifier and the marker type to display.