Do not insert matching bracket unless the following character is whitespace

This commit is contained in:
Corey Johnson & Nathan Sobo
2012-08-01 13:20:34 -07:00
parent 1edd9973d2
commit ed12f66b13
2 changed files with 20 additions and 11 deletions

View File

@@ -20,12 +20,12 @@ class LanguageMode
return true if @editSession.hasMultipleCursors()
cursorBufferPosition = @editSession.getCursorBufferPosition()
nextCharachter = @editSession.getTextInBufferRange([cursorBufferPosition, cursorBufferPosition.add([0, 1])])
nextCharacter = @editSession.getTextInBufferRange([cursorBufferPosition, cursorBufferPosition.add([0, 1])])
if @isCloseBracket(text) and text == nextCharachter
if @isCloseBracket(text) and text == nextCharacter
@editSession.moveCursorRight()
false
else if matchingCharacter = @matchingCharacters[text]
else if /^\s*$/.test(nextCharacter) and matchingCharacter = @matchingCharacters[text]
@editSession.insertText text + matchingCharacter
@editSession.moveCursorLeft()
false