Skip to content

Commit

Permalink
fix behavior for escaped close-parens (close #106 and #109)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaunlebron committed Apr 2, 2016
1 parent 3144315 commit 8b4f424
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 62 deletions.
12 changes: 6 additions & 6 deletions lib/parinfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,12 +474,12 @@ function updateParenTrailBounds(result) {
if (result.x > 0) { prevCh = line[result.x - 1]; }
var ch = result.ch;

var shouldReset = (
result.isInCode &&
!isCloseParen(ch) &&
ch !== "" && // erased character
(ch !== BLANK_SPACE || prevCh === BACKSLASH) && // non-escaped space
ch != DOUBLE_SPACE // double-space (converted tab)
var shouldReset = ( // In order to reset, the current character...
result.isInCode && // - cannot be inside a string or comment
(!isCloseParen(ch) || prevCh === BACKSLASH) && // - cannot be a close-paren, unless escaped
ch !== "" && // - cannot be an erased character
(ch !== BLANK_SPACE || prevCh === BACKSLASH) && // - cannot be a space, unless escaped
ch != DOUBLE_SPACE // - cannot be a double-space (converted tab)
);

if (shouldReset) {
Expand Down
Loading

0 comments on commit 8b4f424

Please sign in to comment.