mirror of
				https://github.com/ocornut/imgui.git
				synced 2025-10-26 12:27:30 +00:00 
			
		
		
		
	InputText: fixed ReadOnly flag preventing callbacks from receiving the text buffer. (#4762)
This commit is contained in:
		| @@ -58,6 +58,7 @@ Other Changes: | ||||
| - InputText, Nav: fixed repeated calls to SetKeyboardFocusHere() preventing to use InputText(). (#4682) | ||||
| - InputText: made double-click select word, triple-line select line. Word delimitation logic differs | ||||
|   slightly from the one used by CTRL+arrows. (#2244) | ||||
| - InputText: fixed ReadOnly flag preventing callbacks from receiving the text buffer. (#4762) [@actondev] | ||||
| - Clipper: currently focused item is automatically included in clipper range. | ||||
|   Fixes issue where e.g. drag and dropping an item and scrolling ensure the item source location is | ||||
|   still submitted. (#3841, #1725) [@GamingMinds-DanielC, @ocornut] | ||||
|   | ||||
| @@ -4484,8 +4484,9 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ | ||||
|                     callback_data.Flags = flags; | ||||
|                     callback_data.UserData = callback_user_data; | ||||
|  | ||||
|                     char* callback_buf = is_readonly ? buf : state->TextA.Data; | ||||
|                     callback_data.EventKey = event_key; | ||||
|                     callback_data.Buf = state->TextA.Data; | ||||
|                     callback_data.Buf = callback_buf; | ||||
|                     callback_data.BufTextLen = state->CurLenA; | ||||
|                     callback_data.BufSize = state->BufCapacityA; | ||||
|                     callback_data.BufDirty = false; | ||||
| @@ -4500,7 +4501,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ | ||||
|                     callback(&callback_data); | ||||
|  | ||||
|                     // Read back what user may have modified | ||||
|                     IM_ASSERT(callback_data.Buf == state->TextA.Data);  // Invalid to modify those fields | ||||
|                     IM_ASSERT(callback_data.Buf == callback_buf);  // Invalid to modify those fields | ||||
|                     IM_ASSERT(callback_data.BufSize == state->BufCapacityA); | ||||
|                     IM_ASSERT(callback_data.Flags == flags); | ||||
|                     const bool buf_dirty = callback_data.BufDirty; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 ocornut
					ocornut