Fixed the 'select one line twice' bug.

It's always helpfull to talk to a koffice developer, thanks to Thomas :)

svn path=/trunk/KDE/kdegraphics/okular/; revision=663744
remotes/origin/KDE/4.0
Tobias Koenig 19 years ago
parent 61b3f856d0
commit bbbbd8eda9
  1. 4
      core/textdocumentgenerator.cpp
  2. 7
      core/textdocumentgenerator_p.h

@ -63,9 +63,11 @@ Okular::TextPage* TextDocumentGenerator::Private::createTextPage( int pageNumber
cursor.setPosition( i + 1, QTextCursor::KeepAnchor );
QString text = cursor.selectedText();
if ( text.length() == 1 && text[ 0 ].isPrint() ) {
if ( text.length() == 1 ) {
QRectF rect;
Utils::calculateBoundingRect( mDocument, i, i + 1, rect, pageNumber );
if ( pageNumber == -1 )
text = "\n";
textPage->append( text, new Okular::NormalizedRect( rect.left(), rect.top(), rect.right(), rect.bottom() ) );
}

@ -49,6 +49,13 @@ class Utils
int offset = qRound( y ) % qRound( pageSize.height() );
if ( x > r ) { // line break, so return a pseudo character on the start line
rect = QRectF( x / pageSize.width(), offset / pageSize.height(),
3 / pageSize.width(), startLine.height() / pageSize.height() );
page = -1;
return;
}
page = qRound( y ) / qRound( pageSize.height() );
rect = QRectF( x / pageSize.width(), offset / pageSize.height(),
(r - x) / pageSize.width(), (b - y) / pageSize.height() );

Loading…
Cancel
Save