Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add feature: copy, like move #193

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Commits on Oct 17, 2021

  1. Add feature: copy selection

    Just like move (from where the main idea is copied), but keeps the original
    chunks in place.
    
    The implementation currently suffers from one drawback - the new chunks
    aren't added into the byStart/byEnd indexes - since these index by original
    location, the index would now have to lead to 2 locations. So if you copy
    first, then overwrite/append/prepend, the changes are only written in the
    original location, not on the copied snippet. However, if you do anything
    before copying, the changes are carried over.
    mvolfik committed Oct 17, 2021
    Configuration menu
    Copy the full SHA
    b49802c View commit details
    Browse the repository at this point in the history
  2. Add tests for the copy feature

    In test/dev builds, DEBUG is replaced with true, which runs additional
    code marking the 'duplicate' chunks created by .copy() with chunk.isCopy.
    
    This is detected in integrity checker in tests - these chunks are,
    as described in previous commit, not included in the indexes, which
    isn't easy to solve, so these chunks are just excluded from the check.
    
    In production code (verified with npm run publish), DEBUG is replaced
    with false and the code becomes unreachable and is tree-shaked.
    mvolfik committed Oct 17, 2021
    Configuration menu
    Copy the full SHA
    bcb0ec5 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    252aaf3 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    af1eafe View commit details
    Browse the repository at this point in the history
  5. Add copy to typedef

    mvolfik committed Oct 17, 2021
    Configuration menu
    Copy the full SHA
    21566b8 View commit details
    Browse the repository at this point in the history