yaze 0.2.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
TextEditor Class Reference

#include <text_editor.h>

Collaboration diagram for TextEditor:

Classes

struct  Breakpoint
 
struct  Coordinates
 
struct  EditorState
 
struct  Glyph
 
struct  Identifier
 
struct  LanguageDefinition
 
class  UndoRecord
 

Public Types

enum class  PaletteIndex {
  Default , Keyword , Number , String ,
  CharLiteral , Punctuation , Preprocessor , Identifier ,
  KnownIdentifier , PreprocIdentifier , Comment , MultiLineComment ,
  Background , Cursor , Selection , ErrorMarker ,
  Breakpoint , LineNumber , CurrentLineFill , CurrentLineFillInactive ,
  CurrentLineEdge , Max
}
 
enum class  SelectionMode { Normal , Word , Line }
 
typedef std::string String
 
typedef std::unordered_map< std::string, IdentifierIdentifiers
 
typedef std::unordered_set< std::string > Keywords
 
typedef std::map< int, std::string > ErrorMarkers
 
typedef std::unordered_set< int > Breakpoints
 
typedef std::array< ImU32,(unsigned) PaletteIndex::MaxPalette
 
typedef uint8_t Char
 
typedef std::vector< GlyphLine
 
typedef std::vector< LineLines
 

Public Member Functions

 TextEditor ()
 
 ~TextEditor ()
 
void SetLanguageDefinition (const LanguageDefinition &aLanguageDef)
 
const LanguageDefinitionGetLanguageDefinition () const
 
const PaletteGetPalette () const
 
void SetPalette (const Palette &aValue)
 
void SetErrorMarkers (const ErrorMarkers &aMarkers)
 
void SetBreakpoints (const Breakpoints &aMarkers)
 
void Render (const char *aTitle, const ImVec2 &aSize=ImVec2(), bool aBorder=false)
 
void SetText (const std::string &aText)
 
std::string GetText () const
 
void SetTextLines (const std::vector< std::string > &aLines)
 
std::vector< std::string > GetTextLines () const
 
std::string GetSelectedText () const
 
std::string GetCurrentLineText () const
 
int GetTotalLines () const
 
bool IsOverwrite () const
 
void SetReadOnly (bool aValue)
 
bool IsReadOnly () const
 
bool IsTextChanged () const
 
bool IsCursorPositionChanged () const
 
bool IsColorizerEnabled () const
 
void SetColorizerEnable (bool aValue)
 
Coordinates GetCursorPosition () const
 
void SetCursorPosition (const Coordinates &aPosition)
 
void SetHandleMouseInputs (bool aValue)
 
bool IsHandleMouseInputsEnabled () const
 
void SetHandleKeyboardInputs (bool aValue)
 
bool IsHandleKeyboardInputsEnabled () const
 
void SetImGuiChildIgnored (bool aValue)
 
bool IsImGuiChildIgnored () const
 
void SetShowWhitespaces (bool aValue)
 
bool IsShowingWhitespaces () const
 
void SetTabSize (int aValue)
 
int GetTabSize () const
 
void InsertText (const std::string &aValue)
 
void InsertText (const char *aValue)
 
void MoveUp (int aAmount=1, bool aSelect=false)
 
void MoveDown (int aAmount=1, bool aSelect=false)
 
void MoveLeft (int aAmount=1, bool aSelect=false, bool aWordMode=false)
 
void MoveRight (int aAmount=1, bool aSelect=false, bool aWordMode=false)
 
void MoveTop (bool aSelect=false)
 
void MoveBottom (bool aSelect=false)
 
void MoveHome (bool aSelect=false)
 
void MoveEnd (bool aSelect=false)
 
void SetSelectionStart (const Coordinates &aPosition)
 
void SetSelectionEnd (const Coordinates &aPosition)
 
void SetSelection (const Coordinates &aStart, const Coordinates &aEnd, SelectionMode aMode=SelectionMode::Normal)
 
void SelectWordUnderCursor ()
 
void SelectAll ()
 
bool HasSelection () const
 
void Copy ()
 
void Cut ()
 
void Paste ()
 
void Delete ()
 
bool CanUndo () const
 
bool CanRedo () const
 
void Undo (int aSteps=1)
 
void Redo (int aSteps=1)
 

Static Public Member Functions

static const PaletteGetDarkPalette ()
 
static const PaletteGetLightPalette ()
 
static const PaletteGetRetroBluePalette ()
 

Private Types

typedef std::vector< std::pair< std::regex, PaletteIndex > > RegexList
 
typedef std::vector< UndoRecordUndoBuffer
 

Private Member Functions

void ProcessInputs ()
 
void Colorize (int aFromLine=0, int aCount=-1)
 
void ColorizeRange (int aFromLine=0, int aToLine=0)
 
void ColorizeInternal ()
 
float TextDistanceToLineStart (const Coordinates &aFrom) const
 
void EnsureCursorVisible ()
 
int GetPageSize () const
 
std::string GetText (const Coordinates &aStart, const Coordinates &aEnd) const
 
Coordinates GetActualCursorCoordinates () const
 
Coordinates SanitizeCoordinates (const Coordinates &aValue) const
 
void Advance (Coordinates &aCoordinates) const
 
void DeleteRange (const Coordinates &aStart, const Coordinates &aEnd)
 
int InsertTextAt (Coordinates &aWhere, const char *aValue)
 
void AddUndo (UndoRecord &aValue)
 
Coordinates ScreenPosToCoordinates (const ImVec2 &aPosition) const
 
Coordinates FindWordStart (const Coordinates &aFrom) const
 
Coordinates FindWordEnd (const Coordinates &aFrom) const
 
Coordinates FindNextWord (const Coordinates &aFrom) const
 
int GetCharacterIndex (const Coordinates &aCoordinates) const
 
int GetCharacterColumn (int aLine, int aIndex) const
 
int GetLineCharacterCount (int aLine) const
 
int GetLineMaxColumn (int aLine) const
 
bool IsOnWordBoundary (const Coordinates &aAt) const
 
void RemoveLine (int aStart, int aEnd)
 
void RemoveLine (int aIndex)
 
LineInsertLine (int aIndex)
 
void EnterCharacter (ImWchar aChar, bool aShift)
 
void Backspace ()
 
void DeleteSelection ()
 
std::string GetWordUnderCursor () const
 
std::string GetWordAt (const Coordinates &aCoords) const
 
ImU32 GetGlyphColor (const Glyph &aGlyph) const
 
void HandleKeyboardInputs ()
 
void HandleMouseInputs ()
 
void Render ()
 

Private Attributes

float mLineSpacing
 
Lines mLines
 
EditorState mState
 
UndoBuffer mUndoBuffer
 
int mUndoIndex
 
int mTabSize
 
bool mOverwrite
 
bool mReadOnly
 
bool mWithinRender
 
bool mScrollToCursor
 
bool mScrollToTop
 
bool mTextChanged
 
bool mColorizerEnabled
 
float mTextStart
 
int mLeftMargin
 
bool mCursorPositionChanged
 
int mColorRangeMin
 
int mColorRangeMax
 
SelectionMode mSelectionMode
 
bool mHandleKeyboardInputs
 
bool mHandleMouseInputs
 
bool mIgnoreImGuiChild
 
bool mShowWhitespaces
 
Palette mPaletteBase
 
Palette mPalette
 
LanguageDefinition mLanguageDefinition
 
RegexList mRegexList
 
bool mCheckComments
 
Breakpoints mBreakpoints
 
ErrorMarkers mErrorMarkers
 
ImVec2 mCharAdvance
 
Coordinates mInteractiveStart
 
Coordinates mInteractiveEnd
 
std::string mLineBuffer
 
uint64_t mStartTime
 
float mLastClick
 

Detailed Description

Definition at line 17 of file text_editor.h.

Member Typedef Documentation

◆ String

typedef std::string TextEditor::String

Definition at line 108 of file text_editor.h.

◆ Identifiers

typedef std::unordered_map<std::string, Identifier> TextEditor::Identifiers

Definition at line 109 of file text_editor.h.

◆ Keywords

typedef std::unordered_set<std::string> TextEditor::Keywords

Definition at line 110 of file text_editor.h.

◆ ErrorMarkers

typedef std::map<int, std::string> TextEditor::ErrorMarkers

Definition at line 111 of file text_editor.h.

◆ Breakpoints

typedef std::unordered_set<int> TextEditor::Breakpoints

Definition at line 112 of file text_editor.h.

◆ Palette

typedef std::array<ImU32, (unsigned)PaletteIndex::Max> TextEditor::Palette

Definition at line 113 of file text_editor.h.

◆ Char

typedef uint8_t TextEditor::Char

Definition at line 114 of file text_editor.h.

◆ Line

typedef std::vector<Glyph> TextEditor::Line

Definition at line 131 of file text_editor.h.

◆ Lines

typedef std::vector<Line> TextEditor::Lines

Definition at line 132 of file text_editor.h.

◆ RegexList

typedef std::vector<std::pair<std::regex, PaletteIndex> > TextEditor::RegexList
private

Definition at line 268 of file text_editor.h.

◆ UndoBuffer

typedef std::vector<UndoRecord> TextEditor::UndoBuffer
private

Definition at line 307 of file text_editor.h.

Member Enumeration Documentation

◆ PaletteIndex

enum class TextEditor::PaletteIndex
strong
Enumerator
Default 
Keyword 
Number 
String 
CharLiteral 
Punctuation 
Preprocessor 
Identifier 
KnownIdentifier 
PreprocIdentifier 
Comment 
MultiLineComment 
Background 
Cursor 
Selection 
ErrorMarker 
Breakpoint 
LineNumber 
CurrentLineFill 
CurrentLineFillInactive 
CurrentLineEdge 
Max 

Definition at line 19 of file text_editor.h.

◆ SelectionMode

enum class TextEditor::SelectionMode
strong
Enumerator
Normal 
Word 
Line 

Definition at line 44 of file text_editor.h.

Constructor & Destructor Documentation

◆ TextEditor()

◆ ~TextEditor()

TextEditor::~TextEditor ( )

Definition at line 55 of file text_editor.cc.

Member Function Documentation

◆ SetLanguageDefinition()

void TextEditor::SetLanguageDefinition ( const LanguageDefinition & aLanguageDef)

Definition at line 57 of file text_editor.cc.

References Colorize(), mLanguageDefinition, and mRegexList.

Referenced by TextEditor().

Here is the call graph for this function:

◆ GetLanguageDefinition()

const LanguageDefinition & TextEditor::GetLanguageDefinition ( ) const
inline

Definition at line 175 of file text_editor.h.

References mLanguageDefinition.

◆ GetPalette()

const Palette & TextEditor::GetPalette ( ) const
inline

Definition at line 179 of file text_editor.h.

References mPaletteBase.

◆ SetPalette()

void TextEditor::SetPalette ( const Palette & aValue)

Definition at line 68 of file text_editor.cc.

References mPaletteBase.

Referenced by TextEditor().

◆ SetErrorMarkers()

void TextEditor::SetErrorMarkers ( const ErrorMarkers & aMarkers)
inline

Definition at line 182 of file text_editor.h.

References mErrorMarkers.

◆ SetBreakpoints()

void TextEditor::SetBreakpoints ( const Breakpoints & aMarkers)
inline

Definition at line 185 of file text_editor.h.

References mBreakpoints.

◆ Render() [1/2]

void TextEditor::Render ( const char * aTitle,
const ImVec2 & aSize = ImVec2(),
bool aBorder = false )

◆ SetText()

void TextEditor::SetText ( const std::string & aText)

Definition at line 1087 of file text_editor.cc.

References Colorize(), Default, mLines, mScrollToTop, mTextChanged, mUndoBuffer, and mUndoIndex.

Here is the call graph for this function:

◆ GetText() [1/2]

std::string TextEditor::GetText ( ) const

Definition at line 1890 of file text_editor.cc.

References GetText(), and mLines.

Referenced by Delete(), EnterCharacter(), GetCurrentLineText(), GetSelectedText(), and GetText().

Here is the call graph for this function:

◆ SetTextLines()

void TextEditor::SetTextLines ( const std::vector< std::string > & aLines)

Definition at line 1109 of file text_editor.cc.

References Colorize(), Default, mLines, mScrollToTop, mTextChanged, mUndoBuffer, and mUndoIndex.

Here is the call graph for this function:

◆ GetTextLines()

std::vector< std::string > TextEditor::GetTextLines ( ) const

Definition at line 1894 of file text_editor.cc.

References mLines.

◆ GetSelectedText()

std::string TextEditor::GetSelectedText ( ) const

Definition at line 1912 of file text_editor.cc.

References GetText(), and mState.

Referenced by Backspace(), Copy(), Cut(), Delete(), EnterCharacter(), and Paste().

Here is the call graph for this function:

◆ GetCurrentLineText()

std::string TextEditor::GetCurrentLineText ( ) const

Definition at line 1916 of file text_editor.cc.

References GetLineMaxColumn(), GetText(), and mState.

Here is the call graph for this function:

◆ GetTotalLines()

int TextEditor::GetTotalLines ( ) const
inline

Definition at line 198 of file text_editor.h.

References mLines.

◆ IsOverwrite()

bool TextEditor::IsOverwrite ( ) const
inline

Definition at line 199 of file text_editor.h.

References mOverwrite.

◆ SetReadOnly()

void TextEditor::SetReadOnly ( bool aValue)

Definition at line 1293 of file text_editor.cc.

References mReadOnly.

◆ IsReadOnly()

bool TextEditor::IsReadOnly ( ) const
inline

Definition at line 202 of file text_editor.h.

References mReadOnly.

Referenced by Cut(), HandleKeyboardInputs(), and Paste().

◆ IsTextChanged()

bool TextEditor::IsTextChanged ( ) const
inline

Definition at line 203 of file text_editor.h.

References mTextChanged.

◆ IsCursorPositionChanged()

bool TextEditor::IsCursorPositionChanged ( ) const
inline

Definition at line 204 of file text_editor.h.

References mCursorPositionChanged.

◆ IsColorizerEnabled()

bool TextEditor::IsColorizerEnabled ( ) const
inline

Definition at line 206 of file text_editor.h.

References mColorizerEnabled.

◆ SetColorizerEnable()

void TextEditor::SetColorizerEnable ( bool aValue)

Definition at line 1295 of file text_editor.cc.

References mColorizerEnabled.

◆ GetCursorPosition()

Coordinates TextEditor::GetCursorPosition ( ) const
inline

Definition at line 209 of file text_editor.h.

References GetActualCursorCoordinates().

Referenced by GetWordUnderCursor(), and SelectWordUnderCursor().

Here is the call graph for this function:

◆ SetCursorPosition()

void TextEditor::SetCursorPosition ( const Coordinates & aPosition)

Definition at line 1297 of file text_editor.cc.

References EnsureCursorVisible(), mCursorPositionChanged, and mState.

Referenced by Backspace(), Delete(), DeleteSelection(), EnterCharacter(), InsertText(), MoveEnd(), MoveHome(), and MoveTop().

Here is the call graph for this function:

◆ SetHandleMouseInputs()

void TextEditor::SetHandleMouseInputs ( bool aValue)
inline

Definition at line 212 of file text_editor.h.

References mHandleMouseInputs.

◆ IsHandleMouseInputsEnabled()

bool TextEditor::IsHandleMouseInputsEnabled ( ) const
inline

Definition at line 213 of file text_editor.h.

References mHandleKeyboardInputs.

◆ SetHandleKeyboardInputs()

void TextEditor::SetHandleKeyboardInputs ( bool aValue)
inline

Definition at line 217 of file text_editor.h.

References mHandleKeyboardInputs.

◆ IsHandleKeyboardInputsEnabled()

bool TextEditor::IsHandleKeyboardInputsEnabled ( ) const
inline

Definition at line 220 of file text_editor.h.

References mHandleKeyboardInputs.

◆ SetImGuiChildIgnored()

void TextEditor::SetImGuiChildIgnored ( bool aValue)
inline

Definition at line 224 of file text_editor.h.

References mIgnoreImGuiChild.

◆ IsImGuiChildIgnored()

bool TextEditor::IsImGuiChildIgnored ( ) const
inline

Definition at line 225 of file text_editor.h.

References mIgnoreImGuiChild.

◆ SetShowWhitespaces()

void TextEditor::SetShowWhitespaces ( bool aValue)
inline

Definition at line 227 of file text_editor.h.

References mShowWhitespaces.

◆ IsShowingWhitespaces()

bool TextEditor::IsShowingWhitespaces ( ) const
inline

Definition at line 228 of file text_editor.h.

References mShowWhitespaces.

◆ SetTabSize()

void TextEditor::SetTabSize ( int aValue)

Definition at line 1353 of file text_editor.cc.

References mTabSize.

◆ GetTabSize()

int TextEditor::GetTabSize ( ) const
inline

Definition at line 231 of file text_editor.h.

References mTabSize.

◆ InsertText() [1/2]

void TextEditor::InsertText ( const std::string & aValue)

Definition at line 1357 of file text_editor.cc.

References InsertText().

Referenced by InsertText(), and Paste().

Here is the call graph for this function:

◆ InsertText() [2/2]

void TextEditor::InsertText ( const char * aValue)

◆ MoveUp()

void TextEditor::MoveUp ( int aAmount = 1,
bool aSelect = false )

Definition at line 1387 of file text_editor.cc.

References EnsureCursorVisible(), mInteractiveEnd, mInteractiveStart, mState, and SetSelection().

Referenced by HandleKeyboardInputs().

Here is the call graph for this function:

◆ MoveDown()

void TextEditor::MoveDown ( int aAmount = 1,
bool aSelect = false )

Definition at line 1409 of file text_editor.cc.

References EnsureCursorVisible(), mInteractiveEnd, mInteractiveStart, mLines, mState, and SetSelection().

Referenced by HandleKeyboardInputs().

Here is the call graph for this function:

◆ MoveLeft()

void TextEditor::MoveLeft ( int aAmount = 1,
bool aSelect = false,
bool aWordMode = false )

◆ MoveRight()

void TextEditor::MoveRight ( int aAmount = 1,
bool aSelect = false,
bool aWordMode = false )

◆ MoveTop()

void TextEditor::MoveTop ( bool aSelect = false)

Definition at line 1537 of file text_editor.cc.

References mInteractiveEnd, mInteractiveStart, mState, SetCursorPosition(), and SetSelection().

Referenced by HandleKeyboardInputs().

Here is the call graph for this function:

◆ MoveBottom()

void TextEditor::MoveBottom ( bool aSelect = false)

References Normal.

Referenced by HandleKeyboardInputs().

◆ MoveHome()

void TextEditor::MoveHome ( bool aSelect = false)

Definition at line 1563 of file text_editor.cc.

References mInteractiveEnd, mInteractiveStart, mState, SetCursorPosition(), and SetSelection().

Referenced by HandleKeyboardInputs().

Here is the call graph for this function:

◆ MoveEnd()

void TextEditor::MoveEnd ( bool aSelect = false)

Definition at line 1583 of file text_editor.cc.

References GetLineMaxColumn(), mInteractiveEnd, mInteractiveStart, mState, SetCursorPosition(), and SetSelection().

Referenced by HandleKeyboardInputs().

Here is the call graph for this function:

◆ SetSelectionStart()

void TextEditor::SetSelectionStart ( const Coordinates & aPosition)

Definition at line 1305 of file text_editor.cc.

References mState, and SanitizeCoordinates().

Here is the call graph for this function:

◆ SetSelectionEnd()

void TextEditor::SetSelectionEnd ( const Coordinates & aPosition)

Definition at line 1311 of file text_editor.cc.

References mState, and SanitizeCoordinates().

Here is the call graph for this function:

◆ SetSelection()

◆ SelectWordUnderCursor()

void TextEditor::SelectWordUnderCursor ( )

Definition at line 1723 of file text_editor.cc.

References FindWordEnd(), FindWordStart(), GetCursorPosition(), and SetSelection().

Here is the call graph for this function:

◆ SelectAll()

void TextEditor::SelectAll ( )

Definition at line 1728 of file text_editor.cc.

References mLines, and SetSelection().

Referenced by HandleKeyboardInputs().

Here is the call graph for this function:

◆ HasSelection()

bool TextEditor::HasSelection ( ) const

Definition at line 1732 of file text_editor.cc.

References mState.

Referenced by Backspace(), Copy(), Cut(), Delete(), EnterCharacter(), Paste(), and Render().

◆ Copy()

void TextEditor::Copy ( )

Definition at line 1736 of file text_editor.cc.

References GetActualCursorCoordinates(), GetSelectedText(), HasSelection(), TextEditor::Coordinates::mLine, and mLines.

Referenced by Cut(), and HandleKeyboardInputs().

Here is the call graph for this function:

◆ Cut()

◆ Paste()

◆ Delete()

◆ CanUndo()

bool TextEditor::CanUndo ( ) const

Definition at line 1795 of file text_editor.cc.

References mReadOnly, and mUndoIndex.

Referenced by Undo().

◆ CanRedo()

bool TextEditor::CanRedo ( ) const

Definition at line 1797 of file text_editor.cc.

References mReadOnly, mUndoBuffer, and mUndoIndex.

Referenced by Redo().

◆ Undo()

void TextEditor::Undo ( int aSteps = 1)

Definition at line 1801 of file text_editor.cc.

References CanUndo(), mUndoBuffer, and mUndoIndex.

Referenced by HandleKeyboardInputs().

Here is the call graph for this function:

◆ Redo()

void TextEditor::Redo ( int aSteps = 1)

Definition at line 1805 of file text_editor.cc.

References CanRedo(), mUndoBuffer, and mUndoIndex.

Referenced by HandleKeyboardInputs().

Here is the call graph for this function:

◆ GetDarkPalette()

const TextEditor::Palette & TextEditor::GetDarkPalette ( )
static

Definition at line 1809 of file text_editor.cc.

Referenced by yaze::editor::AssemblyEditor::AssemblyEditor(), and TextEditor().

◆ GetLightPalette()

const TextEditor::Palette & TextEditor::GetLightPalette ( )
static

Definition at line 1836 of file text_editor.cc.

◆ GetRetroBluePalette()

const TextEditor::Palette & TextEditor::GetRetroBluePalette ( )
static

Definition at line 1863 of file text_editor.cc.

◆ ProcessInputs()

void TextEditor::ProcessInputs ( )
private

Definition at line 1922 of file text_editor.cc.

◆ Colorize()

void TextEditor::Colorize ( int aFromLine = 0,
int aCount = -1 )
private

◆ ColorizeRange()

void TextEditor::ColorizeRange ( int aFromLine = 0,
int aToLine = 0 )
private

◆ ColorizeInternal()

void TextEditor::ColorizeInternal ( )
private

Definition at line 2026 of file text_editor.cc.

References ColorizeRange(), equals(), mCheckComments, mColorizerEnabled, mColorRangeMax, mColorRangeMin, mLanguageDefinition, and mLines.

Referenced by Render().

Here is the call graph for this function:

◆ TextDistanceToLineStart()

float TextEditor::TextDistanceToLineStart ( const Coordinates & aFrom) const
private

Definition at line 2157 of file text_editor.cc.

References GetCharacterIndex(), TextEditor::Coordinates::mLine, mLines, and mTabSize.

Referenced by EnsureCursorVisible(), and Render().

Here is the call graph for this function:

◆ EnsureCursorVisible()

void TextEditor::EnsureCursorVisible ( )
private

◆ GetPageSize()

int TextEditor::GetPageSize ( ) const
private

Definition at line 2221 of file text_editor.cc.

References mCharAdvance.

Referenced by HandleKeyboardInputs().

◆ GetText() [2/2]

std::string TextEditor::GetText ( const Coordinates & aStart,
const Coordinates & aEnd ) const
private

Definition at line 70 of file text_editor.cc.

References GetCharacterIndex(), TextEditor::Coordinates::mLine, and mLines.

Here is the call graph for this function:

◆ GetActualCursorCoordinates()

TextEditor::Coordinates TextEditor::GetActualCursorCoordinates ( ) const
private

Definition at line 101 of file text_editor.cc.

References mState, and SanitizeCoordinates().

Referenced by Backspace(), Copy(), Delete(), EnsureCursorVisible(), EnterCharacter(), GetCursorPosition(), InsertText(), MoveLeft(), and Paste().

Here is the call graph for this function:

◆ SanitizeCoordinates()

TextEditor::Coordinates TextEditor::SanitizeCoordinates ( const Coordinates & aValue) const
private

◆ Advance()

void TextEditor::Advance ( Coordinates & aCoordinates) const
private

Definition at line 172 of file text_editor.cc.

References GetCharacterColumn(), GetCharacterIndex(), TextEditor::Coordinates::mColumn, TextEditor::Coordinates::mLine, and mLines.

Referenced by Backspace(), and Delete().

Here is the call graph for this function:

◆ DeleteRange()

void TextEditor::DeleteRange ( const Coordinates & aStart,
const Coordinates & aEnd )
private

◆ InsertTextAt()

int TextEditor::InsertTextAt ( Coordinates & aWhere,
const char * aValue )
private

◆ AddUndo()

void TextEditor::AddUndo ( UndoRecord & aValue)
private

Definition at line 265 of file text_editor.cc.

References mReadOnly, mUndoBuffer, and mUndoIndex.

Referenced by Backspace(), Cut(), Delete(), EnterCharacter(), and Paste().

◆ ScreenPosToCoordinates()

TextEditor::Coordinates TextEditor::ScreenPosToCoordinates ( const ImVec2 & aPosition) const
private

Definition at line 283 of file text_editor.cc.

References mCharAdvance, mLines, mTabSize, mTextStart, and SanitizeCoordinates().

Referenced by HandleMouseInputs(), and Render().

Here is the call graph for this function:

◆ FindWordStart()

TextEditor::Coordinates TextEditor::FindWordStart ( const Coordinates & aFrom) const
private

Definition at line 335 of file text_editor.cc.

References GetCharacterColumn(), GetCharacterIndex(), TextEditor::Coordinates::mLine, and mLines.

Referenced by GetWordAt(), MoveLeft(), SelectWordUnderCursor(), and SetSelection().

Here is the call graph for this function:

◆ FindWordEnd()

TextEditor::Coordinates TextEditor::FindWordEnd ( const Coordinates & aFrom) const
private

Definition at line 363 of file text_editor.cc.

References GetCharacterColumn(), GetCharacterIndex(), TextEditor::Coordinates::mLine, and mLines.

Referenced by GetWordAt(), SelectWordUnderCursor(), and SetSelection().

Here is the call graph for this function:

◆ FindNextWord()

TextEditor::Coordinates TextEditor::FindNextWord ( const Coordinates & aFrom) const
private

Definition at line 391 of file text_editor.cc.

References GetCharacterColumn(), GetCharacterIndex(), GetLineMaxColumn(), TextEditor::Coordinates::mLine, and mLines.

Referenced by MoveRight().

Here is the call graph for this function:

◆ GetCharacterIndex()

◆ GetCharacterColumn()

int TextEditor::GetCharacterColumn ( int aLine,
int aIndex ) const
private

Definition at line 448 of file text_editor.cc.

References mLines, and mTabSize.

Referenced by Advance(), EnterCharacter(), FindNextWord(), FindWordEnd(), FindWordStart(), MoveLeft(), and MoveRight().

◆ GetLineCharacterCount()

int TextEditor::GetLineCharacterCount ( int aLine) const
private

Definition at line 464 of file text_editor.cc.

References mLines.

◆ GetLineMaxColumn()

int TextEditor::GetLineMaxColumn ( int aLine) const
private

◆ IsOnWordBoundary()

bool TextEditor::IsOnWordBoundary ( const Coordinates & aAt) const
private

Definition at line 487 of file text_editor.cc.

References GetCharacterIndex(), mColorizerEnabled, TextEditor::Coordinates::mColumn, TextEditor::Coordinates::mLine, and mLines.

Referenced by SetSelection().

Here is the call graph for this function:

◆ RemoveLine() [1/2]

void TextEditor::RemoveLine ( int aStart,
int aEnd )
private

Definition at line 500 of file text_editor.cc.

References mBreakpoints, mErrorMarkers, mLines, mReadOnly, and mTextChanged.

Referenced by Backspace(), Delete(), and DeleteRange().

◆ RemoveLine() [2/2]

void TextEditor::RemoveLine ( int aIndex)
private

Definition at line 527 of file text_editor.cc.

References mBreakpoints, mErrorMarkers, mLines, mReadOnly, and mTextChanged.

◆ InsertLine()

TextEditor::Line & TextEditor::InsertLine ( int aIndex)
private

Definition at line 553 of file text_editor.cc.

References mBreakpoints, mErrorMarkers, mLines, and mReadOnly.

Referenced by EnterCharacter(), and InsertTextAt().

◆ EnterCharacter()

◆ Backspace()

◆ DeleteSelection()

void TextEditor::DeleteSelection ( )
private

Definition at line 1375 of file text_editor.cc.

References Colorize(), DeleteRange(), mState, SetCursorPosition(), and SetSelection().

Referenced by Backspace(), Cut(), Delete(), EnterCharacter(), and Paste().

Here is the call graph for this function:

◆ GetWordUnderCursor()

std::string TextEditor::GetWordUnderCursor ( ) const
private

Definition at line 571 of file text_editor.cc.

References GetCursorPosition(), and GetWordAt().

Here is the call graph for this function:

◆ GetWordAt()

std::string TextEditor::GetWordAt ( const Coordinates & aCoords) const
private

Definition at line 576 of file text_editor.cc.

References FindWordEnd(), FindWordStart(), GetCharacterIndex(), TextEditor::Coordinates::mLine, and mLines.

Referenced by GetWordUnderCursor(), and Render().

Here is the call graph for this function:

◆ GetGlyphColor()

◆ HandleKeyboardInputs()

void TextEditor::HandleKeyboardInputs ( )
private

◆ HandleMouseInputs()

void TextEditor::HandleMouseInputs ( )
private

Definition at line 692 of file text_editor.cc.

References Line, mInteractiveEnd, mInteractiveStart, mLastClick, mSelectionMode, mState, Normal, ScreenPosToCoordinates(), SetSelection(), and Word.

Referenced by Render().

Here is the call graph for this function:

◆ Render() [2/2]

Member Data Documentation

◆ mLineSpacing

float TextEditor::mLineSpacing
private

Definition at line 346 of file text_editor.h.

Referenced by Render(), and TextEditor().

◆ mLines

◆ mState

◆ mUndoBuffer

UndoBuffer TextEditor::mUndoBuffer
private

Definition at line 349 of file text_editor.h.

Referenced by AddUndo(), CanRedo(), Redo(), SetText(), SetTextLines(), and Undo().

◆ mUndoIndex

int TextEditor::mUndoIndex
private

Definition at line 350 of file text_editor.h.

Referenced by AddUndo(), CanRedo(), CanUndo(), Redo(), SetText(), SetTextLines(), TextEditor(), and Undo().

◆ mTabSize

◆ mOverwrite

bool TextEditor::mOverwrite
private

Definition at line 353 of file text_editor.h.

Referenced by EnterCharacter(), HandleKeyboardInputs(), IsOverwrite(), Render(), and TextEditor().

◆ mReadOnly

◆ mWithinRender

bool TextEditor::mWithinRender
private

Definition at line 355 of file text_editor.h.

Referenced by EnsureCursorVisible(), Render(), and TextEditor().

◆ mScrollToCursor

bool TextEditor::mScrollToCursor
private

Definition at line 356 of file text_editor.h.

Referenced by EnsureCursorVisible(), Render(), and TextEditor().

◆ mScrollToTop

bool TextEditor::mScrollToTop
private

Definition at line 357 of file text_editor.h.

Referenced by Render(), SetText(), SetTextLines(), and TextEditor().

◆ mTextChanged

bool TextEditor::mTextChanged
private

◆ mColorizerEnabled

bool TextEditor::mColorizerEnabled
private

◆ mTextStart

float TextEditor::mTextStart
private

Definition at line 360 of file text_editor.h.

Referenced by EnsureCursorVisible(), Render(), ScreenPosToCoordinates(), and TextEditor().

◆ mLeftMargin

int TextEditor::mLeftMargin
private

Definition at line 362 of file text_editor.h.

Referenced by Render(), and TextEditor().

◆ mCursorPositionChanged

bool TextEditor::mCursorPositionChanged
private

◆ mColorRangeMin

int TextEditor::mColorRangeMin
private

Definition at line 364 of file text_editor.h.

Referenced by Colorize(), ColorizeInternal(), and TextEditor().

◆ mColorRangeMax

int TextEditor::mColorRangeMax
private

Definition at line 364 of file text_editor.h.

Referenced by Colorize(), ColorizeInternal(), and TextEditor().

◆ mSelectionMode

SelectionMode TextEditor::mSelectionMode
private

Definition at line 365 of file text_editor.h.

Referenced by HandleMouseInputs(), and TextEditor().

◆ mHandleKeyboardInputs

bool TextEditor::mHandleKeyboardInputs
private

◆ mHandleMouseInputs

bool TextEditor::mHandleMouseInputs
private

Definition at line 367 of file text_editor.h.

Referenced by Render(), SetHandleMouseInputs(), and TextEditor().

◆ mIgnoreImGuiChild

bool TextEditor::mIgnoreImGuiChild
private

Definition at line 368 of file text_editor.h.

Referenced by IsImGuiChildIgnored(), Render(), SetImGuiChildIgnored(), and TextEditor().

◆ mShowWhitespaces

bool TextEditor::mShowWhitespaces
private

Definition at line 369 of file text_editor.h.

Referenced by IsShowingWhitespaces(), Render(), SetShowWhitespaces(), and TextEditor().

◆ mPaletteBase

Palette TextEditor::mPaletteBase
private

Definition at line 371 of file text_editor.h.

Referenced by GetPalette(), Render(), and SetPalette().

◆ mPalette

Palette TextEditor::mPalette
private

Definition at line 372 of file text_editor.h.

Referenced by GetGlyphColor(), Render(), and Render().

◆ mLanguageDefinition

LanguageDefinition TextEditor::mLanguageDefinition
private

◆ mRegexList

RegexList TextEditor::mRegexList
private

Definition at line 374 of file text_editor.h.

Referenced by ColorizeRange(), and SetLanguageDefinition().

◆ mCheckComments

bool TextEditor::mCheckComments
private

Definition at line 376 of file text_editor.h.

Referenced by Colorize(), ColorizeInternal(), and TextEditor().

◆ mBreakpoints

Breakpoints TextEditor::mBreakpoints
private

Definition at line 377 of file text_editor.h.

Referenced by InsertLine(), RemoveLine(), RemoveLine(), Render(), and SetBreakpoints().

◆ mErrorMarkers

ErrorMarkers TextEditor::mErrorMarkers
private

Definition at line 378 of file text_editor.h.

Referenced by Backspace(), InsertLine(), RemoveLine(), RemoveLine(), Render(), and SetErrorMarkers().

◆ mCharAdvance

ImVec2 TextEditor::mCharAdvance
private

Definition at line 379 of file text_editor.h.

Referenced by EnsureCursorVisible(), GetPageSize(), Render(), and ScreenPosToCoordinates().

◆ mInteractiveStart

Coordinates TextEditor::mInteractiveStart
private

◆ mInteractiveEnd

Coordinates TextEditor::mInteractiveEnd
private

◆ mLineBuffer

std::string TextEditor::mLineBuffer
private

Definition at line 381 of file text_editor.h.

Referenced by Render().

◆ mStartTime

uint64_t TextEditor::mStartTime
private

Definition at line 382 of file text_editor.h.

Referenced by Render(), and TextEditor().

◆ mLastClick

float TextEditor::mLastClick
private

Definition at line 384 of file text_editor.h.

Referenced by HandleMouseInputs(), and TextEditor().


The documentation for this class was generated from the following files: