AFAIK, there's no way to execute the find/replace dialog as a command (which would make this easy, and also would make me very happy because I often want to be able to include find/replace in a macro).

You'll need to ask the view for the lines, and then insert a tab or replace the line with a tab at the beginning. You'll need to be careful, because as soon as you insert a tab, this will shift the offset for all subsequent lines. Here is some sample code that should do what you want:

An alternative approach is to extract all the line regions into a python list, clear self.view.sel(), and then add them to self.view.sel(). Then iterate over self.view.sel() and call substr/replace or insert(). When you modify regions in a RegionSet, they automatically get adjusted (so you don't have to do things in reverse). But this would be a bit more complex than the above example.

I'm not really sure what you mean. In the sample code, you have a variable "text" which contains a line of code. Prepend a tab to it and you now have your indented line. Just don't call "replace" if you don't want to update the view. You can append the lines to a list if you need the entire chunk all at once.