summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tclIO.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index c862923..68d370a 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -8824,6 +8824,20 @@ CopyAndTranslateBuffer(
if (bytesInBuffer <= copied) {
copied = bytesInBuffer;
}
+ if (copied == 0) {
+ return 0;
+ }
+ if (statePtr->flags & INPUT_NEED_NL) {
+ ResetFlag(statePtr, INPUT_NEED_NL);
+
+ if (RemovePoint(bufPtr)[0] == '\n') {
+ bufPtr->nextRemoved++;
+ *result = '\n';
+ } else {
+ *result = '\r';
+ }
+ return 1;
+ }
TranslateInputEOL(statePtr, result, RemovePoint(bufPtr),
&copied, &bytesInBuffer);
bufPtr->nextRemoved += bytesInBuffer;