]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - doc/html/ncurses-intro.html
ncurses 6.0 - patch 20151219
[ncurses.git] / doc / html / ncurses-intro.html
index 1f09a7c2a265b5dc297f6e1947c17610935c1cfb..a6cd40c74ddb9aa602d114e2028213c85bb8e386 100644 (file)
@@ -1,6 +1,33 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN">
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
 <!--
-  $Id: ncurses-intro.html,v 1.40 2004/06/05 19:10:10 tom Exp $
+  $Id: ncurses-intro.html,v 1.46 2013/05/17 23:29:27 tom Exp $
+  ****************************************************************************
+  * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
+  *                                                                          *
+  * Permission is hereby granted, free of charge, to any person obtaining a  *
+  * copy of this software and associated documentation files (the            *
+  * "Software"), to deal in the Software without restriction, including      *
+  * without limitation the rights to use, copy, modify, merge, publish,      *
+  * distribute, distribute with modifications, sublicense, and/or sell       *
+  * copies of the Software, and to permit persons to whom the Software is    *
+  * furnished to do so, subject to the following conditions:                 *
+  *                                                                          *
+  * The above copyright notice and this permission notice shall be included  *
+  * in all copies or substantial portions of the Software.                   *
+  *                                                                          *
+  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+  *                                                                          *
+  * Except as contained in this notice, the name(s) of the above copyright   *
+  * holders shall not be used in advertising or otherwise to promote the     *
+  * sale, use or other dealings in this Software without prior written       *
+  * authorization.                                                           *
+  ****************************************************************************
 -->
 <HTML>
 <HEAD>
@@ -404,6 +431,7 @@ mentioned above. <P>
 Here is a sample program to motivate the discussion:
 
 <PRE>
+#include &lt;stdlib.h&gt;
 #include &lt;curses.h&gt;
 #include &lt;signal.h&gt;
 
@@ -887,15 +915,14 @@ Here is some sample code for shellout:
 
 <H3><A NAME="xterm">Using NCURSES under XTERM</A></H3>
 
-A resize operation in X sends SIGWINCH to the application running under xterm.
-The <CODE>ncurses</CODE> library provides an experimental signal
-handler, but in general does not catch this signal, because it cannot
-know how you want the screen re-painted.  You will usually have to write the
-SIGWINCH handler yourself.  Ncurses can give you some help. <P>
+A resize operation in X sends <CODE>SIGWINCH</CODE> to the application running
+under xterm.
 
-The easiest way to code your SIGWINCH handler is to have it do an
-<CODE>endwin</CODE>, followed by an <CODE>refresh</CODE> and a screen repaint you code
-yourself.  The <CODE>refresh</CODE> will pick up the new screen size from the
+The easiest way to handle <CODE>SIGWINCH</CODE>
+is to do an <CODE>endwin</CODE>,
+followed by an <CODE>refresh</CODE> and a screen repaint you code
+yourself.
+The <CODE>refresh</CODE> will pick up the new screen size from the
 xterm's environment. <P>
 
 That is the standard way, of course (it even works with some vendor's curses
@@ -907,8 +934,17 @@ not resize subwindows which must be shrunk.
 are limited to the new screen dimensions, and pads <CODE>stdscr</CODE>
 with blanks if the screen is larger. <P>
 
-Finally, ncurses can be configured to provide its own SIGWINCH handler,
-based on <CODE>resizeterm</CODE>.
+The <CODE>ncurses</CODE> library provides a SIGWINCH signal handler,
+which pushes a <CODE>KEY_RESIZE</CODE> via the wgetch() calls.
+When <CODE>ncurses</CODE> returns that code,
+it calls <code>resizeterm</CODE>
+to update the size of the standard screen's window, repainting that
+(filling with blanks or truncating as needed).
+It also resizes other windows,
+but its effect may be less satisfactory because it cannot
+know how you want the screen re-painted.
+You will usually have to write special-purpose code to handle
+<CODE>KEY_RESIZE</CODE> yourself.
 
 <H3><A NAME="screens">Handling Multiple Terminal Screens</A></H3>
 
@@ -979,7 +1015,7 @@ on and refresh them, the changes made to the overlapping region under historic
 
 To understand why this is a problem, remember that screen updates are
 calculated between two representations of the <EM>entire</EM> display. The
-documentation says that when you refresh a window, it is first copied to to the
+documentation says that when you refresh a window, it is first copied to the
 virtual screen, and then changes are calculated to update the physical screen
 (and applied to the terminal).  But "copied to" is not very specific, and
 subtle differences in how copying works can produce different behaviors in the
@@ -2157,7 +2193,7 @@ These requests treat the list as cyclic; that is, <CODE>REQ_NEXT_PAGE</CODE>
 from the last page goes to the first, and <CODE>REQ_PREV_PAGE</CODE> from
 the first page goes to the last.
 
-<H3><A NAME="#ffield">Inter-Field Navigation Requests</A></H3>
+<H3><A NAME="ffield">Inter-Field Navigation Requests</A></H3>
 
 These requests handle navigation between fields on the same page.
 
@@ -2211,7 +2247,7 @@ of B and C to the right of B.  A <CODE>REQ_MOVE_RIGHT</CODE> from A will
 go to B only if A, B, and C <EM>all</EM> share the same first line;
 otherwise it will skip over B to C.
 
-<H3><A NAME="#fifield">Intra-Field Navigation Requests</A></H3>
+<H3><A NAME="fifield">Intra-Field Navigation Requests</A></H3>
 
 These requests drive movement of the edit cursor within the currently
 selected field.