diff options
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | src/editor.c | 8 |
2 files changed, 5 insertions, 6 deletions
@@ -1,5 +1,8 @@ 2006-02-26 Shawn Betts <sabetts@vcn.bc.ca> + * src/editor.c (editor_insert): use memmove to make room for + inserted string. + * src/window.c (add_to_window_list): only change the window's group and frame if window_mapped is 0. diff --git a/src/editor.c b/src/editor.c index 98147ac..3965464 100644 --- a/src/editor.c +++ b/src/editor.c @@ -443,27 +443,23 @@ static edit_status editor_insert (rp_input_line *line, char *keysym_buf) { int nbytes; - int i; PRINT_DEBUG (("keysym_buf: '%s'\n", keysym_buf)); nbytes = strlen (keysym_buf); if (line->length + nbytes > line->size - 1) { + /* FIXME: This seems like a very bad idea. */ line->size += nbytes + 100; line->buffer = xrealloc (line->buffer, line->size); } - for (i = line->length + nbytes; i > line->position; i--) - line->buffer[i] = line->buffer[i - nbytes]; - + memmove (&line->buffer[line->position + nbytes], &line->buffer[line->position], line->length - line->position); strncpy (&line->buffer[line->position], keysym_buf, nbytes); line->length += nbytes; line->position += nbytes; - PRINT_DEBUG (("line->buffer: '%s'\n", line->buffer)); - return EDIT_INSERT; } |