mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
InputText: Added BufTextLen in ImGuiTextEditCallbackData. Requesting user to maintain it. Zero-ing structure properly before use. (#541)
This commit is contained in:
parent
17d3c202ac
commit
cf12bc7dea
3 changed files with 27 additions and 21 deletions
|
|
@ -1888,6 +1888,7 @@ struct ExampleAppConsole
|
|||
Commands.push_back("HISTORY");
|
||||
Commands.push_back("CLEAR");
|
||||
Commands.push_back("CLASSIFY"); // "classify" is here to provide an example of "C"+[tab] completing to "CL" and displaying matches.
|
||||
AddLog("Welcome to ImGui!");
|
||||
}
|
||||
~ExampleAppConsole()
|
||||
{
|
||||
|
|
@ -2128,9 +2129,8 @@ struct ExampleAppConsole
|
|||
// A better implementation would preserve the data on the current input line along with cursor position.
|
||||
if (prev_history_pos != HistoryPos)
|
||||
{
|
||||
snprintf(data->Buf, data->BufSize, "%s", (HistoryPos >= 0) ? History[HistoryPos] : "");
|
||||
data->CursorPos = data->SelectionStart = data->SelectionEnd = data->BufTextLen = (int)snprintf(data->Buf, data->BufSize, "%s", (HistoryPos >= 0) ? History[HistoryPos] : "");
|
||||
data->BufDirty = true;
|
||||
data->CursorPos = data->SelectionStart = data->SelectionEnd = (int)strlen(data->Buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue