This only works when none of the discontinuous selections contain newlines.
Trailing whitespace can happen when removing comments from empty lines (with indented comment markers) or when the comment marker itself has whitespace and is inserted on an empty line (e.g. prefixing empty lone with ‘# ’).
The use case is code like: if(foo) statement; If we want to add more statements (under the if block) then we need to wrap the statement in braces but don’t want the indent changed. Likewise we may be left with a single statement in the block and prefer the non-braced version.
We now re-use the line’s indent and add at most 4 more spaces. This should avoid the bad cases with long lines causing the comment to be wrapped with a problematic small width.
Normally we have single-quote disabled as a paired character for strings (and comments) but when there is a selection it’s more likely that the user wants to wrap the selection than replace selection with a single-quote character.
When commenting or uncommenting text we want to leave the text as it is rather than indenting to the point of the first like a normal command. Fixes textmate/textmate#387, however it will require a TextMate update as this flag is not currently enabled in 2.0.
We enable spell checking for strings in the source scope which allows sensible spell checking. However inside of the text scope we want to not enable these when they appear in embedded source code (eg: PHP) as it is more common to want to have spell checking enabled in text files without getting it in the source portion.
Languages do not have indent patterns that handle (block) comments, so TextMate basically never does the right thing inside these. Ideally we would also disable it for the line following the block comment (since the estimated indent there is thrown off by the block comment), but that is presently not possible. Users can disable auto-corrections for the entire file scope, should they run into this a lot. Closes textmate/textmate#721.
This will strip a single pair of leading/trailing braces, quotes, and similar. It also works to strip an Objective-C string: @"foo" → foo. The command is only active when there is a selection. Presently no effort is done to actually ensure the stripped characters are actually balanced. It doesn’t seem like any real benefit would be derived for adding this complexity.
…TM_COLUMNS environment variable