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

List:       kwrite-devel
Subject:    Re: making undo steps work again...
From:       Dominik Haumann <dhdev () gmx ! de>
Date:       2008-04-29 17:14:17
Message-ID: 200804291914.17485.dhdev () gmx ! de
[Download RAW message or body]

I've committed this now, please test.

On Friday 25 April 2008, Dominik Haumann wrote:
>  Hi,
>
> including the text selection and cursor position in undo groups as
> KateUndo items has the side effect that edit merging does not work
> anymore: If you undo, each character is e.g. removed step by step.
>
> Why? Because the new undo item is compared to the last() item of a group.
> This is now setting the cursor position or selection, so merges never
> happen. The relevant function is:
>
> void KateUndoGroup::addItem(KateUndo* u)
> {
>   if (!u->isValid())
>     delete u;
>   else if (!m_items.isEmpty() && m_items.last()->merge(u))
>     delete u;
>   else
>     m_items.append(u);
> }
>
> Attached is a patch that fixes this issue. It's taking an entirely
> different approach: It does *not* model text selection and cursor
> position as separate KateUndo items. Instead, it adds text selection and
> cursor position directly to the KateUndoGroup.
>
> I've tested it a bit and it works. I don't know exactly in which cases
>   bool KateUndoGroup::merge(KateUndoGroup* newGroup,bool complex)
> is called (merging two groups). If you know how to trigger this, can you
> please test the behaviour? Maybe special handling for selection/cursor
> position is needed here.
>
> If you think that is sane enough, please commit the patch, as I rarely
> have internet access right now and disklike having patches lying around
> for long :)
>
> Apply the patch in kdelibs/kate
>
> Thx,
> Dominik


_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

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