don't indent after closing tag
This commit is contained in:
parent
631695a0e4
commit
289ada0a2f
1 changed files with 15 additions and 3 deletions
|
|
@ -158,10 +158,22 @@ var XmlBehaviour = function () {
|
|||
while (token && token.type.indexOf('tag-name') === -1) {
|
||||
token = iterator.stepBackward();
|
||||
}
|
||||
|
||||
|
||||
if (!token) {
|
||||
return;
|
||||
}
|
||||
|
||||
var tag = token.value;
|
||||
|
||||
//don't indent after closing tag
|
||||
token = iterator.stepBackward();
|
||||
if (token && token.type.indexOf('end-tag') !== -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var single_tags = ['!doctype','area','base','br','hr','input','img','link','meta'];
|
||||
|
||||
if (token && token.value && single_tags.indexOf(token.value) === -1) {
|
||||
if (single_tags.indexOf(tag) === -1) {
|
||||
var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
|
||||
var next_indent = this.$getIndent(line);
|
||||
var indent = next_indent + session.getTabString();
|
||||
|
|
@ -171,7 +183,7 @@ var XmlBehaviour = function () {
|
|||
text: '\n' + indent + '\n' + next_indent,
|
||||
selection: [1, indent.length, 1, indent.length]
|
||||
};
|
||||
}else{
|
||||
} else {
|
||||
return {
|
||||
text: '\n' + indent
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue