Fixed this, should not be private member but a protected member

Benny


2010/8/30 Doug Blank <doug.blank@gmail.com>
On Mon, Aug 30, 2010 at 3:34 PM, Benny Malengier
<benny.malengier@gmail.com> wrote:
>
>
> 2010/8/20 Doug Blank <doug.blank@gmail.com>
>>
>> On Thu, Aug 19, 2010 at 5:51 PM, Benny Malengier
>> <benny.malengier@gmail.com> wrote:
>> >
>> >
>> > 2010/8/19 Doug Blank <doug.blank@gmail.com>
>> >>
>> >> Ok, I updated the code, so now applied style also tracks undo/redo, so
>> >> you
>> >> do not loose your style changes.
>> >>
>> >> Cool! I'll have to look to see how you did that.
>> >>
>> >
>> > I did it in a way that can exhaust memory when writing notes :-)
>> > I think we need to make the undo buffer limited, I don't see any limit
>> > to it
>> > now.
>>
>> This is very nice! Would be great to have on all Entries...
>
> But not easy
>>
>> As for a limit, I think we only need to replace the stacks implemented
>> as lists with something like:
>>
>> class Stack(list):
>>    def __init__(self, stack_size=None):
>>        super(Stack, self).__init__()
>>        self.stack_size = stack_size
>>    def append(self, item):
>>        if self.stack_size and len(self) == self.stack_size:
>>            self.pop(0)
>>        return super(Stack, self).append(item)
>>
>
> I'll look at it now
>
>>
>> There seems to be a little offset bug when you redo a delete which
>> inserts text, the following markup is offset by the length of the
>> insert, I believe. For example, if you:
>>
>> 1) type "testing 123456789" and bold the 45
>> 2) go to the beginning and type "this "
>> 3) then press control+z control+z (fine so far)
>> 4) now press control+shift+z control+shift+z
>>
>> The first redo will move the bold to the left 4, and the second redo
>> moves it to the right 3, so that 34 is now bold.
>>
>
> Not little offset bug, but a complete design bug :-D
> I redesigned it completely, should now handle everything you throw at it. It
> is so however that the last applied style to the last redo does not happen
> when typing while a style is active, but that is a minor issue to keep
> complexity down
>
> Well, probably there will be other issues, but this covers the biggest
> original problems.

Thanks, Benny, for this! The note editor, with styles, undo/redo,
copy/paste, and links to objects is really starting to a be a good
place for keeping track of our genealogical data.

One little issue:

418388: ERROR: gramps.py: line 140: Unhandled exception
Traceback (most recent call last):
 File "/home/dblank/gramps/trunk/src/gui/widgets/undoablestyledbuffer.py",
line 99, in on_tag_insert_undoable
   self.__empty_redo_stack()
AttributeError: 'UndoableStyledBuffer' object has no attribute
'_UndoableStyledBuffer__empty_redo_stack'

I looked at the code, and it looks correct. Although there may be an
issue with using the super().__init__()  perhaps calling the wrong
super.

-Doug

> Benny
>>
>> A comment below:
>>
>> > What I do is keep the style tags together with the text buffer. The text
>> > undo buffer is a diff of the text however, while the style tag buffer is
>> > the
>> > entire styledtext.get_tags() result.
>> >
>> > Hence, an improvement would be to diff the two tag lists, and somehow
>> > only
>> > store the diff in the tags. I did not think about this problem however,
>> > as I
>> > think most people will have tags=None, so keeping all tags is then not
>> > such
>> > a problem
>> >
>> > Nevertheless, making the undo buffer limited in size, eg 200 undo's is
>> > probabably something we should consider, after all, some people might
>> > feel
>> > inclined to write complete disertations with style in the notes.
>>
>> It looks like every space between a word is an undo, and so is every
>> typed word. So, a limit of 200 is only the last 100 words you type.
>> Maybe a bit bigger limit would be fine.
>>
>> -Doug
>>
>> > Benny
>> >
>> >
>
>