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.
This commit is contained in:
Benno Schulenberg 2021-09-09 16:17:04 +02:00
parent fdc0b0ac24
commit 46cdf8b745
1 changed files with 4 additions and 0 deletions

View File

@ -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);