Skip to content

Commit

Permalink
fix for issue #128 - ST3: Auto-closing tag doesn't indent properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Ross committed Feb 10, 2014
1 parent 4d61227 commit 0a901a0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion coldfusion-plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,16 @@ def run(self, edit):
for temp in self.view.sel():
tag_name = dic.get_tag_name(self.view, temp.b)
indent = not s.get("auto_indent_on_close") or tag_name == "cfoutput"

(row, col) = self.view.rowcol(temp.begin())
indent_region = self.view.find('^\s+', self.view.text_point(row, 0))
if self.view.rowcol(indent_region.begin())[0] == row:
indent_space = self.view.substr(indent_region)
else:
indent_space = ''

if not indent:
self.view.insert(edit,temp.b,"\n\t\n</" + tag_name + ">")
self.view.insert(edit,temp.b,"\n\t" + indent_space + "\n" + indent_space + "</" + tag_name + ">")
else:
self.view.insert(edit, temp.b, "</" + tag_name + ">")

Expand Down

0 comments on commit 0a901a0

Please sign in to comment.