diff --git a/Doc/howto/curses.rst b/Doc/howto/curses.rst --- a/Doc/howto/curses.rst +++ b/Doc/howto/curses.rst @@ -31,17 +31,17 @@ niches in which being able to do fancy t is on small-footprint or embedded Unixes that don't carry an X server. Another is for tools like OS installers and kernel configurators that may have to run before X is available. The curses library hides all the details of different terminals, and provides the programmer with an abstraction of a display, containing multiple non-overlapping windows. The contents of a window can be changed in various ways-- adding text, erasing it, changing its appearance--and the curses library -will automagically figure out what control codes need to be sent to the terminal +will automatically figure out what control codes need to be sent to the terminal to produce the right output. The curses library was originally written for BSD Unix; the later System V versions of Unix from AT&T added many enhancements and new functions. BSD curses is no longer maintained, having been replaced by ncurses, which is an open-source implementation of the AT&T interface. If you're using an open-source Unix such as Linux or FreeBSD, your system almost certainly uses ncurses. Since most current commercial Unix versions are based on System V @@ -113,17 +113,17 @@ to call :: to reverse the curses-friendly terminal settings. Then call the :func:`endwin` function to restore the terminal to its original operating mode. :: curses.endwin() A common problem when debugging a curses application is to get your terminal messed up when the application dies without restoring the terminal to its previous state. In Python this commonly happens when your code is buggy and -raises an uncaught exception. Keys are no longer be echoed to the screen when +raises an uncaught exception. Keys are no longer echoed to the screen when you type them, for example, which makes using the shell difficult. In Python you can avoid these complications and make debugging much easier by importing the module :mod:`curses.wrapper`. It supplies a :func:`wrapper` function that takes a callable. It does the initializations described above, and also initializes colors if color support is present. It then runs your provided callable and finally deinitializes appropriately. The callable is called inside a try-catch clause which catches exceptions, performs curses @@ -266,17 +266,17 @@ won't need to worry about leaving it in Attributes and Color -------------------- Characters can be displayed in different ways. Status lines in a text-based application are commonly shown in reverse video; a text viewer may need to highlight certain words. curses supports this by allowing you to specify an attribute for each cell on the screen. -An attribute is a integer, each bit representing a different attribute. You can +An attribute is an integer, each bit representing a different attribute. You can try to display text with multiple attribute bits set, but curses doesn't guarantee that all the possible combinations are available, or that they're all visually distinct. That depends on the ability of the terminal being used, so it's safest to stick to the most commonly available attributes, listed here. +----------------------+--------------------------------------+ | Attribute | Description | +======================+======================================+ @@ -295,17 +295,17 @@ it's safest to stick to the most commonl So, to display a reverse-video status line on the top line of the screen, you could code:: stdscr.addstr(0, 0, "Current mode: Typing mode", curses.A_REVERSE) stdscr.refresh() -The curses library also supports color on those terminals that provide it, The +The curses library also supports color on those terminals that provide it. The most common such terminal is probably the Linux console, followed by color xterms. To use color, you must call the :func:`start_color` function soon after calling :func:`initscr`, to initialize the default color set (the :func:`curses.wrapper.wrapper` function does this automatically). Once that's done, the :func:`has_colors` function returns TRUE if the terminal in use can actually display color. (Note: curses uses the American spelling 'color',