#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <errno.h>
#define STDIN_FD 0
#define STDOUT_FD 1
}
// Return NULL when command is still being edited
+ errno = EAGAIN;
return NULL;
}
struct ptymode mode = {.InputMode = 0, .OutputMode = 0};
_SysIOCtl(STDIN_FD, PTY_IOCTL_SETMODE, &mode);
- while( NULL == (ret = Readline_NonBlock(Info)) );
+ while( NULL == (ret = Readline_NonBlock(Info)) && errno == EAGAIN );
// stty +echo,canon
mode.InputMode = PTYIMODE_CANON|PTYIMODE_ECHO;
case '\b':
if(Info->BufferWritePos <= 0) break; // Protect against underflows
// Write the backsapce
- _SysWrite(STDOUT_FD, &ch, 1);
+ _SysWrite(STDOUT_FD, "\b \b", 3);
if(Info->BufferWritePos == Info->BufferUsed) // Simple case: End of string
{
Info->BufferUsed --;