aboutsummaryrefslogtreecommitdiff
path: root/src/tt.input.c
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2020-10-23 02:12:30 +0200
committerJohn Ankarström <john@ankarstrom.se>2020-10-23 02:12:30 +0200
commit4605b90ff1e0de5b12e04647cd5dacd9848a9a74 (patch)
tree4fc6bcadbeabaea9c3941047123ed462b8087ca9 /src/tt.input.c
parentc3143fbdb7ea46539023e11cb30a7b14434030f3 (diff)
downloadtt-master.tar.gz
release 1.2.1HEADmaster
Diffstat (limited to 'src/tt.input.c')
-rw-r--r--src/tt.input.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/tt.input.c b/src/tt.input.c
index 1f88f7d..b601e68 100644
--- a/src/tt.input.c
+++ b/src/tt.input.c
@@ -82,10 +82,18 @@ int i;
int b;
int c;
-// On every iteration, tt checks whether the read character is a newline. If
-// not, the character is added to the line variable, which is re-allocated if
-// necessary. The line_l, keeping track of the line's length, is incremented
-// as well: -> main.input
+// First of all, tt ignores any carriage returns: -> main.input
+
+ if (c == '\r') continue;
+
+// On Windows, where carriage returns are used, they will automatically be
+// removed anyway. On systems that don't use carriage returns, they might not
+// be stripped from the input, which is why tt ignores them.
+
+// Otherwise, on every iteration, tt checks whether the read character is a
+// newline. If not, the character is added to the line variable, which is
+// re-allocated if necessary. The line_l, keeping track of the line's length,
+// is incremented as well: -> main.input
if (c != '\n') {
if (line_l + 1 > line_s) {