mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-03 22:51:06 +01:00 
			
		
		
		
	Misc: Most text functions also treat "%.*s" (along with "%s") specially to avoid formatting. (#3466, #6846)
This commit is contained in:
		@@ -93,6 +93,7 @@ Other changes:
 | 
				
			|||||||
- MenuBar: Fixed an issue where layouting an item in the menu-bar would erroneously
 | 
					- MenuBar: Fixed an issue where layouting an item in the menu-bar would erroneously
 | 
				
			||||||
  register contents size in a way that would affect the scrolling layer.
 | 
					  register contents size in a way that would affect the scrolling layer.
 | 
				
			||||||
  Was most often noticable when using an horizontal scrollbar. (#6789)
 | 
					  Was most often noticable when using an horizontal scrollbar. (#6789)
 | 
				
			||||||
 | 
					- Misc: Most text functions also treat "%.*s" (along with "%s") specially to avoid formatting. (#3466, #6846)
 | 
				
			||||||
- IO: Setting io.WantSetMousePos ignores incoming MousePos events. (#6837, #228) [@bertaye]
 | 
					- IO: Setting io.WantSetMousePos ignores incoming MousePos events. (#6837, #228) [@bertaye]
 | 
				
			||||||
- ImDrawList: Added AddEllipse(), AddEllipseFilled(), PathEllipticalArcTo(). (#2743) [@Doohl]
 | 
					- ImDrawList: Added AddEllipse(), AddEllipseFilled(), PathEllipticalArcTo(). (#2743) [@Doohl]
 | 
				
			||||||
- ImVector: Added find_index() helper.
 | 
					- ImVector: Added find_index() helper.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										21
									
								
								imgui.cpp
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								imgui.cpp
									
									
									
									
									
								
							@@ -1918,21 +1918,9 @@ int ImFormatStringV(char* buf, size_t buf_size, const char* fmt, va_list args)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void ImFormatStringToTempBuffer(const char** out_buf, const char** out_buf_end, const char* fmt, ...)
 | 
					void ImFormatStringToTempBuffer(const char** out_buf, const char** out_buf_end, const char* fmt, ...)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ImGuiContext& g = *GImGui;
 | 
					 | 
				
			||||||
    va_list args;
 | 
					    va_list args;
 | 
				
			||||||
    va_start(args, fmt);
 | 
					    va_start(args, fmt);
 | 
				
			||||||
    if (fmt[0] == '%' && fmt[1] == 's' && fmt[2] == 0)
 | 
					    ImFormatStringToTempBufferV(out_buf, out_buf_end, fmt, args);
 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        const char* buf = va_arg(args, const char*); // Skip formatting when using "%s"
 | 
					 | 
				
			||||||
        *out_buf = buf;
 | 
					 | 
				
			||||||
        if (out_buf_end) { *out_buf_end = buf + strlen(buf); }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        int buf_len = ImFormatStringV(g.TempBuffer.Data, g.TempBuffer.Size, fmt, args);
 | 
					 | 
				
			||||||
        *out_buf = g.TempBuffer.Data;
 | 
					 | 
				
			||||||
        if (out_buf_end) { *out_buf_end = g.TempBuffer.Data + buf_len; }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    va_end(args);
 | 
					    va_end(args);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1945,6 +1933,13 @@ void ImFormatStringToTempBufferV(const char** out_buf, const char** out_buf_end,
 | 
				
			|||||||
        *out_buf = buf;
 | 
					        *out_buf = buf;
 | 
				
			||||||
        if (out_buf_end) { *out_buf_end = buf + strlen(buf); }
 | 
					        if (out_buf_end) { *out_buf_end = buf + strlen(buf); }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    else if (fmt[0] == '%' && fmt[1] == '.' && fmt[2] == '*' && fmt[3] == 's' && fmt[4] == 0)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        int buf_len = va_arg(args, int); // Skip formatting when using "%.*s"
 | 
				
			||||||
 | 
					        const char* buf = va_arg(args, const char*);
 | 
				
			||||||
 | 
					        *out_buf = buf;
 | 
				
			||||||
 | 
					        *out_buf_end = buf + buf_len; // Disallow not passing 'out_buf_end' here. User is expected to use it.
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        int buf_len = ImFormatStringV(g.TempBuffer.Data, g.TempBuffer.Size, fmt, args);
 | 
					        int buf_len = ImFormatStringV(g.TempBuffer.Data, g.TempBuffer.Size, fmt, args);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								imgui.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								imgui.h
									
									
									
									
									
								
							@@ -24,7 +24,7 @@
 | 
				
			|||||||
// Library Version
 | 
					// Library Version
 | 
				
			||||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
 | 
					// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
 | 
				
			||||||
#define IMGUI_VERSION       "1.90 WIP"
 | 
					#define IMGUI_VERSION       "1.90 WIP"
 | 
				
			||||||
#define IMGUI_VERSION_NUM   18992
 | 
					#define IMGUI_VERSION_NUM   18993
 | 
				
			||||||
#define IMGUI_HAS_TABLE
 | 
					#define IMGUI_HAS_TABLE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user