[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [calligra/calligra/2.6] plugins/textshape: Make sure select all always selects all text.
From:       C. Boemann <cbo () boemann ! dk>
Date:       2012-12-15 21:04:49
Message-ID: 20121215210449.11917A6091 () git ! kde ! org
[Download RAW message or body]

Git commit 8860f5f5daba721f5d1ede96069e9c59f1e5be4e by C. Boemann.
Committed on 15/12/2012 at 19:34.
Pushed by boemann into branch 'calligra/2.6'.

Make sure select all always selects all text.

previous code failed if there were footnotes or endnotes or annotations

BUG:308902

M  +1    -2    plugins/textshape/TextTool.cpp

http://commits.kde.org/calligra/8860f5f5daba721f5d1ede96069e9c59f1e5be4e

diff --git a/plugins/textshape/TextTool.cpp b/plugins/textshape/TextTool.cpp
index 207dfd9..c0562c5 100644
--- a/plugins/textshape/TextTool.cpp
+++ b/plugins/textshape/TextTool.cpp
@@ -2434,8 +2434,7 @@ void TextTool::selectAll()
     if (!textEditor || !m_textShapeData)
         return;
     const int selectionLength = qAbs(textEditor->position() - textEditor->anchor());
-    QTextBlock lastBlock = m_textShapeData->document()->lastBlock();
-    textEditor->setPosition(lastBlock.position() + lastBlock.length() - 1);
+    textEditor->movePosition(QTextCursor::End);
     textEditor->setPosition(0, QTextCursor::KeepAnchor);
     repaintSelection();
     if (selectionLength != qAbs(textEditor->position() - textEditor->anchor())) // it actually changed

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic