Fixes comment restoring on Windows.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Fri, 18 Sep 2015 06:37:06 +0000 (07:37 +0100)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Fri, 18 Sep 2015 06:37:06 +0000 (07:37 +0100)
Windows line break is two characters long, so we need
to take that into account.

lib/text/comments-processor.js

index 941fc67..2063b53 100644 (file)
@@ -113,7 +113,7 @@ function restore(context, data, from, isSpecial) {
 
       cursor = nextMatch.end;
     } else {
-      cursor = nextMatch.end + (context.keepBreaks && data[nextMatch.end] == lineBreak ? 1 : 0);
+      cursor = nextMatch.end + (context.keepBreaks && data.substring(nextMatch.end, nextMatch.end + lineBreak.length) == lineBreak ? lineBreak.length : 0);
     }
   }