commit 46cdf8b7453e4322b815484654aefea9d8598531
parent fdc0b0ac2439f8ac626ec83afd3ab85f823378b7
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Thu, 9 Sep 2021 16:17:04 +0200
startup: if TERM is unset, try falling back to VT220 instead of failing
Curses cannot function if not informed via TERM which type of terminal
is being used. As many terminals are mostly compatible with a VT220,
falling back to "vt220" when TERM is unset has a good chance of giving
the user a usable nano, instead of simply failing.
(Falling back to "vt100" is not good as it contains padding delays.)
This partially addresses https://bugs.debian.org/991982.
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/nano.c b/src/nano.c
@@ -2055,6 +2055,10 @@ int main(int argc, char **argv)
}
}
+ /* Curses needs TERM; if it is unset, try falling back to a VT220. */
+ if (getenv("TERM") == NULL)
+ setenv("TERM", "vt220", 0);
+
/* Enter into curses mode. Abort if this fails. */
if (initscr() == NULL)
exit(1);