ledit

Text editor (WIP)
git clone git://lumidify.org/ledit.git (fast, but not encrypted)
git clone https://lumidify.org/git/ledit.git (encrypted, but very slow)
Log | Files | Refs | README | LICENSE

commit 85e429f9ffab1451104d5aa92fd4adc40d84865a
parent a99499a1ee2ecbbe8dcf1c64561bbc64c2dd4779
Author: lumidify <nobody@lumidify.org>
Date:   Mon,  9 May 2022 11:26:18 +0200

Add temporary fix for undo

I will need to change the undo implementation at some point to
use soft and hard fences instead of the current weirdness with
group and mode_group, but that will have to wait for now.

Diffstat:
Mundo.c | 15+++++++++++++++
1 file changed, 15 insertions(+), 0 deletions(-)

diff --git a/undo.c b/undo.c @@ -123,6 +123,17 @@ push_undo( txtbuf_copy(e->text, text); else e->text = txtbuf_dup(text); + /* + printf("START UNDO STACK\n"); + for (size_t i = 0; i < undo->len; i++) { + undo_elem *e = &undo->stack[i]; + printf( + "type %d, mode %d, group %d, mode_group %d, text '%.*s'\n", + e->type, e->mode, e->group, e->mode_group, (int)e->text->len, e->text->text + ); + } + printf("END UNDO STACK\n"); + */ } void @@ -221,6 +232,8 @@ ledit_undo(undo_stack *undo, ledit_mode mode, void *callback_data, *cur_line_ret = cur_line; *cur_index_ret = cur_index; *min_line_ret = min_line; + if (mode == NORMAL || mode == VISUAL) + undo_change_mode_group(undo); return UNDO_NORMAL; } @@ -289,6 +302,8 @@ ledit_redo(undo_stack *undo, ledit_mode mode, void *callback_data, if (undo->cur > 0) undo->cur--; *min_line_ret = min_line; + if (mode == NORMAL || mode == VISUAL) + undo_change_mode_group(undo); return UNDO_NORMAL; }