diff options
-rw-r--r-- | lib/interface.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/interface.c b/lib/interface.c index d0e2880..e42f6d9 100644 --- a/lib/interface.c +++ b/lib/interface.c @@ -37,11 +37,17 @@ void ifloop(void) { cread = fgetc(input); switch (cread) { case 49: /* Home */ + for (i = 0; i < position; i++) { + printf("\010"); + } + position = 0; break; case 50: /* Insert */ insert ^= 1; break; case 52: /* End */ + printf("%s", &(buffer[position])); + position = strlen(buffer); break; case 67: /* Droite */ if (buffer[position]) { @@ -75,10 +81,10 @@ void ifloop(void) { case 8: /* backspace */ if (position) { supprime(&(buffer[--position])); - } - printf("\010%s ", &(buffer[position])); - for (i = 0; i <= strlen(&(buffer[position])); i++) { - printf("\010"); + printf("\010%s ", &(buffer[position])); + for (i = 0; i <= strlen(&(buffer[position])); i++) { + printf("\010"); + } } break; case 10: /* Entrée */ |