From f74f8ab122e818b257767219e39804d4a6622f12 Mon Sep 17 00:00:00 2001 From: kamkow1 Date: Sun, 8 Mar 2026 12:25:13 +0100 Subject: [PATCH] CE gapbuffer_move only when necessary, remove unused vars --- ce/edit.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ce/edit.c b/ce/edit.c index 3f56d99..fd1a4be 100644 --- a/ce/edit.c +++ b/ce/edit.c @@ -272,16 +272,15 @@ void edit_start (const char* file_path, const char* text) { case KB_DELETE: if (editor.mode == EDIT_MODE_NORMAL) { size_t len = gapbuffer_length (&editor.current_line->gb); - gapbuffer_move (&editor.current_line->gb, editor.cursor.col); if (editor.cursor.col < len) { + gapbuffer_move (&editor.current_line->gb, editor.cursor.col); if (editor.current_line->gb.gap_end < editor.current_line->gb.size) editor.current_line->gb.gap_end++; } else { if (editor.cursor.line > 0) { struct list_node_link* next = editor.current_line->lines_link.next; struct edit_line* next_line = list_entry (next, struct edit_line, lines_link); - size_t next_len = gapbuffer_length (&next_line->gb); gapbuffer_concat (&wrealloc, NULL, &editor.current_line->gb, &next_line->gb);