[TextEditor] Generalized the margin draw API. This should be more
extendible for future updates.