[Toybox] [PATCH] vi: Replace linelist with Piece table based design

enh enh at google.com
Wed Feb 5 15:53:49 PST 2020


seems like $, A, and D are all broken now?

On Sun, Feb 2, 2020 at 5:52 AM Jarno Mäkipää <jmakip87 at gmail.com> wrote:
>
> I think this can be applied now. Unless someone is against it. Im
> personally starting to be happy with it. All tests pass, more tests
> can be written.
>
> (applies directly to master, on top or without tests patch send few minutes ago)
>
> Replaced dlist linelist with continuous memory blocks. This will allow
> editing huge files without billion mallocs. File is first opened with
> mmap() and mapped region is fully described in block_list as one block.
>
> Currently "valid" data is described as slices, when first loading file
> there is only one slice that points to memory existing in block_list.
> When cutting text, block_list is not freed or modified, but instead
> slice_list is modified to have "hole" between 2 slices. when inserting
> new mem_block is added, previos slices are cut in cursor position and
> new slice is added...
>
> Added functions to handling data inside block_list+slice_list
>
> insert_str(), cut_str() are used for all delete and add operations
> text_strrchr(), text_strchr() are used for searching lineendings
> text_byte(), text_codepoint(), text_getline() are for simple data access
>
> Implemented: more or less all previous functionality
>
> Implemented more proper file write:
> file is saved to .swp, blocks are unloaded, file permissions are copied,
> and atomic rename is called, block is reloaded
> chmod some defaults(rw-rw-r--) if original file could not be fstat (does
> not exist)
>
> FIX make all tests pass
>
> Removed: Some unused functions
> ---
>  toys/pending/vi.c | 1347 +++++++++++++++++++++++++++++++----------------------
>  1 file changed, 791 insertions(+), 556 deletions(-)
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net



More information about the Toybox mailing list