Debugger: Fix reading empty lines
Jeffrey Pfau jeffrey@endrift.com
Sun, 30 Oct 2016 02:50:58 -0700
1 files changed,
7 insertions(+),
3 deletions(-)
M
src/feature/editline/cli-el-backend.c
→
src/feature/editline/cli-el-backend.c
@@ -76,9 +76,13 @@ struct CLIDebuggerEditLineBackend* elbe = (struct CLIDebuggerEditLineBackend*) be;
int count; *len = 0; const char* line = el_gets(elbe->elstate, &count); - if (line && count >= 1) { - // Crop off newline - *len = (size_t) count - 1; + if (line) { + if (count > 1) { + // Crop off newline + *len = (size_t) count - 1; + } else if (count == 1) { + *len = 1; + } } return line; }