Re: Having trouble writing a simple grouped undo/redo

2019-08-25 Thread Edward K. Ream
On Sun, Aug 25, 2019 at 3:36 PM Brian Theado wrote: > I submitted pull request > https://github.com/leo-editor/leo-editor/pull/1302. No new failed test > cases and the failing test case I added passes. > Thanks for the new unit test. I merged the code and reran all unit tests in devel. All

Re: Having trouble writing a simple grouped undo/redo

2019-08-25 Thread Edward K. Ream
On Sat, Aug 24, 2019 at 7:56 PM Brian Theado wrote: > It turns out the '-m pdb' workaround for the readline crash does work for > me running unit tests. > Two tips. You can add a call to g.pdb() at the start of any unit test. Also, I run unitTest.leo with the --fail-fast command-line option.

Re: Having trouble writing a simple grouped undo/redo

2019-08-24 Thread Brian Theado
It turns out the '-m pdb' workaround for the readline crash does work for me running unit tests. I decided I wanted to follow the good practice of adding a failing unit test which exposes the bug and then show after the fix that same test passes. I discovered there are already unit tests for

Re: Having trouble writing a simple grouped undo/redo

2019-08-21 Thread Brian Theado
Sure, I'll do that or figure out the segfault issue sometime this week. On Tue, Aug 20, 2019 at 7:26 AM Edward K. Ream wrote: > Unfortunately, I'm not able to run unit tests without getting a segfault. >> > Alright. Create a new branch, and I'll run the unit tests there. > -- You received

Re: Having trouble writing a simple grouped undo/redo

2019-08-20 Thread Edward K. Ream
On Tue, Aug 20, 2019 at 6:22 AM Brian Theado wrote: Unfortunately, I'm not able to run unit tests without getting a segfault. > Alright. Create a new branch, and I'll run the unit tests there. Edward -- You received this message because you are subscribed to the Google Groups "leo-editor"

Re: Having trouble writing a simple grouped undo/redo

2019-08-20 Thread Brian Theado
Unfortunately, I'm not able to run unit tests without getting a segfault. It appears to be related to loading the readline library similar to what I reported last year: https://groups.google.com/d/msg/leo-editor/ghiIN7irzY0/2wreFgcYDQAJ. Though now I'm running Ubuntu 18.04. Something in the unit

Re: Having trouble writing a simple grouped undo/redo

2019-08-20 Thread Edward K. Ream
On Mon, Aug 19, 2019 at 7:04 PM Brian Theado wrote: > I found a core function which uses undo groups and used this code to call > it: > > c.createNodeHierarchy(['a', 'b', 'c'], parent=p) > c.redraw(p) > > Redoing this operation gives the same error as the test code and the > bead+1 fixes it

Re: Having trouble writing a simple grouped undo/redo

2019-08-19 Thread Brian Theado
I found a core function which uses undo groups and used this code to call it: c.createNodeHierarchy(['a', 'b', 'c'], parent=p) c.redraw(p) Redoing this operation gives the same error as the test code and the bead+1 fixes it also. I think this bug is affecting all grouped redo. On Mon, Aug 19,

Re: Having trouble writing a simple grouped undo/redo

2019-08-19 Thread Brian Theado
I think the issue is in u.redoGroup (leo/core/LeoPyRef.leo#Code-->Core classes-->@file leoUndo.py-->class Undoer-->u.redo helpers-->u.redoGroup) The line: bunch = u.beads[*u.bead*]; count = 0 Should be: bunch = u.beads[*u.bead+1*]; count = 0 That line is in both u.undoGroup and

Re: Having trouble writing a simple grouped undo/redo

2019-08-18 Thread Brian Theado
Hmm, it didn't work for me. Using your code and following the same steps as my original email, I get the same error message. After that if I start from step #4 (the ctrl-b step) again, then the undo and the redo work. But then if I start again at step #4, I get the original error message again.

Re: Having trouble writing a simple grouped undo/redo

2019-08-18 Thread Edward K. Ream
On Sun, Aug 18, 2019 at 11:35 AM Brian Theado wrote: > Thanks a lot. I'll give it a try tonight and also see if I can get similar > code working for clone and move. After that I can try to put it all > together. > You're welcome. Good luck, and feel free to ask more questions. Edward -- You

Re: Having trouble writing a simple grouped undo/redo

2019-08-18 Thread Brian Theado
Thanks a lot. I'll give it a try tonight and also see if I can get similar code working for clone and move. After that I can try to put it all together. On Sun, Aug 18, 2019, 9:32 AM Edward K. Ream wrote: > > > On Sun, Aug 18, 2019 at 8:28 AM Edward K. Ream > wrote: > >> >> On Sun, Aug 18,

Re: Having trouble writing a simple grouped undo/redo

2019-08-18 Thread Edward K. Ream
On Sun, Aug 18, 2019 at 8:28 AM Edward K. Ream wrote: > > On Sun, Aug 18, 2019 at 8:24 AM Edward K. Ream > wrote: > > At least one problem is that p changes after: > > child = parent.insertAsNthChild(0) > This works: groupType = 'insert child twice' undoType = 'insert first child twice';

Re: Having trouble writing a simple grouped undo/redo

2019-08-18 Thread Edward K. Ream
On Sun, Aug 18, 2019 at 8:24 AM Edward K. Ream wrote: At least one problem is that p changes after: child = parent.insertAsNthChild(0) Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop

Re: Having trouble writing a simple grouped undo/redo

2019-08-18 Thread Edward K. Ream
On Sun, Aug 18, 2019 at 8:15 AM Edward K. Ream wrote: > I'll take a look asap. > I see the behavior you describe. It persists if I replace p by parent in the before/after calls. Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To

Re: Having trouble writing a simple grouped undo/redo

2019-08-18 Thread Edward K. Ream
On Sun, Aug 18, 2019 at 8:12 AM Brian Theado wrote: > I wrote some code to perform 2 node inserts. I added before/after undo > commands and undo/redo of the individual operations seemed to work fine. > But when I enclose the two operations in before/after changeGroup, then > redo doesn't work. >

Having trouble writing a simple grouped undo/redo

2019-08-18 Thread Brian Theado
I wrote some code to perform 2 node inserts. I added before/after undo commands and undo/redo of the individual operations seemed to work fine. But when I enclose the two operations in before/after changeGroup, then redo doesn't work. Does anyone know what I'm doing wrong? To duplicate the