Frage

I am reading the code of vim 1.14 and I have some questions about undo.c.

I don't understand the implementation of the undo/redo operation, especially in the function u_undoredo().

I want to know why it uses the link list u_entry?

War es hilfreich?

Lösung

If you checkout the latest version of vim there is an explanation of vim's undo/redo implementation at the top of the undo.c file.

You can read it here.

Each u_entry list contains the information for one undo or redo.

A linked list would make sense for an undo/redo implementation to use since each entry only needs to reference the next or previous entry and can easily be added to efficiently. This is also why vim's undo history creates multiple branches of undo history. Beyond that, I'm not sure what your question is.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top