r3bl-org/r3bl-open-core

[tui] Editor component - add undo feature

Closed this issue · 0 comments

With select => cut / paste / delete comes the need for Undo.

Even though we use r3bl-redux at the app/component level, we do not use it inside the editor component itself. The editor component uses editor buffer and engine to manage its internal state. So redux and reducers and the undo capabilities that can provide are not available inside the editor component.

In order to implement this inside the editor component, we might extend the editor buffer by maintaining an Vec of buffers that we can go back to when any operation to change the buffer is performed. This might include keyboard movement as well as selection changes. I am not really sure how far we take this (to close the entire editor buffer including caret, selection state, etc, OR just the editor content).