On Mon, Apr 23, 2018 at 6:50 AM, vitalije <vitali...@gmail.com> wrote:
> In order to avoid code duplication some other duplication have been made. And it is not easy to spot the duplication and unnecessary code unless you really dive into this code. ... > Proposing three different methods for three kinds of paste commands, I haven't imagined them to be like those. This is just first layer of decomposing code. ... > This is not complete code just a blueprint. But implemented this way would look much better and point out in more contrast the difference from the current implementation. All interesting comments. I would like to see the complete new code in a new branch. > fc.getOutlineFromClipboard creates at first v node, and then creates a position to hold this v node, then in the above implementations, calls methods of the position class moveToNthChildOf or linkAsNthChildOf which are delegating their jobs to p.v methods. It would be much simpler if getOutlineFromClipboard returns v instance, and then just make link with parent_v. Maybe, but this would make fc.getOutlineFromClipboard less self contained. This matters, because it can be called from several places, including the read logic. I am now going to fix #862: paste-retaining-clones can corrupt the outline <https://github.com/leo-editor/leo-editor/issues/862>The fix looks like it will be in fc.getLeoOutlineFromClipboard, or perhaps its helpers. I doubt whether any refactoring would make the bug, or its fix, easier to spot. Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To post to this group, send email to leo-editor@googlegroups.com. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.