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