@ -11170,6 +11170,11 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
// Select which buffer we are going to display. When ImGuiInputTextFlags_NoLiveEdit is set 'buf' might still be the old value. We set buf to NULL to prevent accidental usage from now on.
const char * buf_display = ( g . ActiveId = = id & & is_editable ) ? edit_state . TempBuffer . Data : buf ; buf = NULL ;
// Set upper limit of single-line InputTextEx() at 2 million characters strings. The current pathological worst case is a long line
// without any carriage return, which would makes ImFont::RenderText() reserve too many vertices and probably crash. Avoid it altogether.
// Note that we only use this limit on single-line InputText(), so a pathologically large line on a InputTextMultiline() would still crash.
const int buf_display_max_length = 2 * 1024 * 1024 ;
if ( ! is_multiline )
{
RenderNavHighlight ( frame_bb , id ) ;
@ -11303,7 +11308,9 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
}
}
draw_window - > DrawList - > AddText ( g . Font , g . FontSize , render_pos - render_scroll , GetColorU32 ( ImGuiCol_Text ) , buf_display , buf_display + edit_state . CurLenA , 0.0f , is_multiline ? NULL : & clip_rect ) ;
const int buf_display_len = edit_state . CurLenA ;
if ( is_multiline | | buf_display_len < buf_display_max_length )
draw_window - > DrawList - > AddText ( g . Font , g . FontSize , render_pos - render_scroll , GetColorU32 ( ImGuiCol_Text ) , buf_display , buf_display + buf_display_len , 0.0f , is_multiline ? NULL : & clip_rect ) ;
// Draw blinking cursor
bool cursor_is_visible = ( ! g . IO . ConfigCursorBlink ) | | ( g . InputTextState . CursorAnim < = 0.0f ) | | ImFmod ( g . InputTextState . CursorAnim , 1.20f ) < = 0.80f ;
@ -11322,7 +11329,10 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
const char * buf_end = NULL ;
if ( is_multiline )
text_size = ImVec2 ( size . x , InputTextCalcTextLenAndLineCount ( buf_display , & buf_end ) * g . FontSize ) ; // We don't need width
draw_window - > DrawList - > AddText ( g . Font , g . FontSize , render_pos , GetColorU32 ( ImGuiCol_Text ) , buf_display , buf_end , 0.0f , is_multiline ? NULL : & clip_rect ) ;
else
buf_end = buf_display + strlen ( buf_display ) ;
if ( is_multiline | | ( buf_end - buf_display ) < buf_display_max_length )
draw_window - > DrawList - > AddText ( g . Font , g . FontSize , render_pos , GetColorU32 ( ImGuiCol_Text ) , buf_display , buf_end , 0.0f , is_multiline ? NULL : & clip_rect ) ;
}
if ( is_multiline )