Hi<br><br>I have problem with EOLs in QScintilla.<br><br>Let's open 2 QScintilla based editors. First is configured to work in CR EOL mode, and second in LF EOL mode.<br>If I copy text from first to second - second contains mix of different EOL modes.<br>
To see it, activate EOL symbols visibility or check saved file with hex editor.<br><br>I think, when pasting, QScintilla should automatically convert EOLs of pasted text to current EOL mode of the file.<br><br>I can not reproduce this bug on SciTE, seems, Qt implementation specific.<br>
I also checked SciTE code, it seems, it does not do any conversions when pasting, but only calls Scintilla GTK implementation.<br><br>This problem was discussed on QScintilla bugtracker<br><a href="https://sourceforge.net/tracker/index.php?func=detail&aid=1216370&group_id=2439&atid=352439">https://sourceforge.net/tracker/index.php?func=detail&aid=1216370&group_id=2439&atid=352439</a><br>
<br>I discovered, that JuffED fixes this problem in its code, but, I think, it would be better, if QScintilla handles it...<br><br><br><div style="margin-left: 40px;">void JuffScintilla::paste() {<br>    QString originalText = QApplication::clipboard()->text();<br>
    QString convertedText;<br>    if ( originalText.contains(LineSeparatorRx) ) {<br>        QStringList lines = originalText.split(LineSeparatorRx);<br>        switch ( eolMode() ) {<br>            case EolWindows : convertedText = lines.join("\r\n"); break;<br>
            case EolUnix    : convertedText = lines.join("\n"); break;<br>            case EolMac     : convertedText = lines.join("\r"); break;<br>        }<br>        QApplication::clipboard()->setText(convertedText);<br>
    }<br>    <br>    if ( SendScintilla(SCI_SELECTIONISRECTANGLE) ) {<br>        QString text = QApplication::clipboard()->text();<br>        int line1, col1, line2, col2;<br>        getOrderedSelection(line1, col1, line2, col2);<br>
        <br>        beginUndoAction();<br>        deleteRectSelection(line1, col1, line2, col2);<br>        for ( int line = line2; line >= line1; --line ) {<br>            insertAt(text, line, col1);<br>        }<br>        endUndoAction();<br>
    }<br>    else {<br>        QsciScintilla::paste();<br>    }<br>    <br>    // restore the original clipboard content<br>    QApplication::clipboard()->setText(originalText);<br>}<br></div><br><br>Andrei Kopats<br>