Use proper line endings when writing output script
Merge typesetting events over styles and longer lines

We now check not only the next line but all possible candidates for merging in all styles.