From 68d763add972c346410c6b9908b516a2ea411341 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Mon, 12 Oct 2026 07:33:04 +0000 Subject: fix backspace --- src/line/cursor.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/line/cursor.cc') diff --git a/src/line/cursor.cc b/src/line/cursor.cc index 538dfca..f95f008 100644 --- a/src/line/cursor.cc +++ b/src/line/cursor.cc @@ -74,7 +74,7 @@ void cursor_input_char(char c) // it should move to the latest history history_index = get_last_index(); // normal input - if (c != '\b') + if (c != '\b' && c != '\x7f') { line_buffer.insert(buffer_index_cursor, 1, c); move_cursor(T_cursor_movement_direction::RIGHT); @@ -83,9 +83,15 @@ void cursor_input_char(char c) } // BACKSPACE - line_buffer.erase(buffer_index_cursor, 1); - // TODO: backspace page - move_cursor(T_cursor_movement_direction::LEFT); + if (buffer_index_cursor != 0) + { + line_buffer.erase(buffer_index_cursor-1, 1); + move_cursor(T_cursor_movement_direction::LEFT); + } + else + { + print("\a"); fflush(stdout); + } } -- cgit v1.3.1-4-g156e