Introduction
Introduction Statistics Contact Development Disclaimer Help
tWipe line cursor on undo/redo - 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 4aca634c431a29518a56b662e0aac57c95737974
parent da472f5508527b1221e1365fa152e2171e877897
Author: lumidify <[email protected]>
Date: Sun, 26 Dec 2021 18:27:19 +0100
Wipe line cursor on undo/redo
Diffstat:
M README | 7 ++++++-
M keys_basic.c | 4 ----
M view.c | 14 ++++++++++----
3 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/README b/README
t@@ -8,7 +8,12 @@ layout.
Additionally, it allows multiple views on a text buffer so that different
parts of a file can be shown at the same time.
-REQUIREMENTS: pango, xlib (extensions: xkb, xdbe)
+REQUIREMENTS: pango (with xft), xlib (extensions: xkb, xdbe)
+
+Packages to install:
+On OpenBSD: pango
+On MX Linux: libpango1.0-dev, libx11-dev, libxkbfile-dev
+(this is just from memory, I need to test it with a fresh system sometime)
The documentation can be viewed in ledit.1 or at the following locations:
diff --git a/keys_basic.c b/keys_basic.c
t@@ -2008,9 +2008,7 @@ undo(ledit_view *view, char *text, size_t len) {
if (num == 0)
num = 1;
view_wipe_selection(view);
- view_wipe_line_cursor_attrs(view, view->cur_line);
view_undo(view, num);
- view_set_line_cursor_attrs(view, view->cur_line, view->cur_index);
finalize_repetition_stack();
return (struct action){ACTION_NONE, NULL};
}
t@@ -2026,9 +2024,7 @@ redo(ledit_view *view, char *text, size_t len) {
if (num == 0)
num = 1;
view_wipe_selection(view);
- view_wipe_line_cursor_attrs(view, view->cur_line);
view_redo(view, num);
- view_set_line_cursor_attrs(view, view->cur_line, view->cur_index);
finalize_repetition_stack();
return (struct action){ACTION_NONE, NULL};
}
diff --git a/view.c b/view.c
t@@ -1958,38 +1958,44 @@ void
view_undo(ledit_view *view, int num) {
/* FIXME: maybe wipe selection (although I guess this
currently isn't possible in visual mode anyways) */
+ view_wipe_line_cursor_attrs(view, view->cur_line);
for (int i = 0; i < num; i++) {
- view_wipe_line_cursor_attrs(view, view->cur_line);
undo_status s = buffer_undo(view->buffer, view->mode, &view->c…
if (view->mode == NORMAL) {
view->cur_index = view_get_legal_normal_pos(
view, view->cur_line, view->cur_index
);
}
- view_set_line_cursor_attrs(view, view->cur_line, view->cur_ind…
if (s != UNDO_NORMAL) {
window_show_message(view->window, undo_state_to_str(s)…
break;
}
}
+ if (view->mode == NORMAL)
+ view_set_line_cursor_attrs(view, view->cur_line, view->cur_ind…
+ else
+ view_wipe_line_cursor_attrs(view, view->cur_line);
}
void
view_redo(ledit_view *view, int num) {
+ view_wipe_line_cursor_attrs(view, view->cur_line);
for (int i = 0; i < num; i++) {
- view_wipe_line_cursor_attrs(view, view->cur_line);
undo_status s = buffer_redo(view->buffer, view->mode, &view->c…
if (view->mode == NORMAL) {
view->cur_index = view_get_legal_normal_pos(
view, view->cur_line, view->cur_index
);
}
- view_set_line_cursor_attrs(view, view->cur_line, view->cur_ind…
if (s != UNDO_NORMAL) {
window_show_message(view->window, undo_state_to_str(s)…
break;
}
}
+ if (view->mode == NORMAL)
+ view_set_line_cursor_attrs(view, view->cur_line, view->cur_ind…
+ else
+ view_wipe_line_cursor_attrs(view, view->cur_line);
}
/* FIXME: this could give weird results if the paste occurs in multiple
You are viewing proxied material from lumidify.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.