system/src/sc/parser/FormattingParseNode.java
public void findStartDiff(DiffContext ctx, boolean atEnd, Object parSemVal, ParentParseNode parParseNode, int childIx) {
      String nodeText = formatString(parSemVal, parParseNode, childIx, false);
      String text = ctx.text;
      int textLen = text.length();
      int nodeTextLen = nodeText.length();
      for (int i = 0; i < nodeTextLen; i++) {
         if (ctx.startChangeOffset >= textLen) {
            return;
         }
         if (nodeText.charAt(i) != text.charAt(ctx.startChangeOffset)) {
            IParseNode last = ctx.lastVisitedNode;
            // For formatting nodes, like error nodes, we want the last visited node to start the diff since it's possible extensions to the content of an error node
            // will change the previously incomplete parsed result.
            ctx.firstDiffNode = last.getParselet().getBeforeFirstNode(last);
            ctx.beforeFirstNode = ctx.firstDiffNode;
            return;
         }
         else {
            ctx.startChangeOffset++;
         }
      }
      if (atEnd && textLen > ctx.startChangeOffset) {
         IParseNode last = ctx.lastVisitedNode;
         ctx.firstDiffNode = last.getParselet().getBeforeFirstNode(last);
         ctx.beforeFirstNode = ctx.firstDiffNode;
      }
   }
// and only do the incremental stuff on the second change.
and only do the incremental stuff on the second change.
and only do the incremental stuff on the second change .
public void findStartDiff(DiffContext ctx, boolean atEnd, Object parSemVal, ParentParseNode parParseNode, int childIx) {
      String nodeText = formatString(parSemVal, parParseNode, childIx, false);
      String text = ctx.text;
      int textLen = text.length();
      int nodeTextLen = nodeText.length();
      for (int i = 0; i < nodeTextLen; i++) {
         if (ctx.startChangeOffset >= textLen) {
            return;
         }
         if (nodeText.charAt(i) != text.charAt(ctx.startChangeOffset)) {
            IParseNode last = ctx.lastVisitedNode;
            ctx.firstDiffNode = last.getParselet().getBeforeFirstNode(last);
            ctx.beforeFirstNode = ctx.firstDiffNode;
            return;
         }
         else {
            ctx.startChangeOffset++;
         }
      }
      if (atEnd && textLen > ctx.startChangeOffset) {
         IParseNode last = ctx.lastVisitedNode;
         ctx.firstDiffNode = last.getParselet().getBeforeFirstNode(last);
         ctx.beforeFirstNode = ctx.firstDiffNode;
      }
   }
public void findStartDiff ( DiffContext ctx , boolean atEnd , Object parSemVal , ParentParseNode parParseNode , int childIx ) { String nodeText = formatString ( parSemVal , parParseNode , childIx , false ) ; String text = ctx . text ; int textLen = text . length ( ) ; int nodeTextLen = nodeText . length ( ) ; for ( int i = 0 ; i < nodeTextLen ; i ++ ) { if ( ctx . startChangeOffset >= textLen ) { return ; } if ( nodeText . charAt ( i ) != text . charAt ( ctx . startChangeOffset ) ) { IParseNode last = ctx . lastVisitedNode ; ctx . firstDiffNode = last . getParselet ( ) . getBeforeFirstNode ( last ) ; ctx . beforeFirstNode = ctx . firstDiffNode ; return ; } else { ctx . startChangeOffset ++ ; } } if ( atEnd && textLen > ctx . startChangeOffset ) { IParseNode last = ctx . lastVisitedNode ; ctx . firstDiffNode = last . getParselet ( ) . getBeforeFirstNode ( last ) ; ctx . beforeFirstNode = ctx . firstDiffNode ; } }
and only do the incremental stuff on the second change.
and only do the incremental stuff on the second change .
// For formatting nodes, like error nodes, we want the last visited node to start the diff since it's possible extensions to the content of an error node // will change the previously incomplete parsed result.