Commit 376925a1 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Remove \n if it's the last char of the selected text

BUGS: 342874
parent cc5849a6
Pipeline #79651 passed with stage
in 28 minutes and 10 seconds
......@@ -311,7 +311,7 @@ void PartTest::testSelectText()
QApplication::clipboard()->clear();
QVERIFY(QMetaObject::invokeMethod(part.m_pageView, "copyTextSelection"));
QCOMPARE(QApplication::clipboard()->text(), QStringLiteral("Hola que tal\n"));
QCOMPARE(QApplication::clipboard()->text(), QStringLiteral("Hola que tal"));
}
void PartTest::testClickInternalLink()
......@@ -455,9 +455,9 @@ void PartTest::testeTextSelectionOverAndAcrossLinks_data()
// can text-select "over and across" hyperlink.
QTest::newRow("start selection before link") << 0.1564 << 0.2943 << QStringLiteral(" a link: foo@foo.b");
// can text-select starting at text and ending selection in middle of hyperlink.
QTest::newRow("start selection in the middle of the link") << 0.28 << 0.382 << QStringLiteral("o.bar\n");
QTest::newRow("start selection in the middle of the link") << 0.28 << 0.382 << QStringLiteral("o.bar");
// text selection works when selecting left to right or right to left
QTest::newRow("start selection after link") << 0.40 << 0.05 << QStringLiteral("This is a link: foo@foo.bar\n");
QTest::newRow("start selection after link") << 0.40 << 0.05 << QStringLiteral("This is a link: foo@foo.bar");
}
// can text-select "over and across" hyperlink.
......
......@@ -1024,6 +1024,10 @@ QString PageViewPrivate::selectedText() const
pg = document->page(selpages.last());
text.append(pg->text(pg->textSelection(), Okular::TextPage::CentralPixelTextAreaInclusionBehaviour));
}
if (text.endsWith('\n')) {
text.chop(1);
}
return text;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment