mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-25 21:17:01 +00:00
ImGuiTextBuffer: Fix size() to allow using ImGuiTextBuffer with resize(0) patterns.
This commit is contained in:
parent
f7c879eb60
commit
d93e3c17fc
2
imgui.h
2
imgui.h
@ -1583,7 +1583,7 @@ struct ImGuiTextBuffer
|
|||||||
inline char operator[](int i) { IM_ASSERT(Buf.Data != NULL); return Buf.Data[i]; }
|
inline char operator[](int i) { IM_ASSERT(Buf.Data != NULL); return Buf.Data[i]; }
|
||||||
const char* begin() const { return Buf.Data ? &Buf.front() : EmptyString; }
|
const char* begin() const { return Buf.Data ? &Buf.front() : EmptyString; }
|
||||||
const char* end() const { return Buf.Data ? &Buf.back() : EmptyString; } // Buf is zero-terminated, so end() will point on the zero-terminator
|
const char* end() const { return Buf.Data ? &Buf.back() : EmptyString; } // Buf is zero-terminated, so end() will point on the zero-terminator
|
||||||
int size() const { return Buf.Data ? Buf.Size - 1 : 0; }
|
int size() const { return Buf.Size ? Buf.Size - 1 : 0; }
|
||||||
bool empty() { return Buf.Size <= 1; }
|
bool empty() { return Buf.Size <= 1; }
|
||||||
void clear() { Buf.clear(); }
|
void clear() { Buf.clear(); }
|
||||||
void reserve(int capacity) { Buf.reserve(capacity); }
|
void reserve(int capacity) { Buf.reserve(capacity); }
|
||||||
|
Loading…
Reference in New Issue
Block a user