tFix crash in undo/redo - ledit - Text editor (WIP)
HTML git clone git://lumidify.org/ledit.git (fast, but not encrypted)
HTML git clone https://lumidify.org/git/ledit.git (encrypted, but very slow)
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 7960e435bff5c425f81274ab0058b443575cb574
DIR parent 89c0c124f4a4097292b1e5baa5e158cdfb6a81f7
HTML Author: lumidify <nobody@lumidify.org>
Date: Thu, 23 Dec 2021 23:42:00 +0100
Fix crash in undo/redo
Diffstat:
M view.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
---
DIR diff --git a/view.c b/view.c
t@@ -1946,14 +1946,13 @@ view_undo(ledit_view *view, int num) {
/* FIXME: maybe wipe selection (although I guess this
currently isn't possible in visual mode anyways) */
for (int i = 0; i < num; i++) {
- size_t old_line = view->cur_line;
+ view_wipe_line_cursor_attrs(view, view->cur_line);
undo_status s = buffer_undo(view->buffer, view->mode, &view->cur_line, &view->cur_index);
if (view->mode == NORMAL) {
view->cur_index = view_get_legal_normal_pos(
view, view->cur_line, view->cur_index
);
}
- view_wipe_line_cursor_attrs(view, old_line);
view_set_line_cursor_attrs(view, view->cur_line, view->cur_index);
if (s != UNDO_NORMAL) {
window_show_message(view->window, undo_state_to_str(s), -1);
t@@ -1965,14 +1964,13 @@ view_undo(ledit_view *view, int num) {
void
view_redo(ledit_view *view, int num) {
for (int i = 0; i < num; i++) {
- size_t old_line = view->cur_line;
+ view_wipe_line_cursor_attrs(view, view->cur_line);
undo_status s = buffer_redo(view->buffer, view->mode, &view->cur_line, &view->cur_index);
if (view->mode == NORMAL) {
view->cur_index = view_get_legal_normal_pos(
view, view->cur_line, view->cur_index
);
}
- view_wipe_line_cursor_attrs(view, old_line);
view_set_line_cursor_attrs(view, view->cur_line, view->cur_index);
if (s != UNDO_NORMAL) {
window_show_message(view->window, undo_state_to_str(s), -1);