diff --git a/lib/tab-stop.js b/lib/tab-stop.js
index 61a423e4..aae63615 100644
--- a/lib/tab-stop.js
+++ b/lib/tab-stop.js
@@ -43,6 +43,8 @@ class TabStop {
if (newRange.start.row) {
newRange.start.column += indent.length
newRange.end.column += indent.length
+ } else if (newRange.start.row !== newRange.end.row) {
+ newRange.end.column += indent.length
}
return new Insertion({
range: newRange,
diff --git a/spec/snippets-spec.js b/spec/snippets-spec.js
index 68994478..ff3db85b 100644
--- a/spec/snippets-spec.js
+++ b/spec/snippets-spec.js
@@ -284,6 +284,10 @@ third tabstop $3\
"has a transformed tab stop such that it is possible to move the cursor between the ordinary tab stop and its transformed version without an intermediate step": {
prefix: 't18',
body: '// $1\n// ${1/./=/}'
+ },
+ "has a tab stop from end of first line till the beginning of last line": {
+ prefix: 't19',
+ body: '${1:\n\t$0\n}'
}
}
});
@@ -583,6 +587,15 @@ third tabstop $3\
expect(editor.getCursorBufferPosition()).toEqual([3, 4]);
});
+ it("indents the ending tab stop if it starts from the first line (regression)", () => {
+ editor.setCursorScreenPosition([2, Infinity]);
+ editor.insertNewline();
+ editor.insertText('t19');
+ atom.commands.dispatch(editorElement, 'snippets:expand');
+
+ expect(editor.getSelectedBufferRange()).toEqual([[3, 9], [5, 4]]);
+ });
+
it("does not change the relative positioning of the tab stops when inserted multiple times", () => {
editor.setCursorScreenPosition([2, Infinity]);
editor.insertNewline();