|
|
@ -4433,11 +4433,14 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|
|
|
// Vertical scroll
|
|
|
|
// Vertical scroll
|
|
|
|
if (is_multiline)
|
|
|
|
if (is_multiline)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
// Test if cursor is vertically visible
|
|
|
|
float scroll_y = draw_window->Scroll.y;
|
|
|
|
float scroll_y = draw_window->Scroll.y;
|
|
|
|
|
|
|
|
const float scroll_max_y = ImMax((text_size.y + style.FramePadding.y * 2.0f) - inner_size.y, 0.0f);
|
|
|
|
if (cursor_offset.y - g.FontSize < scroll_y)
|
|
|
|
if (cursor_offset.y - g.FontSize < scroll_y)
|
|
|
|
scroll_y = ImMax(0.0f, cursor_offset.y - g.FontSize);
|
|
|
|
scroll_y = ImMax(0.0f, cursor_offset.y - g.FontSize);
|
|
|
|
else if (cursor_offset.y - inner_size.y >= scroll_y)
|
|
|
|
else if (cursor_offset.y - inner_size.y >= scroll_y)
|
|
|
|
scroll_y = cursor_offset.y - inner_size.y;
|
|
|
|
scroll_y = cursor_offset.y - inner_size.y + style.FramePadding.y * 2.0f;
|
|
|
|
|
|
|
|
scroll_y = ImClamp(scroll_y, 0.0f, scroll_max_y);
|
|
|
|
draw_pos.y += (draw_window->Scroll.y - scroll_y); // Manipulate cursor pos immediately avoid a frame of lag
|
|
|
|
draw_pos.y += (draw_window->Scroll.y - scroll_y); // Manipulate cursor pos immediately avoid a frame of lag
|
|
|
|
draw_window->Scroll.y = scroll_y;
|
|
|
|
draw_window->Scroll.y = scroll_y;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -4526,7 +4529,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|
|
|
|
|
|
|
|
|
|
|
if (is_multiline)
|
|
|
|
if (is_multiline)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Dummy(text_size + ImVec2(0.0f, g.FontSize)); // Always add room to scroll an extra line
|
|
|
|
Dummy(text_size);
|
|
|
|
EndChild();
|
|
|
|
EndChild();
|
|
|
|
EndGroup();
|
|
|
|
EndGroup();
|
|
|
|
}
|
|
|
|
}
|
|
|
|