Version: 1.2.1 (using KDE 3.1.0) Installed from: SuSE Compiler: gcc version 3.2 OS: Linux (i686) release 2.4.19-4GB When I write a paragraph with line-breaks and copy/paste it via the clipboard my new pasted line-breaks are replaced by paragraph-breaks. I think this should be made better in next version because it makes a lot of work when I copy/paste much text with line-breaks.
Subject: Re: New: line breaks replaced by new paragraph when copy/paste via clipboard On Wednesday 26 March 2003 22:24, you wrote: > When I write a paragraph with line-breaks and copy/paste it via the clipboard my new pasted line-breaks are replaced by paragraph-breaks. I think this should be made better in next version because it makes a lot of work when I copy/paste much text with line-breaks. Please specify, which application you're copying from, and which one you're pasting to? Is this from plain text, to plain text, or "from kword to kword" ? Thanks.
I copy and paste within kword. I copy some lines and paste it at another position in the same kword document.
Subject: koffice/kword CVS commit by faure: Fixed pasting so that it can differenciate between linebreaks and paragraph boundaries. CCMAIL: 56456-done@bugs.kde.org M +15 -18 kwcommand.cc 1.214 --- koffice/kword/kwcommand.cc #1.213:1.214 @@ -51,7 +51,11 @@ KoTextCursor * KWPasteTextCommand::execu cursor.setParag( firstParag ); cursor.setIndex( m_idx ); + c->setParag( firstParag ); + c->setIndex( m_idx ); QDomDocument domDoc; domDoc.setContent( m_data ); QDomElement elem = domDoc.documentElement(); + KWTextDocument * textdoc = static_cast<KWTextDocument *>(c->parag()->document()); + KWTextFrameSet * textFs = textdoc->textFrameSet(); // We iterate twice over the list of paragraphs. // First time to gather the text, @@ -61,5 +65,4 @@ KoTextCursor * KWPasteTextCommand::execu QValueList<QDomElement> listParagraphs; QDomElement paragraph = elem.firstChild().toElement(); - bool first = true; for ( ; !paragraph.isNull() ; paragraph = paragraph.nextSibling().toElement() ) { @@ -67,24 +70,18 @@ KoTextCursor * KWPasteTextCommand::execu { QString s = paragraph.namedItem( "TEXT" ).toElement().text(); - if ( !first ) - text += '\n'; - else - first = false; - text += s; + //kdDebug() << "KWPasteTextCommand::execute Inserting text: '" << s << "'" << endl; + c->insert( s, false /*newline=linebreak, not new parag*/ ); + + if ( !paragraph.nextSibling().isNull() ) // Not for last parag + { + // Create new parag + // Lowlevel method: + c->splitAndInsertEmptyParag( FALSE, TRUE ); + // Highlevel method: + //c->insert( "\n", true ); + } listParagraphs.append( paragraph ); } } - kdDebug() << "KWPasteTextCommand::execute Inserting text: '" << text << "'" << endl; - KWTextDocument * textdoc = static_cast<KWTextDocument *>(c->parag()->document()); - KWTextFrameSet * textFs = textdoc->textFrameSet(); - textFs->unzoom(); - - cursor.insert( text, true ); - - // Move cursor to the end - c->setParag( firstParag ); - c->setIndex( m_idx ); - for ( int i = 0; i < (int)text.length(); ++i ) - c->gotoNextLetter(); // Redo the parag lookup because if firstParag was empty, insert() has