From 79f46752d465680ff50fda38a007998673f3f746 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C5=99emysl=20Janouch?= 
Date: Fri, 8 Jan 2016 08:40:40 +0100
Subject: [PATCH] degesch: make sure newlines are output correctly
---
 degesch.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff --git a/degesch.c b/degesch.c
index 6b629d6..dbecd9a 100644
--- a/degesch.c
+++ b/degesch.c
@@ -2094,6 +2094,14 @@ init_terminal (void)
 		return false;
 	}
 
+	// Make sure newlines are output correctly
+	struct termios termios;
+	if (!tcgetattr (tty_fd, &termios))
+	{
+		termios.c_oflag |= ONLCR;
+		(void) tcsetattr (tty_fd, TCSADRAIN, &termios);
+	}
+
 	g_terminal.lines   = tigetnum ("lines");
 	g_terminal.columns = tigetnum ("cols");
 	update_screen_size ();