TextProxy: works for any widget that sets PlatformImeData.WantTextInput (+SelectedText)
Build & Release / build (push) Canceled after 0s

This commit is contained in:
4DBug committed 2026-10-17 04:24:03 -05:00
1 parent 8f2dfe358d
commit b0e4f105f5
10 files changed
+97 -34

No files matched your search

+11 -2
View File
@@ -14555,6 +14555,7 @@ function ImGui.NewFrame()
ImGuiPlatformImeData_Copy(g.PlatformImeDataPrev, g.PlatformImeData)
g.PlatformImeData.WantVisible = false
g.PlatformImeData.WantTextInput = false
g.PlatformImeData.SelectedText = "" -- [Port]
-- Mouse wheel scrolling, scale
ImGui.UpdateMouseWheel()
@@ -44402,6 +44403,7 @@ end
--- @field InputPos ImVec2
--- @field InputLineHeight float
--- @field ViewportId ImGuiID
--- @field SelectedText string
--- @return ImGuiPlatformImeData
--- @nodiscard
@@ -44411,7 +44413,8 @@ function ImGuiPlatformImeData()
WantTextInput = false, -- A widget wants text input, not necessarily IME to be visible. This is automatically set to the upcoming value of io.WantTextInput.
InputPos = ImVec2(), -- Position of input cursor (for IME).
InputLineHeight = 0.0, -- Line height (for IME).
ViewportId = 0 -- ID of platform window/viewport.
ViewportId = 0, -- ID of platform window/viewport.
SelectedText = "" -- [Port] Text currently selected in the widget wanting text input (backends may mirror it, e.g. for native copy).
}
end
@@ -44423,6 +44426,7 @@ function ImGuiPlatformImeData_Copy(dest, src)
ImVec2_Copy(dest.InputPos, src.InputPos)
dest.InputLineHeight = src.InputLineHeight
dest.ViewportId = src.ViewportId
dest.SelectedText = src.SelectedText -- [Port]
end
--- @param data1 ImGuiPlatformImeData
@@ -44432,7 +44436,8 @@ function ImGuiPlatformImeData_Compare(data1, data2)
data1.WantTextInput ~= data2.WantTextInput or
data1.InputPos ~= data2.InputPos or
data1.InputLineHeight ~= data2.InputLineHeight or
data1.ViewportId ~= data2.ViewportId then
data1.ViewportId ~= data2.ViewportId or
data1.SelectedText ~= data2.SelectedText then
return false
end
@@ -61971,6 +61976,10 @@ function ImGui.InputTextEx(label, hint, buf, buf_size, size_arg, flags, callback
ImVec2_Copy(ime_data.InputPos, ImVec2(cursor_screen_pos.x - 1.0, cursor_screen_pos.y - g.FontSize))
ime_data.InputLineHeight = g.FontSize
ime_data.ViewportId = window.Viewport.ID
-- [Port] selection for backends (stb positions are 1-based in this port)
if state.Stb and state:HasSelection() then
ime_data.SelectedText = ImGui._ByteArrayToString(state.TextA.Data, ImMin(state.Stb.select_start, state.Stb.select_end), ImMax(state.Stb.select_start, state.Stb.select_end))
end
end
end