[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [calligra/textshape-stylesWidget-PierreSt] libs/kotext/commands: Fix wrong style applied on backspac
From: Pierre Stirnweiss <pstirnweiss () googlemail ! com>
Date: 2013-01-12 13:11:16
Message-ID: 20130112131116.42E44A60C8 () git ! kde ! org
[Download RAW message or body]
Git commit 95c8e98228d7d52856f565a5186625a6d523a005 by Pierre Stirnweiss.
Committed on 06/01/2013 at 09:55.
Pushed by pstirnweiss into branch 'textshape-stylesWidget-PierreSt'.
Fix wrong style applied on backspace
When using backspace, we keep the char format of the deleted char.
This should not apply when deleting across the newline boundary.
M +4 -1 libs/kotext/commands/DeleteCommand.cpp
http://commits.kde.org/calligra/95c8e98228d7d52856f565a5186625a6d523a005
diff --git a/libs/kotext/commands/DeleteCommand.cpp b/libs/kotext/commands/DeleteCommand.cpp
index 622062a..06c1528 100644
--- a/libs/kotext/commands/DeleteCommand.cpp
+++ b/libs/kotext/commands/DeleteCommand.cpp
@@ -138,6 +138,7 @@ void DeleteCommand::doDelete()
Q_ASSERT(textEditor);
QTextCursor *caret = textEditor->cursor();
QTextCharFormat charFormat = caret->charFormat();
+ bool caretAtBeginOfBlock = (caret->position() == caret->block().position());
if (!textEditor->hasSelection()) {
if (m_mode == PreviousChar) {
@@ -176,7 +177,9 @@ void DeleteCommand::doDelete()
caret->deleteChar();
- caret->setCharFormat(charFormat);
+ if (m_mode != PreviousChar || !caretAtBeginOfBlock) {
+ caret->setCharFormat(charFormat);
+ }
}
void DeleteCommand::deleteTextAnchor(KoInlineObject *object)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic