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

Jarno Mäkipää jmakip87 at gmail.com
Thu Feb 6 07:46:43 PST 2020


Oh yeah, sorry.

Well techically they are not broken, but drawing of cursor position at
end of line symbol does not work. its issue in draw_page()....

Those movement commands work fine, and tests return correct results.
And text is edited right i think. Hard to cover this with testing :(
but anyway this needs to be fixed.

-Jarno

On Thu, Feb 6, 2020 at 1:54 AM enh <enh at google.com> wrote:
>
> 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