mirror of
https://github.com/ocornut/imgui.git
synced 2026-03-27 23:37:03 -05:00
InputTextMultiline: fixed losing revert value when activating scrollbar. (toward #9308)
This commit is contained in:
@@ -86,7 +86,8 @@ Other Changes:
|
||||
for vertical scrollbar range would be +1 when the widget is inactive, word-wrap is
|
||||
disabled and the text buffer ends with '\n'. Fixed a similar issue related to clipping
|
||||
large amount of text.
|
||||
- InputTextMultiline: avoid going through reactivation code when activating scrollbar.
|
||||
- InputTextMultiline: avoid going through reactivation code and fixed losing revert value
|
||||
when activating scrollbar.
|
||||
- Style:
|
||||
- Border sizes are now scaled (and rounded) by ScaleAllSizes().
|
||||
- When using large values with ScallAllSizes(), the following items thickness
|
||||
|
||||
@@ -4806,8 +4806,11 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
// From the moment we focused we are normally ignoring the content of 'buf' (unless we are in read-only mode)
|
||||
const int buf_len = (int)ImStrlen(buf);
|
||||
IM_ASSERT(((buf_len + 1 <= buf_size) || (buf_len == 0 && buf_size == 0)) && "Is your input buffer properly zero-terminated?");
|
||||
state->TextToRevertTo.resize(buf_len + 1); // UTF-8. we use +1 to make sure that .Data is always pointing to at least an empty string.
|
||||
memcpy(state->TextToRevertTo.Data, buf, buf_len + 1);
|
||||
if (!user_scroll_finish)
|
||||
{
|
||||
state->TextToRevertTo.resize(buf_len + 1); // UTF-8. we use +1 to make sure that .Data is always pointing to at least an empty string.
|
||||
memcpy(state->TextToRevertTo.Data, buf, buf_len + 1);
|
||||
}
|
||||
|
||||
// Preserve cursor position and undo/redo stack if we come back to same widget
|
||||
// FIXME: Since we reworked this on 2022/06, may want to differentiate recycle_cursor vs recycle_undostate?
|
||||
|
||||
Reference in New Issue
Block a user