From 448c4dbefe6aa9604a5a8cefa3b3596b3ddb4b78 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sun, 3 Mar 2013 01:02:00 +0000 Subject: [PATCH] ncurses 5.9 - patch 20130302 + add section to terminfo manpage discussing user-defined capabilities. + update manpage description of NCURSES_NO_SETBUF, explaining why it is obsolete. + add a check in waddch_nosync() to ensure that tab characters are treated as control characters; some broken locales claim they are printable. + add some traces to the Windows console driver. + initialize a temporary array in _nc_mbtowc, needed for some cases of raw input in MinGW port. --- NEWS | 13 ++- dist.mk | 4 +- man/ncurses.3x | 35 +++++- man/terminfo.head | 12 +- man/terminfo.tail | 89 ++++++++++++-- ncurses/base/lib_addch.c | 15 ++- ncurses/widechar/widechars.c | 11 +- ncurses/win32con/win_driver.c | 210 ++++++++++++++++++---------------- package/debian/changelog | 4 +- package/ncurses.spec | 2 +- 10 files changed, 261 insertions(+), 134 deletions(-) diff --git a/NEWS b/NEWS index 46946223..8dcf7203 100644 --- a/NEWS +++ b/NEWS @@ -25,7 +25,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.2024 2013/02/18 09:26:30 tom Exp $ +-- $Id: NEWS,v 1.2026 2013/03/02 23:55:06 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -45,6 +45,17 @@ See the AUTHORS file for the corresponding full names. Changes through 1.9.9e did not credit all contributions; it is not possible to add this information. +20130302 + + add section to terminfo manpage discussing user-defined capabilities. + + update manpage description of NCURSES_NO_SETBUF, explaining why it + is obsolete. + + add a check in waddch_nosync() to ensure that tab characters are + treated as control characters; some broken locales claim they are + printable. + + add some traces to the Windows console driver. + + initialize a temporary array in _nc_mbtowc, needed for some cases + of raw input in MinGW port. + 20130218 + correct ifdef on change to lib_twait.c (report by Werner Fink). + update config.guess, config.sub diff --git a/dist.mk b/dist.mk index 7981698f..9b84b359 100644 --- a/dist.mk +++ b/dist.mk @@ -25,7 +25,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: dist.mk,v 1.915 2013/02/18 09:14:22 tom Exp $ +# $Id: dist.mk,v 1.916 2013/03/02 16:04:18 tom Exp $ # Makefile for creating ncurses distributions. # # This only needs to be used directly as a makefile by developers, but @@ -37,7 +37,7 @@ SHELL = /bin/sh # These define the major/minor/patch versions of ncurses. NCURSES_MAJOR = 5 NCURSES_MINOR = 9 -NCURSES_PATCH = 20130218 +NCURSES_PATCH = 20130302 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/man/ncurses.3x b/man/ncurses.3x index 26a2aac3..c5fdc874 100644 --- a/man/ncurses.3x +++ b/man/ncurses.3x @@ -27,7 +27,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: ncurses.3x,v 1.110 2013/02/02 22:13:18 tom Exp $ +.\" $Id: ncurses.3x,v 1.111 2013/03/02 22:15:25 tom Exp $ .hy 0 .TH ncurses 3X "" .de bP @@ -917,13 +917,38 @@ Mandatory padding is used as a part of special control sequences such as \fIflash\fR. .TP 5 NCURSES_NO_SETBUF -Normally \fBncurses\fR enables buffered output during terminal initialization. -This is done (as in SVr4 curses) for performance reasons. +This setting is obsolete. +Before changes +.RS +.bP +started with 5.9 patch 20120825 +and +.bP +continued +though 5.9 patch 20130126 +.RE +.IP +\fBncurses\fR enabled buffered output during terminal initialization. +This was done (as in SVr4 curses) for performance reasons. For testing purposes, both of \fBncurses\fR and certain applications, -this feature is made optional. +this feature was made optional. Setting the NCURSES_NO_SETBUF variable -disables output buffering, leaving the output in the original (usually +disabled output buffering, leaving the output in the original (usually line buffered) mode. +.IP +In the current implementation, +ncurses performs its own buffering and does not require this workaround. +It does not modify the buffering of the standard output. +.IP +The reason for the change was to make the behavior for interrupts and +other signals more robust. +One drawback is that certain nonconventional programs would mix +ordinary stdio calls with ncurses calls and (usually) work. +This is no longer possible since ncurses is not using +the buffered standard output but its own output (to the same file descriptor). +As a special case, the low-level calls such as \fBputp\fP still use the +standard output. +But high-level curses calls do not. .TP 5 NCURSES_NO_UTF8_ACS During initialization, the \fBncurses\fR library diff --git a/man/terminfo.head b/man/terminfo.head index f6399cee..baf37c10 100644 --- a/man/terminfo.head +++ b/man/terminfo.head @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * +.\" 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 * @@ -26,11 +26,15 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: terminfo.head,v 1.19 2012/03/01 09:51:23 tom Exp $ +.\" $Id: terminfo.head,v 1.20 2013/03/02 23:52:37 tom Exp $ .TH terminfo 5 "" "" "File Formats" .ds n 5 .ds d @TERMINFO@ .de bP +.ie \n(.g .ds `` \(lq +.el .ds `` `` +.ie \n(.g .ds '' \(rq +.el .ds '' '' .IP \(bu 4 .. .SH NAME @@ -77,7 +81,7 @@ the result can be read by \fB@TIC@\fP. Terminal names (except for the last, verbose entry) should be chosen using the following conventions. The particular piece of hardware making up the terminal should -have a root name, thus ``hp2621''. +have a root name, thus \*(``hp2621\*(''. This name should not contain hyphens. Modes that the hardware can be in, or user preferences, should be indicated by appending a hyphen and a mode suffix. @@ -105,6 +109,6 @@ l l l. .TE .PP For more on terminal naming conventions, see the \fBterm(7)\fR manual page. -.SS Capabilities +.SS Predefined Capabilities .\" Head of terminfo man page ends here .ps -1 diff --git a/man/terminfo.tail b/man/terminfo.tail index df043806..58d6857a 100644 --- a/man/terminfo.tail +++ b/man/terminfo.tail @@ -1,8 +1,51 @@ -.\" $Id: terminfo.tail,v 1.58 2013/02/02 21:45:47 tom Exp $ +.\" $Id: terminfo.tail,v 1.61 2013/03/03 00:06:39 tom Exp $ .\" Beginning of terminfo.tail file .\" This file is part of ncurses. .\" See "terminfo.head" for copyright. .ps +1 +.SS User-Defined Capabilities +. +The preceding section listed the \fIpredefined\fP capabilities. +They deal with some special features for terminals no longer +(or possibly never) produced. +Occasionally there are special features of newer terminals which +are awkward or impossible to represent by reusing the predefined +capabilities. +.PP +\fBncurses\fP addresses this limitation by allowing user-defined capabilities. +The \fB@TIC@\fP and \fB@INFOCMP@\fP programs provide +the \fB\-x\fP option for this purpose. +When \fB\-x\fP is set, +\fB@TIC@\fP treats unknown capabilities as user-defined. +That is, if \fB@TIC@\fP encounters a capability name +which it does not recognize, +it infers its type (boolean, number or string) from the syntax +and makes an extended table entry for that capability. +The \fBuse_extended_names\fP function makes this information +conditionally available to applications. +The ncurses library provides the data leaving most of the behavior +to applications: +.bP +User-defined capability strings whose name begins +with \*(``k\*('' are treated as function keys. +.bP +The types (boolean, number, string) determined by \fB@TIC@\fP +can be inferred by successful calls on \fBtigetflag\fP, etc. +.bP +If the capability name happens to be two characters, +the capability is also available through the termcap interface. +.PP +While termcap is said to be extensible because it does not use a predefined set +of capabilities, +in practice it has been limited to the capabilities defined by +terminfo implementations. +As a rule, +user-defined capabilities intended for use by termcap applications should +be limited to booleans and numbers to avoid running past the 1023 byte +limit assumed by termcap implementations and their applications. +In particular, providing extended sets of function keys (past the 60 +numbered keys and the handful of special named keys) is best done using +the longer names available using terminfo. . .SS A Sample Entry . @@ -39,13 +82,18 @@ of what a \fBterminfo\fR entry for a modern terminal typically looks like. .PP Entries may continue onto multiple lines by placing white space at the beginning of each line except the first. -Comments may be included on lines beginning with ``#''. +Comments may be included on lines beginning with \*(``#\*(''. Capabilities in .I terminfo are of three types: +.bP Boolean capabilities which indicate that the terminal has -some particular feature, numeric capabilities giving the size of the terminal -or the size of particular delays, and string +some particular feature, +.bP +numeric capabilities giving the size of the terminal +or the size of particular delays, and +.bP +string capabilities, which give a sequence which can be used to perform particular terminal operations. .PP @@ -850,9 +898,9 @@ which have no sgr string. The only drawback to adding an sgr string is that termcap also assumes that sgr0 does not exit alternate character set mode. .PP -Terminals with the ``magic cookie'' glitch +Terminals with the \*(``magic cookie\*('' glitch .RB ( xmc ) -deposit special ``cookies'' when they receive mode-setting sequences, +deposit special \*(``cookies\*('' when they receive mode-setting sequences, which affect the display algorithm rather than having extra bits for each character. Some terminals, such as the HP 2621, automatically leave standout @@ -897,6 +945,7 @@ to the unshifted HP 2621 keys). If the keypad can be set to transmit or not transmit, give these codes as \fBsmkx\fR and \fBrmkx\fR. Otherwise the keypad is assumed to always transmit. +.PP The codes sent by the left arrow, right arrow, up arrow, down arrow, and home keys can be given as \fBkcub1, kcuf1, kcuu1, kcud1, \fRand\fB khome\fR respectively. @@ -904,41 +953,60 @@ If there are function keys such as f0, f1, ..., f10, the codes they send can be given as \fBkf0, kf1, ..., kf10\fR. If these keys have labels other than the default f0 through f10, the labels can be given as \fBlf0, lf1, ..., lf10\fR. +.PP The codes transmitted by certain other special keys can be given: +.bP .B kll (home down), +.bP .B kbs (backspace), +.bP .B ktbc (clear all tabs), +.bP .B kctab (clear the tab stop in this column), +.bP .B kclr (clear screen or erase key), +.bP .B kdch1 (delete character), +.bP .B kdl1 (delete line), +.bP .B krmir (exit insert mode), +.bP .B kel (clear to end of line), +.bP .B ked (clear to end of screen), +.bP .B kich1 (insert character or enter insert mode), +.bP .B kil1 (insert line), +.bP .B knp (next page), +.bP .B kpp (previous page), +.bP .B kind (scroll forward/down), +.bP .B kri (scroll backward/up), +.bP .B khts (set a tab stop in this column). +.PP In addition, if the keypad has a 3 by 3 array of keys including the four arrow keys, the other five keys can be given as .BR ka1 , @@ -982,7 +1050,7 @@ If the terminal has hardware tabs, the command to advance to the next tab stop can be given as .B ht (usually control I). -A ``back-tab'' command which moves leftward to the preceding tab stop can +A \*(``back-tab\*('' command which moves leftward to the preceding tab stop can be given as .BR cbt . By convention, if the teletype modes indicate that tabs are being @@ -1329,6 +1397,7 @@ magenta \fBCOLOR_MAGENTA\fR 5 max,0,max yellow \fBCOLOR_YELLOW\fR 6 max,max,0 white \fBCOLOR_WHITE\fR 7 max,max,max .TE +.PP It is important to not confuse the two sets of color capabilities; otherwise red/blue will be interchanged on the display. .PP @@ -1446,13 +1515,13 @@ how to talk to the terminal. .I virtual terminal descriptions for which the escape sequences are known.) .PP -If the terminal has a ``meta key'' which acts as a shift key, +If the terminal has a \*(``meta key\*('' which acts as a shift key, setting the 8th bit of any character transmitted, this fact can be indicated with .BR km . Otherwise, software will assume that the 8th bit is parity and it will usually be cleared. -If strings exist to turn this ``meta mode'' on and off, they +If strings exist to turn this \*(``meta mode\*('' on and off, they can be given as .B smm and @@ -1514,7 +1583,7 @@ should indicate \fBxt\fR (destructive tabs). Note: the variable indicating this is now `dest_tabs_magic_smso'; in older versions, it was teleray_glitch. This glitch is also taken to mean that it is not possible to position -the cursor on top of a ``magic cookie'', +the cursor on top of a \*(``magic cookie\*('', that to erase standout mode it is instead necessary to use delete and insert line. The ncurses implementation ignores this glitch. diff --git a/ncurses/base/lib_addch.c b/ncurses/base/lib_addch.c index dd6f800e..622cf11c 100644 --- a/ncurses/base/lib_addch.c +++ b/ncurses/base/lib_addch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * + * Copyright (c) 1998-2011,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 * @@ -36,7 +36,7 @@ #include #include -MODULE_ID("$Id: lib_addch.c,v 1.125 2011/10/22 16:51:31 tom Exp $") +MODULE_ID("$Id: lib_addch.c,v 1.126 2013/03/02 21:06:47 tom Exp $") static const NCURSES_CH_T blankchar = NewChar(BLANK_TEXT); @@ -412,10 +412,12 @@ waddch_nosync(WINDOW *win, const NCURSES_CH_T ch) #endif const char *s = NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx t); int tabsize = 8; + /* * If we are using the alternate character set, forget about locale. * Otherwise, if unctrl() returns a single-character or the locale - * claims the code is printable, treat it that way. + * claims the code is printable (and not also a control character), + * treat it that way. */ if ((AttrOf(ch) & A_ALTCHARSET) || ( @@ -425,14 +427,15 @@ waddch_nosync(WINDOW *win, const NCURSES_CH_T ch) s[1] == 0 ) || ( - isprint(t) + (isprint(t) && !iscntrl(t)) #if USE_WIDEC_SUPPORT || ((sp == 0 || !sp->_legacy_coding) && (WINDOW_EXT(win, addch_used) - || !_nc_is_charable(CharOf(ch)))) + || !_nc_is_charable(t))) #endif - )) + )) { return waddch_literal(win, ch); + } /* * Handle carriage control and other codes that are not printable, or are diff --git a/ncurses/widechar/widechars.c b/ncurses/widechar/widechars.c index c86b8a06..6951e286 100644 --- a/ncurses/widechar/widechars.c +++ b/ncurses/widechar/widechars.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2012 Free Software Foundation, Inc. * + * Copyright (c) 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 * @@ -30,7 +30,7 @@ #if USE_WIDEC_SUPPORT -MODULE_ID("$Id: widechars.c,v 1.4 2012/12/02 01:50:59 tom Exp $") +MODULE_ID("$Id: widechars.c,v 1.5 2013/03/02 18:55:51 tom Exp $") #if defined(__MINGW32__) /* @@ -46,9 +46,9 @@ _nc_mbtowc(wchar_t *pwc, const char *s, size_t n) if (s != 0 && n != 0) { /* - * MultiByteToWideChar() can decide to return more than one wide-character. - * We want only one. Ignore any trailing null, both in the initial count - * and in the conversion. + * MultiByteToWideChar() can decide to return more than one + * wide-character. We want only one. Ignore any trailing null, both + * in the initial count and in the conversion. */ count = 0; for (try = 1; try <= (int) n; ++try) { @@ -67,6 +67,7 @@ _nc_mbtowc(wchar_t *pwc, const char *s, size_t n) result = -1; } else { wchar_t actual[2]; + memset(&actual, 0, sizeof(actual)); count = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, s, diff --git a/ncurses/win32con/win_driver.c b/ncurses/win32con/win_driver.c index a135ffa0..51e4d0f5 100644 --- a/ncurses/win32con/win_driver.c +++ b/ncurses/win32con/win_driver.c @@ -38,14 +38,16 @@ #include #define CUR my_term.type. -MODULE_ID("$Id: win_driver.c,v 1.17 2013/01/27 00:47:42 tom Exp $") +MODULE_ID("$Id: win_driver.c,v 1.18 2013/03/02 19:48:06 tom Exp $") #define WINMAGIC NCDRV_MAGIC(NCDRV_WINCONSOLE) #define EXP_OPTIMIZE 0 -#define AssertTCB() assert(TCB!=0 && TCB->magic==WINMAGIC) -#define SetSP() assert(TCB->csp!=0); sp = TCB->csp; (void) sp +#define okConsoleHandle(TCB) (TCB != 0 && !InvalidConsoleHandle(TCB->hdl)) + +#define AssertTCB() assert(TCB != 0 && (TCB->magic == WINMAGIC)) +#define SetSP() assert(TCB->csp != 0); sp = TCB->csp; (void) sp #define GenMap(vKey,key) MAKELONG(key, vKey) @@ -158,9 +160,6 @@ con_write16(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, cchar_t *str, int limit) AssertTCB(); - if (TCB == 0 || InvalidConsoleHandle(TCB->hdl)) - return FALSE; - SetSP(); for (i = actual = 0; i < limit; i++) { @@ -212,9 +211,6 @@ con_write8(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, chtype *str, int n) AssertTCB(); - if (TCB == 0 || InvalidConsoleHandle(TCB->hdl)) - return FALSE; - SetSP(); for (i = 0; i < n; i++) { @@ -336,84 +332,69 @@ selectActiveHandle(TERMINAL_CONTROL_BLOCK * TCB) static int drv_doupdate(TERMINAL_CONTROL_BLOCK * TCB) { + int result = ERR; int y, nonempty, n, x0, x1, Width, Height; SCREEN *sp; AssertTCB(); SetSP(); - Width = screen_columns(sp); - Height = screen_lines(sp); - nonempty = min(Height, NewScreen(sp)->_maxy + 1); + T((T_CALLED("win32con::drv_doupdate(%p)"), TCB)); + if (okConsoleHandle(TCB)) { - if ((CurScreen(sp)->_clear || NewScreen(sp)->_clear)) { - int x; + Width = screen_columns(sp); + Height = screen_lines(sp); + nonempty = min(Height, NewScreen(sp)->_maxy + 1); + + if ((CurScreen(sp)->_clear || NewScreen(sp)->_clear)) { + int x; #if USE_WIDEC_SUPPORT - cchar_t empty[Width]; - wchar_t blank[2] = - { - L' ', L'\0' - }; - - for (x = 0; x < Width; x++) - setcchar(&empty[x], blank, 0, 0, 0); + cchar_t empty[Width]; + wchar_t blank[2] = + { + L' ', L'\0' + }; + + for (x = 0; x < Width; x++) + setcchar(&empty[x], blank, 0, 0, 0); #else - chtype empty[Width]; + chtype empty[Width]; - for (x = 0; x < Width; x++) - empty[x] = ' '; + for (x = 0; x < Width; x++) + empty[x] = ' '; #endif - for (y = 0; y < nonempty; y++) { - con_write(TCB, y, 0, empty, Width); - memcpy(empty, - CurScreen(sp)->_line[y].text, - Width * sizeof(empty[0])); + for (y = 0; y < nonempty; y++) { + con_write(TCB, y, 0, empty, Width); + memcpy(empty, + CurScreen(sp)->_line[y].text, + Width * sizeof(empty[0])); + } + CurScreen(sp)->_clear = FALSE; + NewScreen(sp)->_clear = FALSE; + touchwin(NewScreen(sp)); } - CurScreen(sp)->_clear = FALSE; - NewScreen(sp)->_clear = FALSE; - touchwin(NewScreen(sp)); - } - for (y = 0; y < nonempty; y++) { - x0 = NewScreen(sp)->_line[y].firstchar; - if (x0 != _NOCHANGE) { + for (y = 0; y < nonempty; y++) { + x0 = NewScreen(sp)->_line[y].firstchar; + if (x0 != _NOCHANGE) { #if EXP_OPTIMIZE - int x2; - int limit = NewScreen(sp)->_line[y].lastchar; - while ((x1 = EndChange(x0)) <= limit) { - while ((x2 = NextChange(x1)) <= limit && x2 <= (x1 + 2)) { - x1 = x2; + int x2; + int limit = NewScreen(sp)->_line[y].lastchar; + while ((x1 = EndChange(x0)) <= limit) { + while ((x2 = NextChange(x1)) <= limit && x2 <= (x1 + 2)) { + x1 = x2; + } + n = x1 - x0 + 1; + memcpy(&CurScreen(sp)->_line[y].text[x0], + &NewScreen(sp)->_line[y].text[x0], + n * sizeof(CurScreen(sp)->_line[y].text[x0])); + con_write(TCB, + y, + x0, + &CurScreen(sp)->_line[y].text[x0], n); + x0 = NextChange(x1); } - n = x1 - x0 + 1; - memcpy(&CurScreen(sp)->_line[y].text[x0], - &NewScreen(sp)->_line[y].text[x0], - n * sizeof(CurScreen(sp)->_line[y].text[x0])); - con_write(TCB, - y, - x0, - &CurScreen(sp)->_line[y].text[x0], n); - x0 = NextChange(x1); - } - - /* mark line changed successfully */ - if (y <= NewScreen(sp)->_maxy) { - MARK_NOCHANGE(NewScreen(sp), y); - } - if (y <= CurScreen(sp)->_maxy) { - MARK_NOCHANGE(CurScreen(sp), y); - } -#else - x1 = NewScreen(sp)->_line[y].lastchar; - n = x1 - x0 + 1; - if (n > 0) { - memcpy(&CurScreen(sp)->_line[y].text[x0], - &NewScreen(sp)->_line[y].text[x0], - n * sizeof(CurScreen(sp)->_line[y].text[x0])); - con_write(TCB, - y, - x0, - &CurScreen(sp)->_line[y].text[x0], n); /* mark line changed successfully */ if (y <= NewScreen(sp)->_maxy) { @@ -422,27 +403,50 @@ drv_doupdate(TERMINAL_CONTROL_BLOCK * TCB) if (y <= CurScreen(sp)->_maxy) { MARK_NOCHANGE(CurScreen(sp), y); } - } +#else + x1 = NewScreen(sp)->_line[y].lastchar; + n = x1 - x0 + 1; + if (n > 0) { + memcpy(&CurScreen(sp)->_line[y].text[x0], + &NewScreen(sp)->_line[y].text[x0], + n * sizeof(CurScreen(sp)->_line[y].text[x0])); + con_write(TCB, + y, + x0, + &CurScreen(sp)->_line[y].text[x0], n); + + /* mark line changed successfully */ + if (y <= NewScreen(sp)->_maxy) { + MARK_NOCHANGE(NewScreen(sp), y); + } + if (y <= CurScreen(sp)->_maxy) { + MARK_NOCHANGE(CurScreen(sp), y); + } + } #endif + } } - } - /* put everything back in sync */ - for (y = nonempty; y <= NewScreen(sp)->_maxy; y++) { - MARK_NOCHANGE(NewScreen(sp), y); - } - for (y = nonempty; y <= CurScreen(sp)->_maxy; y++) { - MARK_NOCHANGE(CurScreen(sp), y); - } + /* put everything back in sync */ + for (y = nonempty; y <= NewScreen(sp)->_maxy; y++) { + MARK_NOCHANGE(NewScreen(sp), y); + } + for (y = nonempty; y <= CurScreen(sp)->_maxy; y++) { + MARK_NOCHANGE(CurScreen(sp), y); + } - if (!NewScreen(sp)->_leaveok) { - CurScreen(sp)->_curx = NewScreen(sp)->_curx; - CurScreen(sp)->_cury = NewScreen(sp)->_cury; + if (!NewScreen(sp)->_leaveok) { + CurScreen(sp)->_curx = NewScreen(sp)->_curx; + CurScreen(sp)->_cury = NewScreen(sp)->_cury; - TCB->drv->hwcur(TCB, 0, 0, CurScreen(sp)->_cury, CurScreen(sp)->_curx); + TCB->drv->hwcur(TCB, + 0, 0, + CurScreen(sp)->_cury, CurScreen(sp)->_curx); + } + selectActiveHandle(TCB); + result = OK; } - selectActiveHandle(TCB); - return OK; + returnCode(result); } static bool @@ -543,7 +547,7 @@ drv_setcolor(TERMINAL_CONTROL_BLOCK * TCB, { AssertTCB(); - if (TCB && !InvalidConsoleHandle(TCB->hdl)) { + if (okConsoleHandle(TCB)) { WORD a = MapColor(fore, color); a = ((PropOf(TCB)->SBI.wAttributes) & (fore ? 0xfff8 : 0xff8f)) | a; SetConsoleTextAttribute(TCB->hdl, a); @@ -557,7 +561,7 @@ drv_rescol(TERMINAL_CONTROL_BLOCK * TCB) bool res = FALSE; AssertTCB(); - if (TCB && !InvalidConsoleHandle(TCB->hdl)) { + if (okConsoleHandle(TCB)) { WORD a = FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN; SetConsoleTextAttribute(TCB->hdl, a); GetConsoleScreenBufferInfo(TCB->hdl, &(PropOf(TCB)->SBI)); @@ -581,14 +585,20 @@ drv_rescolors(TERMINAL_CONTROL_BLOCK * TCB) static int drv_size(TERMINAL_CONTROL_BLOCK * TCB, int *Lines, int *Cols) { + int result = ERR; + AssertTCB(); - if (TCB == NULL || Lines == NULL || Cols == NULL || InvalidConsoleHandle(TCB->hdl)) - return ERR; + T((T_CALLED("win32con::drv_size(%p)"), TCB)); - *Lines = (int) (PropOf(TCB)->SBI.dwSize.Y); - *Cols = (int) (PropOf(TCB)->SBI.dwSize.X); - return OK; + if (okConsoleHandle(TCB) && + Lines != NULL && + Cols != NULL) { + *Lines = (int) (PropOf(TCB)->SBI.dwSize.Y); + *Cols = (int) (PropOf(TCB)->SBI.dwSize.X); + result = OK; + } + returnCode(result); } static int @@ -945,7 +955,7 @@ drv_mvcur(TERMINAL_CONTROL_BLOCK * TCB, int y, int x) { int ret = ERR; - if (TCB && !InvalidConsoleHandle(TCB->hdl)) { + if (okConsoleHandle(TCB)) { COORD loc; loc.X = (short) x; loc.Y = (short) y; @@ -1311,8 +1321,9 @@ drv_read(TERMINAL_CONTROL_BLOCK * TCB, int *buf) static int drv_nap(TERMINAL_CONTROL_BLOCK * TCB GCC_UNUSED, int ms) { + T((T_CALLED("win32con::drv_nap(%p, %d)"), TCB, ms)); Sleep(ms); - return OK; + returnCode(OK); } static bool @@ -1329,6 +1340,7 @@ drv_kyExist(TERMINAL_CONTROL_BLOCK * TCB, int keycode) AssertTCB(); + T((T_CALLED("win32con::drv_kyExist(%p, %d)"), TCB, keycode)); res = bsearch(&key, PropOf(TCB)->rmap, (size_t) (N_INI + FKEYS), @@ -1340,7 +1352,7 @@ drv_kyExist(TERMINAL_CONTROL_BLOCK * TCB, int keycode) if (!(nKey & 0x8000)) found = TRUE; } - return found; + returnCode(found); } static int @@ -1352,10 +1364,11 @@ drv_kpad(TERMINAL_CONTROL_BLOCK * TCB, int flag GCC_UNUSED) AssertTCB(); sp = TCB->csp; + T((T_CALLED("win32con::drv_kpad(%p, %d)"), TCB, flag)); if (sp) { code = OK; } - return code; + returnCode(code); } static int @@ -1371,6 +1384,7 @@ drv_keyok(TERMINAL_CONTROL_BLOCK * TCB, int keycode, int flag) AssertTCB(); SetSP(); + T((T_CALLED("win32con::drv_keyok(%p, %d, %d)"), TCB, keycode, flag)); if (sp) { res = bsearch(&key, PropOf(TCB)->rmap, @@ -1386,7 +1400,7 @@ drv_keyok(TERMINAL_CONTROL_BLOCK * TCB, int keycode, int flag) *(LONG *) res = GenMap(vKey, nKey); } } - return code; + returnCode(code); } NCURSES_EXPORT_VAR (TERM_DRIVER) _nc_WIN_DRIVER = { diff --git a/package/debian/changelog b/package/debian/changelog index 6fc5e0be..670f403b 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6 (5.9-20130218) unstable; urgency=low +ncurses6 (5.9-20130302) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Mon, 18 Feb 2013 04:25:15 -0500 + -- Thomas E. Dickey Sat, 02 Mar 2013 11:05:00 -0500 ncurses6 (5.9-20120608) unstable; urgency=low diff --git a/package/ncurses.spec b/package/ncurses.spec index a4e3060c..e1278d29 100644 --- a/package/ncurses.spec +++ b/package/ncurses.spec @@ -1,7 +1,7 @@ Summary: shared libraries for terminal handling Name: ncurses6 Release: 5.9 -Version: 20130218 +Version: 20130302 License: X11 Group: Development/Libraries Source: ncurses-%{release}-%{version}.tgz -- 2.44.0