1
0
mirror of synced 2025-02-20 20:21:33 +01:00

fix: Make sure all text editor members are correctly initialized

This commit is contained in:
WerWolv 2024-12-23 11:21:39 +01:00
parent 2cb4462274
commit 41b1228d31
2 changed files with 48 additions and 48 deletions

View File

@ -578,64 +578,64 @@ private:
void HandleMouseInputs(); void HandleMouseInputs();
void Render(); void Render();
float mLineSpacing; float mLineSpacing = 1.0F;
Lines mLines; Lines mLines;
EditorState mState; EditorState mState = {};
UndoBuffer mUndoBuffer; UndoBuffer mUndoBuffer;
int mUndoIndex; int mUndoIndex = 0;
bool mScrollToBottom; bool mScrollToBottom = false;
float mTopMargin; float mTopMargin = 0.0F;
float mNewTopMargin; float mNewTopMargin = 0.0F;
float mOldTopMargin; float mOldTopMargin = 0.0F;
bool mTopMarginChanged=false; bool mTopMarginChanged = false;
int mTabSize; int mTabSize = 4;
bool mOverwrite; bool mOverwrite = false;
bool mReadOnly; bool mReadOnly = false;
bool mWithinRender; bool mWithinRender = false;
bool mScrollToCursor; bool mScrollToCursor = false;
bool mScrollToTop; bool mScrollToTop = false;
bool mTextChanged; bool mTextChanged = false;
bool mColorizerEnabled; bool mColorizerEnabled = true;
float mLongest; float mLongest = 0.0F;
float mTextStart; // position (in pixels) where a code line starts relative to the left of the TextEditor. float mTextStart = 20.0F; // position (in pixels) where a code line starts relative to the left of the TextEditor.
int mLeftMargin; int mLeftMargin = 10;
int mTopLine; int mTopLine = 0;
bool mSetTopLine; bool mSetTopLine = false;
bool mCursorPositionChanged; bool mCursorPositionChanged = false;
bool mBreakPointsChanged; bool mBreakPointsChanged = false;
int mColorRangeMin, mColorRangeMax; int mColorRangeMin = 0, mColorRangeMax = 0;
SelectionMode mSelectionMode; SelectionMode mSelectionMode = SelectionMode::Normal;
bool mHandleKeyboardInputs; bool mHandleKeyboardInputs = true;
bool mHandleMouseInputs; bool mHandleMouseInputs = true;
bool mIgnoreImGuiChild; bool mIgnoreImGuiChild = false;
bool mShowWhitespaces; bool mShowWhitespaces = true;
static Palette sPaletteBase; static Palette sPaletteBase;
Palette mPalette; Palette mPalette = {};
LanguageDefinition mLanguageDefinition; LanguageDefinition mLanguageDefinition = {};
RegexList mRegexList; RegexList mRegexList;
bool mCheckComments; bool mCheckComments = true;
Breakpoints mBreakpoints; Breakpoints mBreakpoints = {};
ErrorMarkers mErrorMarkers; ErrorMarkers mErrorMarkers = {};
ErrorHoverBoxes mErrorHoverBoxes; ErrorHoverBoxes mErrorHoverBoxes = {};
ErrorGotoBoxes mErrorGotoBoxes; ErrorGotoBoxes mErrorGotoBoxes = {};
CursorBoxes mCursorBoxes; CursorBoxes mCursorBoxes = {};
ImVec2 mCharAdvance; ImVec2 mCharAdvance = {};
Coordinates mInteractiveStart, mInteractiveEnd; Coordinates mInteractiveStart = {}, mInteractiveEnd = {};
std::string mLineBuffer; std::string mLineBuffer;
uint64_t mStartTime; uint64_t mStartTime = 0;
std::vector<std::string> mDefines; std::vector<std::string> mDefines;
TextEditor *mSourceCodeEditor=nullptr; TextEditor *mSourceCodeEditor = nullptr;
float mSavedScrollY = 0; float mSavedScrollY = 0;
float mShiftedScrollY = 0; float mShiftedScrollY = 0;
float mScrollY = 0; float mScrollY = 0;
int mNumberOfLinesDisplayed; int mNumberOfLinesDisplayed = 0;
float mLastClick; float mLastClick = -1.0F;
bool mShowCursor; bool mShowCursor = true;
bool mShowLineNumbers; bool mShowLineNumbers = true;
bool mRaiseContextMenu = false; bool mRaiseContextMenu = false;
Coordinates mFocusAtCoords; Coordinates mFocusAtCoords = {};
bool mUpdateFocus = false; bool mUpdateFocus = false;
std::vector<std::string> mClickableText; std::vector<std::string> mClickableText;

View File

@ -29,8 +29,8 @@ TextEditor::Palette TextEditor::sPaletteBase = TextEditor::GetDarkPalette();
TextEditor::FindReplaceHandler::FindReplaceHandler() : mWholeWord(false),mFindRegEx(false),mMatchCase(false) {} TextEditor::FindReplaceHandler::FindReplaceHandler() : mWholeWord(false),mFindRegEx(false),mMatchCase(false) {}
TextEditor::TextEditor() TextEditor::TextEditor() {
: mLineSpacing(1.0f), mUndoIndex(0), mTabSize(4), mOverwrite(false), mReadOnly(false), mWithinRender(false), mScrollToCursor(false), mScrollToTop(false), mScrollToBottom(false), mTextChanged(false), mColorizerEnabled(true), mTextStart(20.0f), mLeftMargin(10), mTopMargin(0), mCursorPositionChanged(false), mColorRangeMin(0), mColorRangeMax(0), mSelectionMode(SelectionMode::Normal), mCheckComments(true), mLastClick(-1.0f), mHandleKeyboardInputs(true), mHandleMouseInputs(true), mIgnoreImGuiChild(false), mShowWhitespaces(true), mShowCursor(true), mShowLineNumbers(true),mStartTime(ImGui::GetTime() * 1000), mBreakPointsChanged(false) { mStartTime = ImGui::GetTime() * 1000;
SetLanguageDefinition(LanguageDefinition::HLSL()); SetLanguageDefinition(LanguageDefinition::HLSL());
mLines.push_back(Line()); mLines.push_back(Line());
} }