aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/wreadln.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/wreadln.c b/src/wreadln.c
index 608141f64..89bcc123c 100644
--- a/src/wreadln.c
+++ b/src/wreadln.c
@@ -136,12 +136,13 @@ wreadln_insert_byte(struct wreadln *wr, gint key)
static void
wreadln_delete_char(struct wreadln *wr, size_t x)
{
- size_t i;
+ size_t rest;
+ const size_t length = 1;
assert(x < strlen(wr->line));
- for (i = x; wr->line[i] != 0; i++)
- wr->line[i] = wr->line[i + 1];
+ rest = strlen(&wr->line[x + length]) + 1;
+ memmove(&wr->line[x], &wr->line[x + length], rest);
}
/* libcurses version */