]> granicus.if.org Git - python/commitdiff
Tweak curses.wrapper so it initializes colors if they are available.
authorEric S. Raymond <esr@thyrsus.com>
Wed, 9 Aug 2000 21:11:07 +0000 (21:11 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 9 Aug 2000 21:11:07 +0000 (21:11 +0000)
Doc/lib/libcurses.tex
Lib/curses/wrapper.py
configure.in

index be8df0c5aeddfd8f9b460b3524e5271af6d77f8d..192a8caf4788eb0ddf59281fe9698c212a85fa39 100644 (file)
@@ -1300,8 +1300,9 @@ as its first argument, followed by any other arguments passed to
 \function{wrapper()}.
 \end{funcdesc}
 
-Before calling the hook function, \function{wrapper()} turns on
-cbreak mode, turns off echo, and enables the terminal keypad.  On
-exit (whether normally or by exception) it restores cooked mode, 
-turns on echo, and disables the terminal keypad.
+Before calling the hook function, \function{wrapper()} turns on cbreak
+mode, turns off echo, enables the terminal keypad, and initializes
+colors if the terminal has color support.  On exit (whether normally
+or by exception) it restores cooked mode, turns on echo, and disables
+the terminal keypad.
 
index e7e7bb6af8b7b47ae12de4a0c4862e533764fcfd..51fb7240dc7f59d0e074ba01089e3300e9b1b81f 100644 (file)
@@ -32,6 +32,15 @@ def wrapper(func, *rest):
        # a special value like curses.KEY_LEFT will be returned
         stdscr.keypad(1)
 
+        # Start color, too.  Harmless if the terminal doesn't have
+        # color; user can test with has_color() later on.  The try/catch
+        # works around a minor bit of over-conscientiousness in the curses
+        # module -- the error return from C start_color() is ignorable.
+        try:
+            curses.start_color()
+        except:
+            pass
+
         res = apply(func, (stdscr,) + rest)
     except:
        # In the event of an error, restore the terminal
index 0367bd15502867c6348d926c4e35e6ea9a2a1326..1566643bfaf9f06837ff1621d32c19077dea9361 100644 (file)
@@ -1014,6 +1014,12 @@ AC_SUBST(HAVE_GETHOSTBYNAME)
 # checks for system services
 # (none yet)
 
+# Cope with the DB mess.  If we detect libdba, assume it's a version 2
+# or later DB and should be linked first (before the DB 1.xx stuff in glibc).
+# Also define an appropriate symbol so we can conditionalize code in the
+# dbmmodule; the API has changed since 1.xx.
+AC_CHECK_LIB(dba, __db_mutex_lock)
+
 # Linux requires this for correct f.p. operations
 AC_CHECK_FUNC(__fpu_control,
   [],