2 Replies Latest reply on May 9, 2011 3:18 PM by stgindd

    [JS][CS4] Strange behavior when inserting a "\r" character




      I'm looking for some help to solve a strange bug happening to me.


      I need to find all paragraphs with a given style, then I must insert a new paragraph before each of them.


      I use a Grep search to find the paragraphs, then I try to create a new paragraph before each of them by using :

      foundParagraph.insertionPoints[0].contents = "\r";


      Unfortunatelly, the "\r" character is inserted inside the previous paragraph, instead of the end :
      - I have "foo\rbar\r" ;
      - I want to obtain "foo\r\rbar\r" - so I use barParagraph.insertionPoints[0].contents = "\r" ;
      - the result is, for example, "fo\ro\rbar\r", so the "\r" character is inside the "foo" paragraph.


      The position of the "\r" character inside the previous paragraph varies with the font size. I suppose that this could be a clue - but I have no idea of what's happening.


      Would someone have an idea ?