mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-04 12:27:46 +00:00
ImGuiTextIndex: rename member.
This commit is contained in:
@@ -3080,11 +3080,11 @@ void ImGuiTextIndex::append(const char* base, int old_size, int new_size)
|
||||
if (old_size == new_size)
|
||||
return;
|
||||
if (EndOffset == 0 || base[EndOffset - 1] == '\n')
|
||||
LineOffsets.push_back(EndOffset);
|
||||
Offsets.push_back(EndOffset);
|
||||
const char* base_end = base + new_size;
|
||||
for (const char* p = base + old_size; (p = (const char*)ImMemchr(p, '\n', base_end - p)) != 0; )
|
||||
if (++p < base_end) // Don't push a trailing offset on last \n
|
||||
LineOffsets.push_back((int)(intptr_t)(p - base));
|
||||
Offsets.push_back((int)(intptr_t)(p - base));
|
||||
EndOffset = ImMax(EndOffset, new_size);
|
||||
}
|
||||
|
||||
|
||||
@@ -804,13 +804,13 @@ struct ImChunkStream
|
||||
// Maintain a line index for a text buffer. This is a strong candidate to be moved into the public API.
|
||||
struct ImGuiTextIndex
|
||||
{
|
||||
ImVector<int> LineOffsets;
|
||||
ImVector<int> Offsets;
|
||||
int EndOffset = 0; // Because we don't own text buffer we need to maintain EndOffset (may bake in LineOffsets?)
|
||||
|
||||
void clear() { LineOffsets.clear(); EndOffset = 0; }
|
||||
int size() { return LineOffsets.Size; }
|
||||
const char* get_line_begin(const char* base, int n) { return base + LineOffsets[n]; }
|
||||
const char* get_line_end(const char* base, int n) { return base + (n + 1 < LineOffsets.Size ? (LineOffsets[n + 1] - 1) : EndOffset); }
|
||||
void clear() { Offsets.clear(); EndOffset = 0; }
|
||||
int size() { return Offsets.Size; }
|
||||
const char* get_line_begin(const char* base, int n) { return base + Offsets[n]; }
|
||||
const char* get_line_end(const char* base, int n) { return base + (n + 1 < Offsets.Size ? (Offsets[n + 1] - 1) : EndOffset); }
|
||||
void append(const char* base, int old_size, int new_size);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user