CE edit optimize KB_DELETE
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m28s

This commit is contained in:
2026-03-07 23:49:26 +01:00
parent b1755623a3
commit 0692b030cb

View File

@@ -271,9 +271,12 @@ void edit_start (const char* file_path, const char* text) {
} break; } break;
case KB_DELETE: case KB_DELETE:
if (editor.mode == EDIT_MODE_NORMAL) { if (editor.mode == EDIT_MODE_NORMAL) {
if (editor.cursor.col < gapbuffer_length (&editor.current_line->gb)) { size_t len = gapbuffer_length (&editor.current_line->gb);
if (editor.cursor.col < len) {
gapbuffer_move (&editor.current_line->gb, editor.cursor.col); gapbuffer_move (&editor.current_line->gb, editor.cursor.col);
editor.current_line->gb.gap_end++;
if (editor.current_line->gb.gap_end < editor.current_line->gb.size)
editor.current_line->gb.gap_end++;
} }
} }
break; break;