InputDialog: add param to setInputText() to set cursor pos

When not provided, the cursor stays at its initial position,
which might not be the best if replacing the whole content,
where we would prefer to have it at start or end.
reviewable/pr10990/r1
poire-z 7 months ago
parent da424486ef
commit 52c45ef6db

@ -500,11 +500,18 @@ function InputDialog:getInputValue()
end
end
function InputDialog:setInputText(text, edited_state)
function InputDialog:setInputText(text, edited_state, cursor_at_start_or_end)
self._input_widget:setText(text)
if edited_state ~= nil and self._buttons_edit_callback then
self._buttons_edit_callback(edited_state)
end
if cursor_at_start_or_end ~= nil then -- true=start, false=end
if cursor_at_start_or_end then
self._input_widget:scrollToTop()
else
self._input_widget:scrollToBottom()
end
end
end
function InputDialog:isTextEditable()

Loading…
Cancel
Save