Issue/template engine

Indent templates to the same indentation as the line of the insertion point.

Simple solution that makes templates usable: even if they are not properly indented,
multi-line templates now align to the first non-whitespace character of the insertion point.

No tests because this is purely UI code.

Fix #1000058, #1000626,