aboutsummaryrefslogtreecommitdiff
path: root/src/tt.input.c
diff options
context:
space:
mode:
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) {