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