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

List:       kde-commits
Subject:    [calligra] libs/kotext/commands: Fix wrong style applied on backspace
From:       Pierre Stirnweiss <pstirnweiss () googlemail ! com>
Date:       2013-01-12 12:42:57
Message-ID: 20130112124257.C3D4BA60C8 () git ! kde ! org
[Download RAW message or body]

Git commit efd67ba30629da14ca05ddf6438ef072b262fa50 by Pierre Stirnweiss.
Committed on 06/01/2013 at 09:55.
Pushed by pstirnweiss into branch 'master'.

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/efd67ba30629da14ca05ddf6438ef072b262fa50

diff --git a/libs/kotext/commands/DeleteCommand.cpp b/libs/kotext/commands/DeleteCommand.cpp
index 77bf535..5d39f4f7 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