1#ifndef YAZE_APP_GUI_MODULES_TEXT_EDITOR_H
2#define YAZE_APP_GUI_MODULES_TEXT_EDITOR_H
11#include <unordered_map>
12#include <unordered_set>
131 typedef std::vector<Glyph>
Line;
138 const char*& out_begin,
139 const char*& out_end,
187 void Render(
const char* aTitle,
const ImVec2& aSize = ImVec2(),
188 bool aBorder =
false);
189 void SetText(
const std::string& aText);
192 void SetTextLines(
const std::vector<std::string>& aLines);
236 void MoveUp(
int aAmount = 1,
bool aSelect =
false);
237 void MoveDown(
int aAmount = 1,
bool aSelect =
false);
238 void MoveLeft(
int aAmount = 1,
bool aSelect =
false,
bool aWordMode =
false);
239 void MoveRight(
int aAmount = 1,
bool aSelect =
false,
bool aWordMode =
false);
240 void MoveTop(
bool aSelect =
false);
242 void MoveHome(
bool aSelect =
false);
243 void MoveEnd(
bool aSelect =
false);
260 void Undo(
int aSteps = 1);
261 void Redo(
int aSteps = 1);
268 typedef std::vector<std::pair<std::regex, PaletteIndex>>
RegexList;
285 const std::string& aRemoved,
310 void Colorize(
int aFromLine = 0,
int aCount = -1);
void Redo(TextEditor *aEditor)
Coordinates mRemovedStart
void Undo(TextEditor *aEditor)
void HandleKeyboardInputs()
void MoveBottom(bool aSelect=false)
void InsertText(const std::string &aValue)
ImU32 GetGlyphColor(const Glyph &aGlyph) const
std::unordered_set< std::string > Keywords
bool IsCursorPositionChanged() const
bool IsShowingWhitespaces() const
std::vector< std::string > GetTextLines() const
std::vector< Line > Lines
void SelectWordUnderCursor()
static const Palette & GetLightPalette()
void MoveLeft(int aAmount=1, bool aSelect=false, bool aWordMode=false)
void SetColorizerEnable(bool aValue)
void MoveHome(bool aSelect=false)
int GetLineMaxColumn(int aLine) const
void SetSelectionEnd(const Coordinates &aPosition)
static const Palette & GetDarkPalette()
void MoveEnd(bool aSelect=false)
std::string GetWordUnderCursor() const
static const Palette & GetRetroBluePalette()
int GetCharacterIndex(const Coordinates &aCoordinates) const
Coordinates GetCursorPosition() const
void EnsureCursorVisible()
void SetShowWhitespaces(bool aValue)
bool HasSelection() const
Coordinates FindWordStart(const Coordinates &aFrom) const
void Colorize(int aFromLine=0, int aCount=-1)
bool IsTextChanged() const
std::string GetWordAt(const Coordinates &aCoords) const
Coordinates FindNextWord(const Coordinates &aFrom) const
std::unordered_map< std::string, Identifier > Identifiers
void SetReadOnly(bool aValue)
std::string GetText() const
int GetCharacterColumn(int aLine, int aIndex) const
void SetSelectionStart(const Coordinates &aPosition)
void MoveTop(bool aSelect=false)
int GetTotalLines() const
void SetHandleKeyboardInputs(bool aValue)
std::string GetCurrentLineText() const
bool IsHandleMouseInputsEnabled() const
bool IsColorizerEnabled() const
const Palette & GetPalette() const
void AddUndo(UndoRecord &aValue)
void MoveUp(int aAmount=1, bool aSelect=false)
std::vector< Glyph > Line
Coordinates FindWordEnd(const Coordinates &aFrom) const
void SetPalette(const Palette &aValue)
std::map< int, std::string > ErrorMarkers
std::vector< std::pair< std::regex, PaletteIndex > > RegexList
void SetImGuiChildIgnored(bool aValue)
void RemoveLine(int aStart, int aEnd)
void SetBreakpoints(const Breakpoints &aMarkers)
void SetText(const std::string &aText)
void SetTextLines(const std::vector< std::string > &aLines)
float TextDistanceToLineStart(const Coordinates &aFrom) const
Coordinates SanitizeCoordinates(const Coordinates &aValue) const
ErrorMarkers mErrorMarkers
void ColorizeRange(int aFromLine=0, int aToLine=0)
bool IsImGuiChildIgnored() const
Line & InsertLine(int aIndex)
Coordinates mInteractiveEnd
bool mHandleKeyboardInputs
void EnterCharacter(ImWchar aChar, bool aShift)
void MoveDown(int aAmount=1, bool aSelect=false)
SelectionMode mSelectionMode
@ CurrentLineFillInactive
Coordinates mInteractiveStart
void Advance(Coordinates &aCoordinates) const
void SetErrorMarkers(const ErrorMarkers &aMarkers)
bool mCursorPositionChanged
bool IsOnWordBoundary(const Coordinates &aAt) const
Coordinates GetActualCursorCoordinates() const
const LanguageDefinition & GetLanguageDefinition() const
void SetCursorPosition(const Coordinates &aPosition)
std::unordered_set< int > Breakpoints
std::string GetSelectedText() const
int GetLineCharacterCount(int aLine) const
Coordinates ScreenPosToCoordinates(const ImVec2 &aPosition) const
void SetTabSize(int aValue)
void DeleteRange(const Coordinates &aStart, const Coordinates &aEnd)
void SetHandleMouseInputs(bool aValue)
std::array< ImU32,(unsigned) PaletteIndex::Max > Palette
bool IsHandleKeyboardInputsEnabled() const
int InsertTextAt(Coordinates &aWhere, const char *aValue)
void SetSelection(const Coordinates &aStart, const Coordinates &aEnd, SelectionMode aMode=SelectionMode::Normal)
LanguageDefinition mLanguageDefinition
std::vector< UndoRecord > UndoBuffer
void SetLanguageDefinition(const LanguageDefinition &aLanguageDef)
void MoveRight(int aAmount=1, bool aSelect=false, bool aWordMode=false)
bool operator<=(const Coordinates &o) const
static Coordinates Invalid()
bool operator==(const Coordinates &o) const
bool operator<(const Coordinates &o) const
bool operator>(const Coordinates &o) const
Coordinates(int aLine, int aColumn)
bool operator>=(const Coordinates &o) const
bool operator!=(const Coordinates &o) const
Coordinates mSelectionStart
Coordinates mSelectionEnd
Coordinates mCursorPosition
Glyph(Char aChar, PaletteIndex aColorIndex)
static const LanguageDefinition & SQL()
TokenRegexStrings mTokenRegexStrings
std::string mSingleLineComment
static const LanguageDefinition & Lua()
std::string mCommentStart
static const LanguageDefinition & C()
TokenizeCallback mTokenize
Identifiers mPreprocIdentifiers
static const LanguageDefinition & GLSL()
bool(* TokenizeCallback)(const char *in_begin, const char *in_end, const char *&out_begin, const char *&out_end, PaletteIndex &paletteIndex)
std::vector< TokenRegexString > TokenRegexStrings
static const LanguageDefinition & AngelScript()
static const LanguageDefinition & CPlusPlus()
std::pair< std::string, PaletteIndex > TokenRegexString
static const LanguageDefinition & HLSL()