Originally created by: rifkybujana
Description:
There is an issue with the word wrapping behavior in the input field of the chat application. The input text does not wrap correctly when it reaches the edge of the input box, and instead, it causes horizontal scrolling or text overflow outside the input field. Additionally, the placeholder text may not be aligned properly with larger or smaller input field sizes.
Steps to Reproduce:
Expected Behavior:
The input text should wrap properly within the input box without causing horizontal scrolling or overflow.
Actual Behavior:
Text overflows outside the input box or causes horizontal scrolling.
Possible Cause:
The issue might be related to the flags used in ImGui::InputTextMultiline() or the incorrect handling of the content region width and padding when rendering the input field. Word-wrapping logic may not be handling the input field width properly.
Proposed Solution:
ImGuiInputTextFlags_NoHorizontalScroll flag is correctly applied, and ensure that text wrapping is enabled in the input field.Relevant Code:
ImGuiInputTextFlags flags = ImGuiInputTextFlags_EnterReturnsTrue |
ImGuiInputTextFlags_CtrlEnterForNewLine;
ImVec2 inputSize = ImVec2(inputWidth, inputHeight); // Input height is adjustable
ImGui::InputTextMultiline("##input", inputText, IM_ARRAYSIZE(inputText), inputSize, flags);
Environment:
Additional Context:
The issue may be more noticeable with larger input fields or specific input padding values. Placeholder alignment also seems to be inconsistent based on the input field size, which could be related to the word-wrapping problem.
Originally posted by: rifkybujana
Altering imgui library by using text wrap functionality to the multi-line text input would suffix.
https://github.com/abvadabra
Imandana's solution might be the simplest, but have issue in cursor navigation.
Issue:
cavet (keyboard cursor) can't move down.