"Assertion `i >= 0 && i < Size' failed." when pressing the home key in a ReadOnly+WordWrap InputTextMultiline #9561

Closed
opened 2026-09-28 15:25:34 +00:00 by movercell · 0 comments
movercell commented 2026-09-28 15:25:34 +00:00 (Migrated from github.com)

Version/Branch of Dear ImGui:

Version 1.92.6 WIP, Branch: docking

Back-ends:

imgui_impl_opengl3.cpp + imgui_impl_glfw.cpp

Compiler, OS:

Ubuntu 24.04 + G++16

Full config/build information:

Dear ImGui 1.92.6 WIP (19259)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=202400
define: __linux__
define: __GNUC__=16
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
IM_ASSERT: runs expression: OK. expand size: OK
--------------------------------
io.BackendPlatformName: imgui_impl_glfw (3400)
io.BackendRendererName: imgui_impl_opengl3
io.ConfigFlags: 0x00000083
 NavEnableKeyboard
 NavEnableGamepad
 DockingEnable
io.ConfigViewportsNoDecoration
io.ConfigViewportsNoDefaultParent
io.ConfigNavCaptureKeyboard
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00001C1E
 HasMouseCursors
 HasSetMousePos
 PlatformHasViewports
 HasMouseHoveredViewport
 RendererHasVtxOffset
 RendererHasTextures
 RendererHasViewports
--------------------------------
io.Fonts: 3 fonts, Flags: 0x00000000, TexSize: 512,128
io.Fonts->FontLoaderName: stb_truetype
io.DisplaySize: 800.00,600.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
style.WindowPadding: 8.00,8.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00

Details:

It crashes when i press the home key on my keyboard while at the very end of the text
(I apologize if the issue has been fixed in a later version)

Screenshots/Video:

https://github.com/user-attachments/assets/4b5d5a36-cd7f-4930-a0f7-0fab33edb3ab

Minimal, Complete and Verifiable Example code:

static constinit auto chars = []() constexpr {
	std::array<char, 100> out;
	for (char& character : out) character = 'a';
	out[50] = '\n';
	out[99] = '\0';
	return out;
}();

ImGuiInputTextFlags flags = ImGuiInputTextFlags_ReadOnly | ImGuiInputTextFlags_WordWrap;
ImGui::InputTextMultiline("bug", &chars.at(0), chars.size(), ImVec2(100, 300), flags);
### Version/Branch of Dear ImGui: Version 1.92.6 WIP, Branch: docking ### Back-ends: imgui_impl_opengl3.cpp + imgui_impl_glfw.cpp ### Compiler, OS: Ubuntu 24.04 + G++16 ### Full config/build information: ```cpp Dear ImGui 1.92.6 WIP (19259) -------------------------------- sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20 define: __cplusplus=202400 define: __linux__ define: __GNUC__=16 define: IMGUI_HAS_VIEWPORT define: IMGUI_HAS_DOCK IM_ASSERT: runs expression: OK. expand size: OK -------------------------------- io.BackendPlatformName: imgui_impl_glfw (3400) io.BackendRendererName: imgui_impl_opengl3 io.ConfigFlags: 0x00000083 NavEnableKeyboard NavEnableGamepad DockingEnable io.ConfigViewportsNoDecoration io.ConfigViewportsNoDefaultParent io.ConfigNavCaptureKeyboard io.ConfigInputTextCursorBlink io.ConfigWindowsResizeFromEdges io.ConfigMemoryCompactTimer = 60.0 io.BackendFlags: 0x00001C1E HasMouseCursors HasSetMousePos PlatformHasViewports HasMouseHoveredViewport RendererHasVtxOffset RendererHasTextures RendererHasViewports -------------------------------- io.Fonts: 3 fonts, Flags: 0x00000000, TexSize: 512,128 io.Fonts->FontLoaderName: stb_truetype io.DisplaySize: 800.00,600.00 io.DisplayFramebufferScale: 1.00,1.00 -------------------------------- style.WindowPadding: 8.00,8.00 style.WindowBorderSize: 1.00 style.FramePadding: 4.00,3.00 style.FrameRounding: 0.00 style.FrameBorderSize: 0.00 style.ItemSpacing: 8.00,4.00 style.ItemInnerSpacing: 4.00,4.00 ``` ### Details: It crashes when i press the home key on my keyboard while at the very end of the text (I apologize if the issue has been fixed in a later version) ### Screenshots/Video: https://github.com/user-attachments/assets/4b5d5a36-cd7f-4930-a0f7-0fab33edb3ab ### Minimal, Complete and Verifiable Example code: ```cpp static constinit auto chars = []() constexpr { std::array<char, 100> out; for (char& character : out) character = 'a'; out[50] = '\n'; out[99] = '\0'; return out; }(); ImGuiInputTextFlags flags = ImGuiInputTextFlags_ReadOnly | ImGuiInputTextFlags_WordWrap; ImGui::InputTextMultiline("bug", &chars.at(0), chars.size(), ImVec2(100, 300), flags); ```
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#9561
No description provided.