Previously shifting text left/right would ignore blank lines (as noted in issue #419).
When shifting left though it does make sense to delete whitespace, especially as the same code is used to re-indent when pasting.
Fixes#810.
This will give the matched lines zero indent but without affecting the following lines.
Probably the only use-case for this is C preprocessor directives.
This solves the problem where we need to estimate the current line’s indent, but the lines above it is a multi-line block comment. Previously we would fetch indent patterns based on the current scope, then find the first line above caret, for which the patterns can be used to estimate the indent. The problem is that the commented lines without comment markers would be treated as code, and used for the indent.
With the new approach, we can set different patterns for ‘comment.block’ (the C bundle already does this), which basically ignore all the lines, which will cause TextMate to use the code above the comment to estimate indent.
This commit closestextmate/c.tmbundle#3 and also closestextmate/php.tmbundle#24.
Previously there was a single replace action and the options would indicate if it was a “replace all”, this mimics the “find” (which can be a “find all”) but since single match replacement is somewhat different than a “replace all”, as the former may need to know the captures from a previous find action, it makes sense to factor out these things as different actions.
This is only when explicitly asking TextMate to indent the current line / selection.
Previously these lines would remain at their current indent, this is useful for preprocessor commands, but majority of ignored lines should use current indent. It might be useful to introduce a new pattern for “zero indent” lines.
Snippets are normally inserted with indent matching that of the caret. This isn’t always desired, which is why TM 1.x allowed this feature to be disabled. This is now also supported for 2.0.
Closes#387.
When inserting paired characters where the pair consists of the same two characters, we look if the line is already balanced, and if so, insert a pair, and if not, only insert a single character. Previously we only looked at what was left of the caret, though TextMate 1.x looked at the full line, which we now also do in 2.0.
Closes#508.
This isn’t ideal but better than a potential crash (following the next edit). A better solution will have to wait to a larger refactoring (which should also consider multiple editors working on the same buffer).
Closes#186.
Since everything about session is now contained in the DocumentController class there is no need for invoking this from elsewhere and thus no need for the previous indirection.
It performs a cyclic permutation. If there are only two selections, this is equivalent to swap, but with more discontinuous selections, it is possible to repeat the transpose until the selections are ordered as desired.
The methods going to “begin of indented line” will go to the first non-whitespace character on the line, unless the caret is already there or to the left of this character, in which case it will go to the actual beginning of the line.
The “end of indented line” methods work similarly.
If you want [⇪]⌘⇠/⇢ and ⌘⌫/⌦ to use this behavior, you can add the following to your key bindings file:
"@\UF702" = "moveToBeginningOfIndentedLine:";
"$@\UF702" = "moveToBeginningOfIndentedLineAndModifySelection:";
"@\UF703" = "moveToEndOfIndentedLine:";
"$@\UF703" = "moveToEndOfIndentedLineAndModifySelection:";
"@\U007F" = "deleteToBeginningOfIndentedLine:";
"@\UF728" = "deleteToEndOfIndentedLine:";
For example moving the selection often require padding to be inserted, previously this padding would become part of the selection.
This fixes issue #72.
Since it moves one column left/right and east asian scripts have their glyphs count as two columns, it would effectively move half a column, which in practice would be done by inserting a space.
Fixes issue #469.
If the selection exceeds ARG_MAX (256 KB) then we instead set it to a placeholder value.
Previously execve() would fail if given a selection (environment) variable too big.
This was (temporarily) disallowed by previous commit. We do however need to allow it in the last placeholder since that is used for chaining snippets. See issue #182.
If caret is at the first position of a place holder then we no longer look for tab expansions, should the user press tab.
This address the issue where a placeholder has optional content and the word to the left of this optional content is a tab trigger. Previously deleting the placeholder text and pressing tab would insert a new snippet, which would generally not be expected.
This closes issue #226.
Ranges can be unanchored which is when they are made (mainly) by a unit selection, for example “select to enclosing braces”. What it means is that if we later use shift + movement actions (to “move” the selection end point) we will always extend it (as we don’t know which of the two end points should be considered the anchor).
Though the unanchored flag has a double role, for snippet placeholders we also set it, when we select the placeholder field, and when user press tab, we ignore tab expansions if there is an unanchored selection. So this disables recursive snippet expansion if the user immediately press tab when reaching a snippet placeholder.
Turns out that when we reach the last field of a snippet, some users want a new snippet expansion.
This fix is not ideal, but by far the easiest, and it achieves the goal.
This closes issue #182.
Previously it would place either the column or discontinuous selection on the find/replace clipboard, which wasn’t useful.
Now it only places the “first” range (of a discontinuous) selection on the clipboard, or first row of a column selection.
There is a bunch of functions that deal with the logical column count and these now all count code points with the “east asian width” (unicode) property set as two columns.
This closes issue #206.
The `disableIndentCorrections` setting now only disables the (aggressive) indent corrections that TextMate does while you type.
There is an additional `indentOnPaste` which you can set to:
1. `simple` — this is the indent behavior which was previously implied when setting `disableIndentCorrections`. It indents the paste to the position of the caret and works well for Python.
2. `disable` — the text is inserted as-is without indenting it.
3. «unset» — indent the paste based on the indent patterns of the current scope.
This turned out to be a little more involved due to how we need to make a distinction between a forward delete (prepend) and backward delete (append).
Implements issue #118.