changeset 31085:27d3bc0c9093

color: make a test for curse availability explicite We won't use terminfo when curse failed to load. Before this change, we were doing an indirect test, relying on the fact some variable ('_terminfo_params') would be empty if curses failed to load. We update the code to be more explicit and directly checks if we managed to load the curse module.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Thu, 22 Dec 2016 06:17:40 +0100
parents a0bde5ec3a46
children cf2bc3792ef4
files hgext/color.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/color.py	Thu Dec 22 03:11:19 2016 +0100
+++ b/hgext/color.py	Thu Dec 22 06:17:40 2016 +0100
@@ -196,7 +196,7 @@
     '''Initialize terminfo data and the terminal if we're in terminfo mode.'''
 
     # If we failed to load curses, we go ahead and return.
-    if not color._terminfo_params:
+    if curses is None:
         return
     # Otherwise, see what the config file says.
     if mode not in ('auto', 'terminfo'):