Tab size setter/getter, code fancy.
diff --git a/TextEditor.cpp b/TextEditor.cpp
index 6953027..4bf17b7 100644
--- a/TextEditor.cpp
+++ b/TextEditor.cpp
@@ -1459,6 +1459,11 @@
mCursorPositionChanged = true;
}
+void TextEditor::SetTabSize(int aValue)
+{
+ mTabSize = std::max(0, std::min(32, aValue));
+}
+
void TextEditor::InsertText(const std::string & aValue)
{
InsertText(aValue.c_str());
diff --git a/TextEditor.h b/TextEditor.h
index 2661909..65436de 100644
--- a/TextEditor.h
+++ b/TextEditor.h
@@ -196,9 +196,11 @@
void Render(const char* aTitle, const ImVec2& aSize = ImVec2(), bool aBorder = false);
void SetText(const std::string& aText);
- void SetTextLines(const std::vector<std::string>& aLines);
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;
@@ -228,6 +230,9 @@
inline void SetShowWhitespaces(bool aValue) { mShowWhitespaces = aValue; }
inline bool IsShowingWhitespaces() const { return mShowWhitespaces; }
+ void SetTabSize(int aValue);
+ inline int GetTabSize() const { return mTabSize; }
+
void InsertText(const std::string& aValue);
void InsertText(const char* aValue);
@@ -357,7 +362,7 @@
bool mScrollToTop;
bool mTextChanged;
bool mColorizerEnabled;
- float mTextStart; // position (in pixels) where a code line starts relative to the left of the TextEditor.
+ float mTextStart; // position (in pixels) where a code line starts relative to the left of the TextEditor.
int mLeftMargin;
bool mCursorPositionChanged;
int mColorRangeMin, mColorRangeMax;