Skip to content

Commit 358b734

Browse files
committed
FIX: removing trailing LF from console's input tail on Posix only when in READ_LINE mode
related to: #65
1 parent 96eb7da commit 358b734

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/core/p-console.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,13 @@
8686

8787
if (req->actual == 1 && req->data[0] == '\x1B') return R_NONE; // CTRL-C
8888

89+
if (GET_FLAG(req->modes, RDM_READ_LINE)) {
8990
#ifdef TO_WINDOWS
90-
if (req->actual > 1 && GET_FLAG(req->modes, RDM_READ_LINE)) req->actual -= 2; // remove CRLF from tail
91+
if (req->actual > 1) req->actual -= 2; // remove CRLF from tail
9192
#else
92-
if (req->actual > 0) req->actual -= 1; // remove LF from tail
93+
if (req->actual > 0) req->actual -= 1; // remove LF from tail
9394
#endif
95+
}
9496

9597
// Convert to string or block of strings.
9698
args = Find_Refines(ds, ALL_READ_REFS);

0 commit comments

Comments
 (0)