Thanks for the details, it's more clear now.
ui.Edit does support an onChange() event, so your approach is valid.
The first thing I'd try is changing:
function myEdit.onChange()
print("changed")
end
to:
function myEdit:onChange()
print("changed")
end
Most LuaRT event handlers are declared using the : syntax so that self is passed automatically.
Also, before working on auto-indentation, can you verify that the event is actually firing:
function myEdit:onChange()
ui.info("changed: "..self.text)
end
If that works, the next step is to get the current line number and caret:
ui.info(myEdit.line)
ui.info(myEdit.caret)
Both the current line number and caret position are exposed by ui.Edit.
One other thing: searchup("do") searches the whole editor content upwards from the caret. For indentation you'll usually want to inspect only the previous line, otherwise a do somewhere earlier in the file could incorrectly trigger indentation.
Can you confirm whether ui.info("changed") appears when you type after switching to the : syntax?