X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/64e5fa9a495e388c922157b9a616204c299f5e05..0765e7c133eb393d8cd0292af444543c2edf8ccc:/lunaix-os/hal/term/lcntls/lcntl.c diff --git a/lunaix-os/hal/term/lcntls/lcntl.c b/lunaix-os/hal/term/lcntls/lcntl.c index fdaf244..0802318 100644 --- a/lunaix-os/hal/term/lcntls/lcntl.c +++ b/lunaix-os/hal/term/lcntls/lcntl.c @@ -80,17 +80,17 @@ lcntl_transform_seq(struct term* tdev, struct linebuffer* lbuf, bool out) } } + if (out) { + goto do_out; + } + if (c == '\n') { latest_eol = cooked->ptr + 1; - if (!out && (_lf & _ECHONL)) { + if ((_lf & _ECHONL)) { rbuffer_put(output, c); } } - if (out) { - goto do_out; - } - // For input procesing if (c == '\n' || c == EOL) { @@ -107,7 +107,8 @@ lcntl_transform_seq(struct term* tdev, struct linebuffer* lbuf, bool out) } else if (c == SUSP) { raise_sig(tdev, lbuf, SIGSTOP); } else if (c == ERASE) { - rbuffer_erase(cooked); + if (!rbuffer_erase(cooked)) + continue; } else if (c == KILL) { // TODO shrink the rbuffer } else { @@ -146,7 +147,7 @@ lcntl_transform_seq(struct term* tdev, struct linebuffer* lbuf, bool out) } } - if (!rbuffer_empty(output) && !(_lf & _NOFLSH)) { + if (!out && !rbuffer_empty(output) && !(_lf & _NOFLSH)) { term_flush(tdev); }