Permalink
Browse files

Fixed snippets formatting

  • Loading branch information...
1 parent d034141 commit 73d60dc6e57ce694be5e076328fe10a295ab45da @sergeche committed Jan 2, 2013
Showing with 13 additions and 3 deletions.
  1. +13 −3 emmet/emmet-app.js
View
@@ -8106,12 +8106,14 @@ emmet.define('expandAbbreviation', function(require, _) {
var replaceRange = require('range').create(editor.getCaretPos(), selRange.length());
editor.replaceContent(content, replaceRange.start, replaceRange.end, true);
editor.createSelection(replaceRange.start, replaceRange.start + content.length);
- return;
+ return true;
}
if (!actions.run('expand_abbreviation', editor, syntax, profile)) {
editor.replaceContent(indent, editor.getCaretPos());
}
+
+ return true;
}, {hidden: true});
// XXX setup default handler
@@ -8589,8 +8591,12 @@ emmet.exec(function(require, _) {
*/
actions.add('next_edit_point', function(editor) {
var newPoint = findNewEditPoint(editor, 1);
- if (newPoint != -1)
+ if (newPoint != -1) {
editor.setCaretPos(newPoint);
+ return true;
+ }
+
+ return false;
});
});/**
* Actions that use stream parsers and tokenizers for traversing:
@@ -11999,6 +12005,10 @@ emmet.exec(function(require, _){
});
}
+ function isRoot(item) {
+ return !item.parent;
+ }
+
/**
* Processes element with matched resource of type <code>snippet</code>
* @param {AbbreviationNode} item
@@ -12009,7 +12019,7 @@ emmet.exec(function(require, _){
item.start = item.end = '';
if (!isVeryFirstChild(item) && profile.tag_nl !== false && shouldAddLineBreak(item, profile)) {
// check if we’re not inside inline element
- if (!require('abbreviationUtils').isInline(item.parent)) {
+ if (isRoot(item.parent) || !require('abbreviationUtils').isInline(item.parent)) {
item.start = require('utils').getNewline() + item.start;
}
}

0 comments on commit 73d60dc

Please sign in to comment.