mirror of
https://github.com/ocornut/imgui.git
synced 2026-02-01 17:44:33 +00:00
InputText: removed unnecessary variables.
This commit is contained in:
@@ -5262,10 +5262,9 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
callback_data.BufTextLen = state->TextLen;
|
||||
callback_data.BufSize = state->BufCapacity;
|
||||
callback_data.BufDirty = false;
|
||||
|
||||
const int utf8_cursor_pos = callback_data.CursorPos = state->Stb->cursor;
|
||||
const int utf8_selection_start = callback_data.SelectionStart = state->Stb->select_start;
|
||||
const int utf8_selection_end = callback_data.SelectionEnd = state->Stb->select_end;
|
||||
callback_data.CursorPos = state->Stb->cursor;
|
||||
callback_data.SelectionStart = state->Stb->select_start;
|
||||
callback_data.SelectionEnd = state->Stb->select_end;
|
||||
|
||||
// Call user code
|
||||
callback(&callback_data);
|
||||
@@ -5276,9 +5275,9 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
IM_ASSERT(callback_data.BufSize == state->BufCapacity);
|
||||
IM_ASSERT(callback_data.Flags == flags);
|
||||
const bool buf_dirty = callback_data.BufDirty;
|
||||
if (callback_data.CursorPos != utf8_cursor_pos || buf_dirty) { state->Stb->cursor = callback_data.CursorPos; state->CursorFollow = true; }
|
||||
if (callback_data.SelectionStart != utf8_selection_start || buf_dirty) { state->Stb->select_start = (callback_data.SelectionStart == callback_data.CursorPos) ? state->Stb->cursor : callback_data.SelectionStart; }
|
||||
if (callback_data.SelectionEnd != utf8_selection_end || buf_dirty) { state->Stb->select_end = (callback_data.SelectionEnd == callback_data.SelectionStart) ? state->Stb->select_start : callback_data.SelectionEnd; }
|
||||
if (buf_dirty || callback_data.CursorPos != state->Stb->cursor) { state->Stb->cursor = callback_data.CursorPos; state->CursorFollow = true; }
|
||||
if (buf_dirty || callback_data.SelectionStart != state->Stb->select_start) { state->Stb->select_start = (callback_data.SelectionStart == callback_data.CursorPos) ? state->Stb->cursor : callback_data.SelectionStart; }
|
||||
if (buf_dirty || callback_data.SelectionEnd != state->Stb->select_end) { state->Stb->select_end = (callback_data.SelectionEnd == callback_data.SelectionStart) ? state->Stb->select_start : callback_data.SelectionEnd; }
|
||||
if (buf_dirty)
|
||||
{
|
||||
// Callback may update buffer and thus set buf_dirty even in read-only mode.
|
||||
|
||||
Reference in New Issue
Block a user