From c1bb6485de91eb661b527b0fd849e4ac653411fa Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@telfort.nl>
Date: Fri, 12 Jan 2018 09:51:43 +0100
Subject: [PATCH] tweaks: check for the type of terminal far earlier

So the result could be used during RC-file reading.
---
 src/nano.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/nano.c b/src/nano.c
index 7a8caf86..64e523a8 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -1980,6 +1980,11 @@ int main(int argc, char **argv)
 		{NULL, 0, NULL, 0}
 	};
 
+#ifdef __linux__
+	/* Check whether we're running on a Linux console. */
+	console = (getenv("DISPLAY") == NULL);
+#endif
+
 	/* Back up the terminal settings so that they can be restored. */
 	tcgetattr(0, &oldterm);
 
@@ -2471,11 +2476,6 @@ int main(int argc, char **argv)
 	/* Set up the terminal state. */
 	terminal_init();
 
-#ifdef __linux__
-	/* Check whether we're running on a Linux console. */
-	console = (getenv("DISPLAY") == NULL);
-#endif
-
 #ifdef DEBUG
 	fprintf(stderr, "Main: set up windows\n");
 #endif
-- 
GitLab