Merge pull request #96 from Melix19/improved_tab_look

Decreased tab symbol size to improve look
diff --git a/TextEditor.cpp b/TextEditor.cpp
index 94b749b..a2b4138 100644
--- a/TextEditor.cpp
+++ b/TextEditor.cpp
@@ -47,6 +47,7 @@
 	, mHandleMouseInputs(true)
 	, mIgnoreImGuiChild(false)
 	, mShowWhitespaces(true)
+	, mShowShortTabGlyphs(false)
 	, mStartTime(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count())
 {
 	SetPalette(GetDarkPalette());
@@ -1045,14 +1046,33 @@
 
 					if (mShowWhitespaces)
 					{
-						const auto s = ImGui::GetFontSize();
-						const auto x1 = textScreenPos.x + oldX + 1.0f;
-						const auto x2 = textScreenPos.x + bufferOffset.x - 1.0f;
-						const auto y = textScreenPos.y + bufferOffset.y + s * 0.5f;
-						const ImVec2 p1(x1, y);
-						const ImVec2 p2(x2, y);
-						const ImVec2 p3(x2 - s * 0.2f, y - s * 0.2f);
-						const ImVec2 p4(x2 - s * 0.2f, y + s * 0.2f);
+						ImVec2 p1, p2, p3, p4;
+
+						if (mShowShortTabGlyphs)
+						{
+							const auto s = ImGui::GetFontSize();
+							const auto x1 = textScreenPos.x + oldX + 1.0f;
+							const auto x2 = textScreenPos.x + oldX + mCharAdvance.x - 1.0f;
+							const auto y = textScreenPos.y + bufferOffset.y + s * 0.5f;
+
+							p1 = ImVec2(x1, y);
+							p2 = ImVec2(x2, y);
+							p3 = ImVec2(x2 - s * 0.16f, y - s * 0.16f);
+							p4 = ImVec2(x2 - s * 0.16f, y + s * 0.16f);
+						}
+						else
+						{
+							const auto s = ImGui::GetFontSize();
+							const auto x1 = textScreenPos.x + oldX + 1.0f;
+							const auto x2 = textScreenPos.x + bufferOffset.x - 1.0f;
+							const auto y = textScreenPos.y + bufferOffset.y + s * 0.5f;
+
+							p1 = ImVec2(x1, y);
+							p2 = ImVec2(x2, y);
+							p3 = ImVec2(x2 - s * 0.2f, y - s * 0.2f);
+							p4 = ImVec2(x2 - s * 0.2f, y + s * 0.2f);
+						}
+
 						drawList->AddLine(p1, p2, 0x90909090);
 						drawList->AddLine(p2, p3, 0x90909090);
 						drawList->AddLine(p2, p4, 0x90909090);
diff --git a/TextEditor.h b/TextEditor.h
index bd52e13..f7fe714 100644
--- a/TextEditor.h
+++ b/TextEditor.h
@@ -230,6 +230,9 @@
 	inline void SetShowWhitespaces(bool aValue) { mShowWhitespaces = aValue; }

 	inline bool IsShowingWhitespaces() const { return mShowWhitespaces; }

 

+	inline void SetShowShortTabGlyphs(bool aValue) { mShowShortTabGlyphs = aValue; }

+	inline bool IsShowingShortTabGlyphs() const { return mShowShortTabGlyphs; }

+

 	void SetTabSize(int aValue);

 	inline int GetTabSize() const { return mTabSize; }

 

@@ -371,6 +374,7 @@
 	bool mHandleMouseInputs;

 	bool mIgnoreImGuiChild;

 	bool mShowWhitespaces;

+	bool mShowShortTabGlyphs;

 

 	Palette mPaletteBase;

 	Palette mPalette;