commit 53f724d4fb68c505454209064162de398c66c8bd
parent 1629cde6c37b1a585bd798911609b3e2b635fd9d
Author: Martin Kloeckner <mjkloeckner@gmail.com>
Date: Thu, 6 Mar 2025 00:15:35 -0300
fix cursor deleting prompt when pressing Backspace
this occurred after moving the cursor to the left
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/msh.c b/msh.c
@@ -140,7 +140,7 @@ char *editor_read_line(char *s) {
/* Backspace */
if(c == 0x7f) {
- if (line_len > 0) {
+ if (line_len > 0 && cursor_pos > 0) {
line_len -= 1;
cursor_pos -= 1;
printf("\b \b");