geany
1.38
About: Geany is a text editor (using GTK2) with basic features of an integrated development environment (syntax highlighting, code folding, symbol name auto-completion, ...). F: office T: editor programming GTK+ IDE
![]() ![]() |
Holder for an expandable array of characters that supports undo and line markers. More...
#include <CellBuffer.h>
Public Member Functions | |
CellBuffer (bool hasStyles_, bool largeDocument_) | |
CellBuffer (const CellBuffer &)=delete | |
CellBuffer (CellBuffer &&)=delete | |
void | operator= (const CellBuffer &)=delete |
void | operator= (CellBuffer &&)=delete |
~CellBuffer () | |
char | CharAt (Sci::Position position) const noexcept |
Retrieving positions outside the range of the buffer works and returns 0. More... | |
unsigned char | UCharAt (Sci::Position position) const noexcept |
void | GetCharRange (char *buffer, Sci::Position position, Sci::Position lengthRetrieve) const |
char | StyleAt (Sci::Position position) const noexcept |
void | GetStyleRange (unsigned char *buffer, Sci::Position position, Sci::Position lengthRetrieve) const |
const char * | BufferPointer () |
const char * | RangePointer (Sci::Position position, Sci::Position rangeLength) noexcept |
Sci::Position | GapPosition () const noexcept |
Sci::Position | Length () const noexcept |
void | Allocate (Sci::Position newSize) |
void | SetUTF8Substance (bool utf8Substance_) noexcept |
int | GetLineEndTypes () const noexcept |
void | SetLineEndTypes (int utf8LineEnds_) |
bool | ContainsLineEnd (const char *s, Sci::Position length) const noexcept |
void | SetPerLine (PerLine *pl) noexcept |
int | LineCharacterIndex () const noexcept |
void | AllocateLineCharacterIndex (int lineCharacterIndex) |
void | ReleaseLineCharacterIndex (int lineCharacterIndex) |
Sci::Line | Lines () const noexcept |
Sci::Position | LineStart (Sci::Line line) const noexcept |
Sci::Position | IndexLineStart (Sci::Line line, int lineCharacterIndex) const noexcept |
Sci::Line | LineFromPosition (Sci::Position pos) const noexcept |
Sci::Line | LineFromPositionIndex (Sci::Position pos, int lineCharacterIndex) const noexcept |
void | InsertLine (Sci::Line line, Sci::Position position, bool lineStart) |
void | RemoveLine (Sci::Line line) |
const char * | InsertString (Sci::Position position, const char *s, Sci::Position insertLength, bool &startSequence) |
bool | SetStyleAt (Sci::Position position, char styleValue) noexcept |
Setting styles for positions outside the range of the buffer is safe and has no effect. More... | |
bool | SetStyleFor (Sci::Position position, Sci::Position lengthStyle, char styleValue) noexcept |
const char * | DeleteChars (Sci::Position position, Sci::Position deleteLength, bool &startSequence) |
bool | IsReadOnly () const noexcept |
void | SetReadOnly (bool set) noexcept |
bool | IsLarge () const noexcept |
bool | HasStyles () const noexcept |
void | SetSavePoint () |
The save point is a marker in the undo stack where the container has stated that the buffer was saved. More... | |
bool | IsSavePoint () const noexcept |
void | TentativeStart () |
void | TentativeCommit () |
bool | TentativeActive () const noexcept |
int | TentativeSteps () noexcept |
bool | SetUndoCollection (bool collectUndo) |
bool | IsCollectingUndo () const noexcept |
void | BeginUndoAction () |
void | EndUndoAction () |
void | AddUndoAction (Sci::Position token, bool mayCoalesce) |
void | DeleteUndoHistory () |
bool | CanUndo () const noexcept |
To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is called that many times. More... | |
int | StartUndo () |
const Action & | GetUndoStep () const |
void | PerformUndoStep () |
bool | CanRedo () const noexcept |
int | StartRedo () |
const Action & | GetRedoStep () const |
void | PerformRedoStep () |
Private Member Functions | |
bool | UTF8LineEndOverlaps (Sci::Position position) const noexcept |
bool | UTF8IsCharacterBoundary (Sci::Position position) const |
void | ResetLineEnds () |
void | RecalculateIndexLineStarts (Sci::Line lineFirst, Sci::Line lineLast) |
bool | MaintainingLineCharacterIndex () const noexcept |
void | BasicInsertString (Sci::Position position, const char *s, Sci::Position insertLength) |
Actions without undo. More... | |
void | BasicDeleteChars (Sci::Position position, Sci::Position deleteLength) |
Private Attributes | |
bool | hasStyles |
bool | largeDocument |
SplitVector< char > | substance |
SplitVector< char > | style |
bool | readOnly |
bool | utf8Substance |
int | utf8LineEnds |
bool | collectingUndo |
UndoHistory | uh |
std::unique_ptr< ILineVector > | plv |
Holder for an expandable array of characters that supports undo and line markers.
Based on article "Data Structures in a Bit-Mapped Text Editor" by Wilfred J. Hansen, Byte January 1987, page 183.
Definition at line 110 of file CellBuffer.h.
CellBuffer::CellBuffer | ( | bool | hasStyles_, |
bool | largeDocument_ | ||
) |
Definition at line 567 of file CellBuffer.cxx.
References collectingUndo, largeDocument, plv, readOnly, utf8LineEnds, and utf8Substance.
|
delete |
|
delete |
CellBuffer::~CellBuffer | ( | ) |
Definition at line 579 of file CellBuffer.cxx.
void CellBuffer::AddUndoAction | ( | Sci::Position | token, |
bool | mayCoalesce | ||
) |
Definition at line 1244 of file CellBuffer.cxx.
References Scintilla::UndoHistory::AppendAction(), Scintilla::containerAction, and uh.
Referenced by Scintilla::Document::AddUndoAction().
void CellBuffer::Allocate | ( | Sci::Position | newSize | ) |
Definition at line 709 of file CellBuffer.cxx.
References hasStyles, style, and substance.
Referenced by Scintilla::Document::Allocate().
void CellBuffer::AllocateLineCharacterIndex | ( | int | lineCharacterIndex | ) |
Definition at line 755 of file CellBuffer.cxx.
References Lines(), plv, RecalculateIndexLineStarts(), and utf8Substance.
Referenced by Scintilla::Document::AllocateLineCharacterIndex(), and SetLineEndTypes().
|
private |
Definition at line 1125 of file CellBuffer.cxx.
References GetCharRange(), hasStyles, INVALID_POSITION, MaintainingLineCharacterIndex(), plv, position, RecalculateIndexLineStarts(), RemoveLine(), style, substance, text, Scintilla::UTF8IsAscii(), UTF8IsCharacterBoundary(), Scintilla::UTF8IsNEL(), Scintilla::UTF8IsSeparator(), Scintilla::UTF8IsTrailByte(), Scintilla::UTF8IsValid(), UTF8LineEndOverlaps(), utf8LineEnds, and utf8Substance.
Referenced by DeleteChars(), PerformRedoStep(), and PerformUndoStep().
|
private |
Actions without undo.
Definition at line 955 of file CellBuffer.cxx.
References hasStyles, InsertLine(), MaintainingLineCharacterIndex(), PLATFORM_ASSERT, plv, position, ptr, RecalculateIndexLineStarts(), RemoveLine(), style, substance, Scintilla::UTF8IsAscii(), UTF8IsCharacterBoundary(), Scintilla::UTF8IsMultibyteLineEnd(), Scintilla::UTF8IsNEL(), Scintilla::UTF8IsSeparator(), Scintilla::UTF8IsTrailByte(), Scintilla::UTF8IsValid(), UTF8LineEndOverlaps(), utf8LineEnds, Scintilla::UTF8SeparatorLength, and utf8Substance.
Referenced by InsertString(), PerformRedoStep(), and PerformUndoStep().
void CellBuffer::BeginUndoAction | ( | ) |
Definition at line 1236 of file CellBuffer.cxx.
References Scintilla::UndoHistory::BeginUndoAction(), and uh.
Referenced by Scintilla::Document::BeginUndoAction().
const char * CellBuffer::BufferPointer | ( | ) |
Definition at line 628 of file CellBuffer.cxx.
References substance.
Referenced by Scintilla::Document::BufferPointer().
|
noexcept |
Definition at line 1279 of file CellBuffer.cxx.
References Scintilla::UndoHistory::CanRedo(), and uh.
Referenced by Scintilla::Document::CanRedo().
|
noexcept |
To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is called that many times.
Similarly for redo.
Definition at line 1253 of file CellBuffer.cxx.
References Scintilla::UndoHistory::CanUndo(), and uh.
Referenced by Scintilla::Document::CanUndo().
|
noexcept |
Retrieving positions outside the range of the buffer works and returns 0.
Definition at line 582 of file CellBuffer.cxx.
References position.
Referenced by Scintilla::Document::CharAt(), Scintilla::Document::ConvertLineEnds(), Scintilla::Document::FindColumn(), Scintilla::Document::FindText(), Scintilla::Document::GetColumn(), Scintilla::Document::GetLineIndentation(), Scintilla::Document::GetLineIndentPosition(), Scintilla::Document::IsWhiteLine(), Scintilla::Document::LineEnd(), and Scintilla::Document::VCHomePosition().
|
noexcept |
Definition at line 729 of file CellBuffer.cxx.
References Scintilla::UTF8IsMultibyteLineEnd().
Referenced by Scintilla::Document::ContainsLineEnd().
const char * CellBuffer::DeleteChars | ( | Sci::Position | position, |
Sci::Position | deleteLength, | ||
bool & | startSequence | ||
) |
Definition at line 688 of file CellBuffer.cxx.
References Scintilla::UndoHistory::AppendAction(), BasicDeleteChars(), collectingUndo, PLATFORM_ASSERT, position, readOnly, Scintilla::removeAction, substance, and uh.
Referenced by Scintilla::Document::DeleteChars().
void CellBuffer::DeleteUndoHistory | ( | ) |
Definition at line 1249 of file CellBuffer.cxx.
References Scintilla::UndoHistory::DeleteUndoHistory(), and uh.
Referenced by Scintilla::Document::DeleteUndoHistory().
void CellBuffer::EndUndoAction | ( | ) |
Definition at line 1240 of file CellBuffer.cxx.
References Scintilla::UndoHistory::EndUndoAction(), and uh.
Referenced by Scintilla::Document::EndUndoAction().
|
noexcept |
Definition at line 636 of file CellBuffer.cxx.
References substance.
Referenced by Scintilla::Document::GapPosition().
void CellBuffer::GetCharRange | ( | char * | buffer, |
Sci::Position | position, | ||
Sci::Position | lengthRetrieve | ||
) | const |
Definition at line 590 of file CellBuffer.cxx.
References Scintilla::Platform::DebugPrintf(), position, and substance.
Referenced by BasicDeleteChars(), Scintilla::Document::GetCharRange(), and RecalculateIndexLineStarts().
|
inlinenoexcept |
Definition at line 157 of file CellBuffer.h.
Referenced by Scintilla::Document::GetLineEndTypesActive(), Scintilla::Document::GetLineEndTypesAllowed(), Scintilla::Document::LineEnd(), and Scintilla::Document::SetLineEndTypesAllowed().
const Action & CellBuffer::GetRedoStep | ( | ) | const |
Definition at line 1287 of file CellBuffer.cxx.
References Scintilla::UndoHistory::GetRedoStep(), and uh.
Referenced by Scintilla::Document::Redo().
void CellBuffer::GetStyleRange | ( | unsigned char * | buffer, |
Sci::Position | position, | ||
Sci::Position | lengthRetrieve | ||
) | const |
Definition at line 609 of file CellBuffer.cxx.
References Scintilla::Platform::DebugPrintf(), fill, hasStyles, position, and style.
Referenced by Scintilla::Document::GetStyleRange().
const Action & CellBuffer::GetUndoStep | ( | ) | const |
Definition at line 1261 of file CellBuffer.cxx.
References Scintilla::UndoHistory::GetUndoStep(), and uh.
Referenced by Scintilla::Document::TentativeUndo(), and Scintilla::Document::Undo().
|
noexcept |
Definition at line 805 of file CellBuffer.cxx.
References hasStyles.
Referenced by Scintilla::Document::Options().
|
noexcept |
Definition at line 785 of file CellBuffer.cxx.
References line.
void CellBuffer::InsertLine | ( | Sci::Line | line, |
Sci::Position | position, | ||
bool | lineStart | ||
) |
Definition at line 835 of file CellBuffer.cxx.
References line, plv, and position.
Referenced by BasicInsertString(), and ResetLineEnds().
const char * CellBuffer::InsertString | ( | Sci::Position | position, |
const char * | s, | ||
Sci::Position | insertLength, | ||
bool & | startSequence | ||
) |
Definition at line 641 of file CellBuffer.cxx.
References Scintilla::UndoHistory::AppendAction(), BasicInsertString(), collectingUndo, Scintilla::insertAction, position, readOnly, and uh.
Referenced by Scintilla::Document::InsertString().
|
noexcept |
Definition at line 1232 of file CellBuffer.cxx.
References collectingUndo.
Referenced by Scintilla::Document::DeleteChars(), Scintilla::Document::InsertString(), Scintilla::Document::IsCollectingUndo(), Scintilla::Document::Redo(), and Scintilla::Document::Undo().
|
noexcept |
Definition at line 801 of file CellBuffer.cxx.
References largeDocument.
Referenced by Scintilla::Document::IsLarge().
|
noexcept |
Definition at line 793 of file CellBuffer.cxx.
References readOnly.
Referenced by Scintilla::Document::CheckReadOnly(), Scintilla::Document::DeleteChars(), Scintilla::Document::InsertString(), Scintilla::Document::IsReadOnly(), Scintilla::Document::Redo(), Scintilla::Document::TentativeUndo(), and Scintilla::Document::Undo().
|
noexcept |
Definition at line 813 of file CellBuffer.cxx.
References Scintilla::UndoHistory::IsSavePoint(), and uh.
Referenced by Scintilla::Document::DeleteChars(), Scintilla::Document::InsertString(), Scintilla::Document::IsSavePoint(), Scintilla::Document::Redo(), Scintilla::Document::TentativeUndo(), and Scintilla::Document::Undo().
|
noexcept |
Definition at line 705 of file CellBuffer.cxx.
References substance.
Referenced by Scintilla::Document::Length(), Scintilla::Document::LengthNoExcept(), ResetLineEnds(), and UTF8IsCharacterBoundary().
|
noexcept |
Definition at line 751 of file CellBuffer.cxx.
References plv.
Referenced by Scintilla::Document::LineCharacterIndex().
|
noexcept |
Definition at line 781 of file CellBuffer.cxx.
References pos.
Referenced by Scintilla::Document::LineFromPosition().
|
noexcept |
Definition at line 789 of file CellBuffer.cxx.
References pos.
|
noexcept |
Definition at line 768 of file CellBuffer.cxx.
References plv.
Referenced by AllocateLineCharacterIndex(), and Scintilla::Document::LinesTotal().
|
noexcept |
Definition at line 772 of file CellBuffer.cxx.
References line.
Referenced by Scintilla::Document::LineStart(), and RecalculateIndexLineStarts().
|
privatenoexcept |
Definition at line 936 of file CellBuffer.cxx.
References plv, and SC_LINECHARACTERINDEX_NONE.
Referenced by BasicDeleteChars(), and BasicInsertString().
|
delete |
|
delete |
void CellBuffer::PerformRedoStep | ( | ) |
Definition at line 1291 of file CellBuffer.cxx.
References Scintilla::Action::at, BasicDeleteChars(), BasicInsertString(), Scintilla::UndoHistory::CompletedRedoStep(), Scintilla::Action::data, Scintilla::UndoHistory::GetRedoStep(), Scintilla::insertAction, Scintilla::Action::lenData, Scintilla::Action::position, Scintilla::removeAction, and uh.
Referenced by Scintilla::Document::Redo().
void CellBuffer::PerformUndoStep | ( | ) |
Definition at line 1265 of file CellBuffer.cxx.
References Scintilla::Action::at, BasicDeleteChars(), BasicInsertString(), Scintilla::UndoHistory::CompletedUndoStep(), Scintilla::Action::data, Scintilla::UndoHistory::GetUndoStep(), Scintilla::insertAction, Scintilla::Action::lenData, Scintilla::Action::position, Scintilla::removeAction, substance, and uh.
Referenced by Scintilla::Document::TentativeUndo(), and Scintilla::Document::Undo().
|
noexcept |
Definition at line 632 of file CellBuffer.cxx.
References position.
Referenced by Scintilla::Document::RangePointer().
Definition at line 940 of file CellBuffer.cxx.
References GetCharRange(), line, LineStart(), plv, and text.
Referenced by AllocateLineCharacterIndex(), BasicDeleteChars(), and BasicInsertString().
void CellBuffer::ReleaseLineCharacterIndex | ( | int | lineCharacterIndex | ) |
Definition at line 764 of file CellBuffer.cxx.
References plv.
Referenced by Scintilla::Document::ReleaseLineCharacterIndex().
void CellBuffer::RemoveLine | ( | Sci::Line | line | ) |
Definition at line 839 of file CellBuffer.cxx.
Referenced by BasicDeleteChars(), and BasicInsertString().
|
private |
Definition at line 884 of file CellBuffer.cxx.
References InsertLine(), Length(), plv, position, substance, Scintilla::UTF8IsMultibyteLineEnd(), and utf8LineEnds.
Referenced by SetLineEndTypes().
void CellBuffer::SetLineEndTypes | ( | int | utf8LineEnds_ | ) |
Definition at line 720 of file CellBuffer.cxx.
References AllocateLineCharacterIndex(), plv, ResetLineEnds(), and utf8LineEnds.
Referenced by Scintilla::Document::SetDBCSCodePage(), and Scintilla::Document::SetLineEndTypesAllowed().
|
noexcept |
Definition at line 747 of file CellBuffer.cxx.
Referenced by Scintilla::Document::Document().
|
noexcept |
Definition at line 797 of file CellBuffer.cxx.
References set.
Referenced by Scintilla::Document::SetReadOnly().
void CellBuffer::SetSavePoint | ( | ) |
The save point is a marker in the undo stack where the container has stated that the buffer was saved.
Undo and redo can move over the save point.
Definition at line 809 of file CellBuffer.cxx.
References Scintilla::UndoHistory::SetSavePoint(), and uh.
Referenced by Scintilla::Document::SetSavePoint().
|
noexcept |
Setting styles for positions outside the range of the buffer is safe and has no effect.
Definition at line 656 of file CellBuffer.cxx.
References position.
Referenced by Scintilla::Document::SetStyles().
|
noexcept |
Definition at line 669 of file CellBuffer.cxx.
References PLATFORM_ASSERT, and position.
Referenced by Scintilla::Document::SetStyleFor().
bool CellBuffer::SetUndoCollection | ( | bool | collectUndo | ) |
Definition at line 1226 of file CellBuffer.cxx.
References collectingUndo, Scintilla::UndoHistory::DropUndoSequence(), and uh.
Referenced by Scintilla::Document::SetUndoCollection().
|
noexcept |
Definition at line 716 of file CellBuffer.cxx.
Referenced by Scintilla::Document::Document(), and Scintilla::Document::SetDBCSCodePage().
int CellBuffer::StartRedo | ( | ) |
Definition at line 1283 of file CellBuffer.cxx.
References Scintilla::UndoHistory::StartRedo(), and uh.
Referenced by Scintilla::Document::Redo().
int CellBuffer::StartUndo | ( | ) |
Definition at line 1257 of file CellBuffer.cxx.
References Scintilla::UndoHistory::StartUndo(), and uh.
Referenced by Scintilla::Document::Undo().
|
noexcept |
Definition at line 605 of file CellBuffer.cxx.
References position.
Referenced by Scintilla::Document::StyleAt(), and Scintilla::Document::StyleIndexAt().
|
noexcept |
Definition at line 829 of file CellBuffer.cxx.
References Scintilla::UndoHistory::TentativeActive(), and uh.
Referenced by Scintilla::Document::TentativeActive().
void CellBuffer::TentativeCommit | ( | ) |
Definition at line 821 of file CellBuffer.cxx.
References Scintilla::UndoHistory::TentativeCommit(), and uh.
Referenced by Scintilla::Document::TentativeCommit(), and Scintilla::Document::TentativeUndo().
void CellBuffer::TentativeStart | ( | ) |
Definition at line 817 of file CellBuffer.cxx.
References Scintilla::UndoHistory::TentativeStart(), and uh.
Referenced by Scintilla::Document::TentativeStart().
|
noexcept |
Definition at line 825 of file CellBuffer.cxx.
References Scintilla::UndoHistory::TentativeSteps(), and uh.
Referenced by Scintilla::Document::TentativeUndo().
|
noexcept |
Definition at line 586 of file CellBuffer.cxx.
References position.
Referenced by Scintilla::Document::FindText(), Scintilla::Document::GetCharacterAndWidth(), and Scintilla::Document::LineEnd().
|
private |
Definition at line 853 of file CellBuffer.cxx.
References Length(), position, substance, Scintilla::UTF8Classify(), Scintilla::UTF8IsTrailByte(), Scintilla::UTF8MaskInvalid, and Scintilla::UTF8MaxBytes.
Referenced by BasicDeleteChars(), and BasicInsertString().
|
privatenoexcept |
Definition at line 843 of file CellBuffer.cxx.
References bytes, position, Scintilla::UTF8IsNEL(), and Scintilla::UTF8IsSeparator().
Referenced by BasicDeleteChars(), and BasicInsertString().
|
private |
Definition at line 120 of file CellBuffer.h.
Referenced by CellBuffer(), DeleteChars(), InsertString(), IsCollectingUndo(), and SetUndoCollection().
|
private |
Definition at line 112 of file CellBuffer.h.
Referenced by Allocate(), BasicDeleteChars(), BasicInsertString(), GetStyleRange(), and HasStyles().
|
private |
Definition at line 113 of file CellBuffer.h.
Referenced by CellBuffer(), and IsLarge().
|
private |
Definition at line 123 of file CellBuffer.h.
Referenced by AllocateLineCharacterIndex(), BasicDeleteChars(), BasicInsertString(), CellBuffer(), InsertLine(), LineCharacterIndex(), Lines(), MaintainingLineCharacterIndex(), RecalculateIndexLineStarts(), ReleaseLineCharacterIndex(), RemoveLine(), ResetLineEnds(), and SetLineEndTypes().
|
private |
Definition at line 116 of file CellBuffer.h.
Referenced by CellBuffer(), DeleteChars(), InsertString(), and IsReadOnly().
|
private |
Definition at line 115 of file CellBuffer.h.
Referenced by Allocate(), BasicDeleteChars(), BasicInsertString(), and GetStyleRange().
|
private |
Definition at line 114 of file CellBuffer.h.
Referenced by Allocate(), BasicDeleteChars(), BasicInsertString(), BufferPointer(), DeleteChars(), GapPosition(), GetCharRange(), Length(), PerformUndoStep(), ResetLineEnds(), and UTF8IsCharacterBoundary().
|
private |
Definition at line 121 of file CellBuffer.h.
Referenced by AddUndoAction(), BeginUndoAction(), CanRedo(), CanUndo(), DeleteChars(), DeleteUndoHistory(), EndUndoAction(), GetRedoStep(), GetUndoStep(), InsertString(), IsSavePoint(), PerformRedoStep(), PerformUndoStep(), SetSavePoint(), SetUndoCollection(), StartRedo(), StartUndo(), TentativeActive(), TentativeCommit(), TentativeStart(), and TentativeSteps().
|
private |
Definition at line 118 of file CellBuffer.h.
Referenced by BasicDeleteChars(), BasicInsertString(), CellBuffer(), ResetLineEnds(), and SetLineEndTypes().
|
private |
Definition at line 117 of file CellBuffer.h.
Referenced by AllocateLineCharacterIndex(), BasicDeleteChars(), BasicInsertString(), and CellBuffer().