From 8144a95f5729b46a1ad4f4c3c4ba29800304e4c0 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sun, 6 Jan 2008 02:04:59 +0000 Subject: [PATCH 1/1] ncurses 5.6 - patch 20080105 + several improvements to terminfo entries based on xterm #230 -TD + modify MKlib_gen.sh to handle keyname/key_name prototypes, so the "link_test" builds properly. + fix for toe command-line options -u/-U to ensure filename is given. + fix allocation-size for command-line parsing in infocmp from 20070728 (report by Miroslav Lichvar) + improve resizeterm() by moving ripped-off lines, and repainting the soft-keys (report by Katarina Machalkova) + add clarification in wclear's manpage noting that the screen will be cleared even if a subwindow is cleared (prompted by Christer Enfors question). + change test/ncurses.c soft-key tests to work with KEY_RESIZE. --- NEWS | 18 +++++- dist.mk | 4 +- man/curs_clear.3x | 10 +++- man/toe.1m | 42 +++++++++----- misc/terminfo.src | 106 ++++++++++++++++++++++++++--------- ncurses/base/MKlib_gen.sh | 5 +- ncurses/base/lib_set_term.c | 12 ++-- ncurses/base/lib_slkclear.c | 33 ++++++----- ncurses/base/resizeterm.c | 108 +++++++++++++++++++++++++++++++++--- ncurses/curses.priv.h | 6 +- ncurses/tinfo/lib_data.c | 4 +- progs/infocmp.c | 6 +- progs/toe.c | 17 +++--- test/ncurses.c | 55 +++++++++++------- 14 files changed, 316 insertions(+), 110 deletions(-) diff --git a/NEWS b/NEWS index 59659091..4778fc2f 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,5 @@ ------------------------------------------------------------------------------- --- Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. -- +-- Copyright (c) 1998-2007,2008 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 -- @@ -25,7 +25,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.1188 2007/12/22 23:56:08 tom Exp $ +-- $Id: NEWS,v 1.1195 2008/01/06 00:01:08 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -45,6 +45,20 @@ 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. +20080105 + + several improvements to terminfo entries based on xterm #230 -TD + + modify MKlib_gen.sh to handle keyname/key_name prototypes, so the + "link_test" builds properly. + + fix for toe command-line options -u/-U to ensure filename is given. + + fix allocation-size for command-line parsing in infocmp from 20070728 + (report by Miroslav Lichvar) + + improve resizeterm() by moving ripped-off lines, and repainting the + soft-keys (report by Katarina Machalkova) + + add clarification in wclear's manpage noting that the screen will be + cleared even if a subwindow is cleared (prompted by Christer Enfors + question). + + change test/ncurses.c soft-key tests to work with KEY_RESIZE. + 20071222 + continue implementing support for threading demo by adding mutex for delwin(). diff --git a/dist.mk b/dist.mk index a29dd36e..58497df5 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.620 2007/12/22 20:41:31 tom Exp $ +# $Id: dist.mk,v 1.622 2008/01/05 19:49:50 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 = 6 -NCURSES_PATCH = 20071222 +NCURSES_PATCH = 20080105 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/man/curs_clear.3x b/man/curs_clear.3x index fa7723af..adbfd2cc 100644 --- a/man/curs_clear.3x +++ b/man/curs_clear.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998,2005 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2005,2007 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,7 +26,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_clear.3x,v 1.10 2005/10/01 19:34:43 tom Exp $ +.\" $Id: curs_clear.3x,v 1.11 2007/12/29 15:58:38 tom Exp $ .TH curs_clear 3X "" .na .hy 0 @@ -105,6 +105,12 @@ via \fBwerase()\fP and \fBwclear()\fP. That fact is not documented in other implementations, and may not be true of implementations which were not derived from SVr4 source. +.PP +Not obvious from the description, +most implementations clear the screen after \fBwclear\fP +even for a subwindow or derived window. +If you do not want to clear the screen during the next \fBwrefresh\fP, +use \fBwerase\fP instead. .SH SEE ALSO \fBcurses\fR(3X), \fBcurs_outopts\fR(3X), \fBcurs_refresh\fR(3X) .\"# diff --git a/man/toe.1m b/man/toe.1m index 36cc3d03..15303541 100644 --- a/man/toe.1m +++ b/man/toe.1m @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2004,2006 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2006,2008 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,7 +26,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: toe.1m,v 1.20 2006/12/24 17:20:37 tom Exp $ +.\" $Id: toe.1m,v 1.21 2008/01/05 20:57:16 tom Exp $ .TH @TOE@ 1M "" .ds n 5 .ds d @TERMINFO@ @@ -37,10 +37,14 @@ .br .SH DESCRIPTION .PP -With no options, \fBtoe\fR lists all available terminal types by primary name -with descriptions. File arguments specify the directories to be scanned; if no -such arguments are given, your default terminfo directory is scanned. If you -also specify the \fB-h\fR option, a directory header will be issued as each +With no options, +\fBtoe\fR lists all available terminal types by primary name +with descriptions. +File arguments specify the directories to be scanned; if no +such arguments are given, +your default terminfo directory is scanned. +If you also specify the \fB-h\fR option, +a directory header will be issued as each directory is entered. .PP There are other options intended for use by terminfo file maintainers: @@ -50,16 +54,25 @@ report on all of the terminal databases which ncurses would search, rather than only the first one that it finds. .TP \fB-u\fR \fIfile\fR -says to issue a report on dependencies in the given file. This report condenses -the `use' relation: each line consists of the primary name of a terminal that -has use capabilities, followed by a colon, followed by the +says to write a report to the standard output, +listing dependencies in the given terminfo/termcap source file. +The report condenses the `use' relation: +each line consists of the primary name of a terminal that +has use capabilities, +followed by a colon, +followed by the whitespace-separated primary names of all terminals which occur in those use -capabilities, followed by a newline +capabilities, +followed by a newline .TP \fB-U\fR \fIfile\fR -says to issue a report on reverse dependencies in the given file. This report -reverses the `use' relation: each line consists of the primary name of a -terminal that occurs in use capabilities, followed by a colon, followed by the +says to write a report to the standard output, +listing reverse dependencies in the given terminfo/termcap source file. +The report reverses the `use' relation: +each line consists of the primary name of a +terminal that occurs in use capabilities, +followed by a colon, +followed by the whitespace-separated primary names of all terminals which depend on it, followed by a newline. .TP @@ -70,7 +83,8 @@ The optional parameter \fIn\fR is a number from 1 to 10, interpreted as for \fB@TIC@\fR(1M). .TP \fB-V\fR -reports the version of ncurses which was used in this program, and exits. +reports the version of ncurses which was used in this program, +and exits. .SH FILES .TP 5 \fB\*d/?/*\fR diff --git a/misc/terminfo.src b/misc/terminfo.src index 5fa43730..8d905fc4 100644 --- a/misc/terminfo.src +++ b/misc/terminfo.src @@ -6,8 +6,8 @@ # Report bugs and new terminal descriptions to # bug-ncurses@gnu.org # -# $Revision: 1.318 $ -# $Date: 2007/11/03 19:02:01 $ +# $Revision: 1.326 $ +# $Date: 2007/11/12 00:22:07 $ # # The original header is preserved below for reference. It is noted that there # is a "newer" version which differs in some cosmetic details (but actually @@ -3017,10 +3017,8 @@ xterm-xf86-v44|xterm terminal emulator (XFree86 4.4 Window System), cnorm=\E[?12l\E[?25h, cvvis=\E[?12;25h, indn=\E[%p1%dS, rin=\E[%p1%dT, use=xterm-xf86-v43, -# This is the most common alias for xterm-new. xterm-xfree86|xterm terminal emulator (XFree86), - use=xterm-new, -# use=xterm-old, + use=xterm-xf86-v44, # This version reflects the current xterm features. xterm-new|modern xterm terminal emulator, @@ -3048,7 +3046,16 @@ xterm-new|modern xterm terminal emulator, # The meta key may also be used as a modifier in this scheme, adding another # bit to the parameter. xterm+pcfkeys|fragment for PC-style fkeys, - use=xterm+pcf2, use=xterm+pcc2, + use=xterm+app, use=xterm+pcf2, use=xterm+pcc2, + use=xterm+pce2, +# +xterm+noapp|fragment with cursor keys in normal mode, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kend=\E[F, + khome=\E[H, + +xterm+app|fragment with cursor keys in application mode, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kend=\EOF, + khome=\EOH, # # The "PC-style" modifier scheme was introduced in xterm patch #94 (1999/3/27) # and revised in patch #167 (2002/8/24). Some other terminal emulators copied @@ -3071,28 +3078,39 @@ xterm+pcfkeys|fragment for PC-style fkeys, # that might apply to xterm+pcfkeys with different values of that resource. xterm+pcc3|fragment with modifyCursorKeys:3, kLFT=\E[>1;2D, kRIT=\E[>1;2C, kind=\E[>1;2B, - kri=\E[>1;2A, kDN=\E[>1;2B, kDN5=\E[>1;5B, kDN6=\E[>1;6B, - kLFT5=\E[>1;5D, kLFT6=\E[>1;6D, kRIT5=\E[>1;5C, - kRIT6=\E[>1;6C, kUP=\E[>1;2A, kUP5=\E[>1;5A, - kUP6=\E[>1;6A, + kri=\E[>1;2A, kDN=\E[>1;2B, kDN3=\E[>1;3B, kDN4=\E[>1;4B, + kDN5=\E[>1;5B, kDN6=\E[>1;6B, kDN7=\E[>1;7B, + kLFT3=\E[>1;3D, kLFT4=\E[>1;4D, kLFT5=\E[>1;5D, + kLFT6=\E[>1;6D, kLFT7=\E[>1;7D, kRIT3=\E[>1;3C, + kRIT4=\E[>1;4C, kRIT5=\E[>1;5C, kRIT6=\E[>1;6C, + kRIT7=\E[>1;7C, kUP=\E[>1;2A, kUP3=\E[>1;3A, + kUP4=\E[>1;4A, kUP5=\E[>1;5A, kUP6=\E[>1;6A, + kUP7=\E[>1;7A, xterm+pcc2|fragment with modifyCursorKeys:2, kLFT=\E[1;2D, kRIT=\E[1;2C, kind=\E[1;2B, kri=\E[1;2A, - kDN=\E[1;2B, kDN5=\E[1;5B, kDN6=\E[1;6B, kLFT5=\E[1;5D, - kLFT6=\E[1;6D, kRIT5=\E[1;5C, kRIT6=\E[1;6C, kUP=\E[1;2A, - kUP5=\E[1;5A, kUP6=\E[1;6A, + kDN=\E[1;2B, kDN3=\E[1;3B, kDN4=\E[1;4B, kDN5=\E[1;5B, + kDN6=\E[1;6B, kDN7=\E[1;7B, kLFT3=\E[1;3D, kLFT4=\E[1;4D, + kLFT5=\E[1;5D, kLFT6=\E[1;6D, kLFT7=\E[1;7D, + kRIT3=\E[1;3C, kRIT4=\E[1;4C, kRIT5=\E[1;5C, + kRIT6=\E[1;6C, kRIT7=\E[1;7C, kUP=\E[1;2A, kUP3=\E[1;3A, + kUP4=\E[1;4A, kUP5=\E[1;5A, kUP6=\E[1;6A, kUP7=\E[1;7A, xterm+pcc1|fragment with modifyCursorKeys:1, kLFT=\E[2D, kRIT=\E[2C, kind=\E[2B, kri=\E[2A, kDN=\E[2B, - kDN5=\E[5B, kDN6=\E[6B, kLFT5=\E[5D, kLFT6=\E[6D, - kRIT5=\E[5C, kRIT6=\E[6C, kUP=\E[2A, kUP5=\E[5A, - kUP6=\E[6A, + kDN3=\E[3B, kDN4=\E[4B, kDN5=\E[5B, kDN6=\E[6B, kDN7=\E[7B, + kLFT3=\E[3D, kLFT4=\E[4D, kLFT5=\E[5D, kLFT6=\E[6D, + kLFT7=\E[7D, kRIT3=\E[3C, kRIT4=\E[4C, kRIT5=\E[5C, + kRIT6=\E[6C, kRIT7=\E[7C, kUP=\E[2A, kUP3=\E[3A, + kUP4=\E[4A, kUP5=\E[5A, kUP6=\E[6A, kUP7=\E[7A, xterm+pcc0|fragment with modifyCursorKeys:0, kLFT=\EO2D, kRIT=\EO2C, kind=\EO2B, kri=\EO2A, kDN=\EO2B, - kDN5=\EO5B, kDN6=\EO6B, kLFT5=\EO5D, kLFT6=\EO6D, - kRIT5=\EO5C, kRIT6=\EO6C, kUP=\EO2A, kUP5=\EO5A, - kUP6=\EO6A, + kDN3=\EO3B, kDN4=\EO4B, kDN5=\EO5B, kDN6=\EO6B, kDN7=\EO7B, + kLFT3=\EO3D, kLFT4=\EO4D, kLFT5=\EO5D, kLFT6=\EO6D, + kLFT7=\EO7D, kRIT3=\EO3C, kRIT4=\EO4C, kRIT5=\EO5C, + kRIT6=\EO6C, kRIT7=\EO7C, kUP=\EO2A, kUP3=\EO3A, + kUP4=\EO4A, kUP5=\EO5A, kUP6=\EO6A, kUP7=\EO7A, # # Here are corresponding fragments from xterm patch #216: @@ -3136,6 +3154,32 @@ xterm+pcf2|fragment with modifyFunctionKeys:2, kf61=\E[1;4P, kf62=\E[1;4Q, kf63=\E[1;4R, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, # +# Chunks from xterm #230: +xterm+pce2|fragment with modifyCursorKeys:2, + kDC=\E[3;2~, kEND=\E[1;2F, kHOM=\E[1;2H, kIC=\E[2;2~, + kNXT=\E[6;2~, kPRV=\E[5;2~, kich1=\E[2~, knp=\E[6~, + kpp=\E[5~, kDC3=\E[3;3~, kDC4=\E[3;4~, kDC5=\E[3;5~, + kDC6=\E[3;6~, kDC7=\E[3;7~, kEND3=\E[1;3F, kEND4=\E[1;4F, + kEND5=\E[1;5F, kEND6=\E[1;6F, kEND7=\E[1;7F, + kHOM3=\E[1;3H, kHOM4=\E[1;4H, kHOM5=\E[1;5H, + kHOM6=\E[1;6H, kHOM7=\E[1;7H, kIC3=\E[2;3~, kIC4=\E[2;4~, + kIC5=\E[2;5~, kIC6=\E[2;6~, kIC7=\E[2;7~, kNXT3=\E[6;3~, + kNXT4=\E[6;4~, kNXT5=\E[6;5~, kNXT6=\E[6;6~, + kNXT7=\E[6;7~, kPRV3=\E[5;3~, kPRV4=\E[5;4~, + kPRV5=\E[5;5~, kPRV6=\E[5;6~, kPRV7=\E[5;7~, + use=xterm+edit, + +xterm+edit|fragment for 6-key editing-keypad, + kdch1=\E[3~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, + use=xterm+pc+edit, + +xterm+pc+edit|fragment for pc-style editing keypad, + kend=\E[4~, khome=\E[1~, + +xterm+vt+edit|fragment for vt220-style editing keypad, + kfnd=\E[1~, kslt=\E[4~, + +# # Those chunks use the new-style (the xterm oldFunctionKeys resource is false). # Alternatively, the same scheme with old-style function keys as in xterm-r6 # is shown here (because that is used in mrxvt and mlterm): @@ -3163,8 +3207,8 @@ xterm-basic|modern xterm terminal emulator - common, flash=\E[?5h$<100/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=^J, invis=\E[8m, is2=\E[!p\E[?3;4l\E[4l\E>, kbs=^H, - kdch1=\E[3~, kmous=\E[M, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, - meml=\El, memu=\Em, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, + kmous=\E[M, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, meml=\El, + memu=\Em, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, rmacs=\E(B, rmam=\E[?7l, rmcup=\E[?1049l, rmir=\E[4l, rmkx=\E[?1l\E>, rmm=\E[?1034l, rmso=\E[27m, rmul=\E[24m, rs1=\Ec, rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7, @@ -3310,7 +3354,8 @@ xterm-vt220|xterm emulating vt220, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf20=\E[34~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, - use=xterm-basic, use=vt220+keypad, + use=xterm+app, use=xterm+edit, use=xterm-basic, + use=vt220+keypad, xterm-vt52|xterm emulating dec vt52, cols#80, it#8, lines#24, @@ -3321,11 +3366,11 @@ xterm-vt52|xterm emulating dec vt52, kcuf1=\EC, kcuu1=\EA, nel=^M^J, ri=\EI, rmacs=\EG, smacs=\EF, xterm-noapp|xterm with cursor keys in normal mode, - kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, rmcup@, - rmkx=\E>, smcup@, smkx=\E=, use=xterm, + rmcup@, rmkx=\E>, smcup@, smkx=\E=, use=xterm+noapp, + use=xterm, xterm-24|vs100|xterms|xterm terminal emulator (X Window System), - lines#24, use=xterm, + lines#24, use=xterm-old, # This is xterm for ncurses. xterm|xterm terminal emulator (X Window System), @@ -3349,7 +3394,7 @@ xterm+sl-twm|access X title line (pacify twm-descended window managers), # # xterm with bold instead of underline xterm-bold|xterm terminal emulator (X11R6 Window System) standout w/bold, - smso=\E[7m, smul=\E[1m, use=xterm, + smso=\E[7m, smul=\E[1m, use=xterm-old, # (kterm: this had extension capabilities ":KJ:TY=ascii:" -- esr) # (kterm should not invoke DEC Graphics as the alternate character set # -- Kenji Rikitake) @@ -21607,6 +21652,15 @@ v3220|LANPAR Vision II model 3220/3221/3222, # 2007-11-03 # * correct acsc strings for h19 and z100 (Benjamin Sittler) # +# 2007-11-11 +# * use xterm-xf86-v44 for "xterm-xfree86", reflecting changes to +# xterm starting with patch #216 -TD +# * make legacy xterm entries such as xterm-24 inherit from xterm-old, +# to match xterm #230 -TD +# * extend xterm+pccX entries to match xterm #230 -TD +# * add xterm+app, xterm+noapp, from xterm #230 -TD +# * add/use xterm+pce2 from xterm #230, in xterm+pcfkeys -TD +# # The following sets edit modes for GNU EMACS. # Local Variables: # fill-prefix:"\t" diff --git a/ncurses/base/MKlib_gen.sh b/ncurses/base/MKlib_gen.sh index b5b07140..09857834 100755 --- a/ncurses/base/MKlib_gen.sh +++ b/ncurses/base/MKlib_gen.sh @@ -2,10 +2,10 @@ # # MKlib_gen.sh -- generate sources from curses.h macro definitions # -# ($Id: MKlib_gen.sh,v 1.29 2007/08/18 13:17:14 tom Exp $) +# ($Id: MKlib_gen.sh,v 1.30 2008/01/05 23:21:10 tom Exp $) # ############################################################################## -# Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. # +# Copyright (c) 1998-2007,2008 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"), # @@ -422,4 +422,5 @@ $preprocessor $TMP 2>/dev/null \ | sed \ -e 's/^.*T_CALLED.*returnCode( \([a-z].*) \));/ return \1;/' \ -e 's/^.*T_CALLED.*returnCode( \((wmove.*) \));/ return \1;/' \ + -e 's/gen_//' \ | sed -f $ED4 diff --git a/ncurses/base/lib_set_term.c b/ncurses/base/lib_set_term.c index 2b1387ad..8c15de8b 100644 --- a/ncurses/base/lib_set_term.c +++ b/ncurses/base/lib_set_term.c @@ -44,7 +44,7 @@ #include /* cur_term */ #include -MODULE_ID("$Id: lib_set_term.c,v 1.100 2007/09/08 21:23:43 tom Exp $") +MODULE_ID("$Id: lib_set_term.c,v 1.102 2007/12/29 20:36:32 tom Exp $") NCURSES_EXPORT(SCREEN *) set_term(SCREEN *screenp) @@ -221,9 +221,6 @@ extract_fgbg(char *src, int *result) } #endif -#define ripoff_sp _nc_prescreen.rsp -#define ripoff_stack _nc_prescreen.rippedoff - /* OS-independent screen initializations */ NCURSES_EXPORT(int) _nc_setupscreen(int slines GCC_UNUSED, @@ -568,10 +565,12 @@ _nc_setupscreen(int slines GCC_UNUSED, ? SP->_lines_avail - count : 0), 0); - if (w) + if (w) { + rop->win = w; rop->hook(w, scolumns); - else + } else { returnCode(ERR); + } if (rop->line < 0) bottom_stolen += count; else @@ -622,6 +621,7 @@ _nc_ripoffline(int line, int (*init) (WINDOW *, int)) NCURSES_EXPORT(int) ripoffline(int line, int (*init) (WINDOW *, int)) { + START_TRACE(); T((T_CALLED("ripoffline(%d,%p)"), line, init)); if (line == 0) diff --git a/ncurses/base/lib_slkclear.c b/ncurses/base/lib_slkclear.c index 99edcd53..946ceeaf 100644 --- a/ncurses/base/lib_slkclear.c +++ b/ncurses/base/lib_slkclear.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2001,2006 Free Software Foundation, Inc. * + * Copyright (c) 1998-2006,2007 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 * @@ -29,6 +29,8 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Juergen Pfeifer 1996-1999 * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -38,24 +40,27 @@ */ #include -MODULE_ID("$Id: lib_slkclear.c,v 1.9 2006/05/27 19:21:19 tom Exp $") +MODULE_ID("$Id: lib_slkclear.c,v 1.10 2007/12/29 17:51:47 tom Exp $") NCURSES_EXPORT(int) slk_clear(void) { + int rc = ERR; + T((T_CALLED("slk_clear()"))); - if (SP == NULL || SP->_slk == NULL) - returnCode(ERR); - SP->_slk->hidden = TRUE; - /* For simulated SLK's it's looks much more natural to - inherit those attributes from the standard screen */ - SP->_slk->win->_nc_bkgd = stdscr->_nc_bkgd; - WINDOW_ATTRS(SP->_slk->win) = WINDOW_ATTRS(stdscr); - if (SP->_slk->win == stdscr) { - returnCode(OK); - } else { - werase(SP->_slk->win); - returnCode(wrefresh(SP->_slk->win)); + if (SP != NULL && SP->_slk != NULL) { + SP->_slk->hidden = TRUE; + /* For simulated SLK's it looks much more natural to + inherit those attributes from the standard screen */ + SP->_slk->win->_nc_bkgd = stdscr->_nc_bkgd; + WINDOW_ATTRS(SP->_slk->win) = WINDOW_ATTRS(stdscr); + if (SP->_slk->win == stdscr) { + rc = OK; + } else { + werase(SP->_slk->win); + rc = wrefresh(SP->_slk->win); + } } + returnCode(rc); } diff --git a/ncurses/base/resizeterm.c b/ncurses/base/resizeterm.c index 8bea743a..b2cff216 100644 --- a/ncurses/base/resizeterm.c +++ b/ncurses/base/resizeterm.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. * + * Copyright (c) 1998-2007,2008 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 * @@ -41,7 +41,7 @@ #include #include -MODULE_ID("$Id: resizeterm.c,v 1.24 2007/12/22 23:20:31 tom Exp $") +MODULE_ID("$Id: resizeterm.c,v 1.28 2008/01/06 01:23:36 tom Exp $") #define stolen_lines (screen_lines - SP->_lines_avail) @@ -81,6 +81,10 @@ show_window_sizes(const char *name) } #endif +/* + * Return true if the given dimensions do not match the internal terminal + * structure's size. + */ NCURSES_EXPORT(bool) is_term_resized(int ToLines, int ToCols) { @@ -91,6 +95,48 @@ is_term_resized(int ToLines, int ToCols) || ToCols != screen_columns)); } +/* + */ +static ripoff_t * +ripped_window(WINDOW *win) +{ + ripoff_t *result = 0; + ripoff_t *rop; + + if (win != 0) { + for (rop = ripoff_stack; (rop - ripoff_stack) < N_RIPS; rop++) { + if (rop->win == win && rop->line != 0) { + result = rop; + break; + } + } + } + return result; +} + +/* + * Returns the number of lines from the bottom for the beginning of a ripped + * off window. + */ +static int +ripped_bottom(WINDOW *win) +{ + int result = 0; + ripoff_t *rop; + + if (win != 0) { + for (rop = ripoff_stack; (rop - ripoff_stack) < N_RIPS; rop++) { + if (rop->line < 0) { + result -= rop->line; + if (rop->win == win) { + break; + } + } + } + } + return result; +} + /* * Return the number of levels of child-windows under the current window. */ @@ -141,13 +187,27 @@ adjust_window(WINDOW *win, int ToLines, int ToCols, int stolen EXTRA_DCLS) int bottom = CurLines + SP->_topstolen - stolen; int myLines = win->_maxy + 1; int myCols = win->_maxx + 1; + ripoff_t *rop = ripped_window(win); - T((T_CALLED("adjust_window(%p,%d,%d) currently %ldx%ld at %ld,%ld"), + T((T_CALLED("adjust_window(%p,%d,%d)%s depth %d/%d currently %ldx%ld at %ld,%ld"), win, ToLines, ToCols, + (rop != 0) ? " (rip)" : "", + parent_depth(win), + child_depth(win), (long) getmaxy(win), (long) getmaxx(win), - (long) getbegy(win), (long) getbegx(win))); - - if (win->_begy >= bottom) { + (long) getbegy(win) + win->_yoffset, (long) getbegx(win))); + + if (rop != 0 && rop->line < 0) { + /* + * If it is a ripped-off window at the bottom of the screen, simply + * move it to the same relative position. + */ + win->_begy = ToLines - ripped_bottom(win) - 0 - win->_yoffset; + } else if (win->_begy >= bottom) { + /* + * If it is below the bottom of the new screen, move up by the same + * amount that the screen shrank. + */ win->_begy += (ToLines - CurLines); } else { if (myLines == CurLines - stolen @@ -347,13 +407,45 @@ resizeterm(int ToLines, int ToCols) SP->_sig_winch = FALSE; if (is_term_resized(ToLines, ToCols)) { +#if USE_SIGWINCH + ripoff_t *rop; + bool slk_visible = (SP != 0 + && SP->_slk != 0 + && !(SP->_slk->hidden)); + + if (slk_visible) { + slk_clear(); + } +#endif + result = resize_term(ToLines, ToCols); #if USE_SIGWINCH ungetch(KEY_RESIZE); /* so application can know this */ clearok(curscr, TRUE); /* screen contents are unknown */ -#endif - result = resize_term(ToLines, ToCols); + /* ripped-off lines are a special case: if we did not lengthen + * them, we haven't moved them either. repaint them, too. + */ + for (rop = ripoff_stack; (rop - ripoff_stack) < N_RIPS; rop++) { + if (rop->win != stdscr + && rop->win != 0 + && rop->line < 0) { + + if (rop->hook != _nc_slk_initialize) { + touchwin(rop->win); + wnoutrefresh(rop->win); + } + } + } + + /* soft-keys are a special case: we _know_ how to repaint them */ + if (slk_visible) { + slk_restore(); + slk_touch(); + + slk_refresh(); + } +#endif } } diff --git a/ncurses/curses.priv.h b/ncurses/curses.priv.h index 54ffc8ec..484fd193 100644 --- a/ncurses/curses.priv.h +++ b/ncurses/curses.priv.h @@ -34,7 +34,7 @@ /* - * $Id: curses.priv.h,v 1.353 2007/12/23 00:15:38 tom Exp $ + * $Id: curses.priv.h,v 1.355 2007/12/29 20:32:54 tom Exp $ * * curses.priv.h * @@ -417,6 +417,7 @@ typedef struct _SLK { #endif /* USE_TERMLIB */ typedef struct { + WINDOW *win; /* the window used in the hook */ int line; /* lines to take, < 0 => from bottom*/ int (*hook)(WINDOW *, int); /* callback for user */ } ripoff_t; @@ -623,6 +624,9 @@ typedef struct { #endif } NCURSES_PRESCREEN; +#define ripoff_sp _nc_prescreen.rsp +#define ripoff_stack _nc_prescreen.rippedoff + extern NCURSES_EXPORT_VAR(NCURSES_PRESCREEN) _nc_prescreen; /* diff --git a/ncurses/tinfo/lib_data.c b/ncurses/tinfo/lib_data.c index 225935ea..d7f3b59a 100644 --- a/ncurses/tinfo/lib_data.c +++ b/ncurses/tinfo/lib_data.c @@ -41,7 +41,7 @@ #include -MODULE_ID("$Id: lib_data.c,v 1.34 2007/10/20 21:49:10 tom Exp $") +MODULE_ID("$Id: lib_data.c,v 1.35 2007/12/29 20:29:27 tom Exp $") /* * OS/2's native linker complains if we don't initialize public data when @@ -191,7 +191,7 @@ NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = { #define STACK_FRAME_0s { STACK_FRAME_0 } #define NUM_VARS_0s { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } -#define RIPOFF_0 { 0,0 } +#define RIPOFF_0 { 0,0,0 } #define RIPOFF_0s { RIPOFF_0 } NCURSES_EXPORT_VAR(NCURSES_PRESCREEN) _nc_prescreen = { diff --git a/progs/infocmp.c b/progs/infocmp.c index 9b74ba00..99db6bbb 100644 --- a/progs/infocmp.c +++ b/progs/infocmp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. * + * Copyright (c) 1998-2007,2008 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 * @@ -42,7 +42,7 @@ #include -MODULE_ID("$Id: infocmp.c,v 1.94 2007/11/17 23:34:26 tom Exp $") +MODULE_ID("$Id: infocmp.c,v 1.95 2008/01/05 20:53:20 tom Exp $") #define L_CURL "{" #define R_CURL "}" @@ -1450,7 +1450,7 @@ main(int argc, char *argv[]) } } - maxterms = (argc + 1 - optind); + maxterms = (argc + 2 - optind); tfile = typeMalloc(path, maxterms); tname = typeCalloc(char *, maxterms); entries = typeCalloc(ENTRY, maxterms); diff --git a/progs/toe.c b/progs/toe.c index 6bcff07f..38b85cb3 100644 --- a/progs/toe.c +++ b/progs/toe.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. * + * Copyright (c) 1998-2007,2008 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 * @@ -44,7 +44,7 @@ #include #endif -MODULE_ID("$Id: toe.c,v 1.46 2007/10/13 22:26:38 tom Exp $") +MODULE_ID("$Id: toe.c,v 1.48 2008/01/05 20:41:26 tom Exp $") #define isDotname(name) (!strcmp(name, ".") || !strcmp(name, "..")) @@ -316,6 +316,7 @@ main(int argc, char *argv[]) bool direct_dependencies = FALSE; bool invert_dependencies = FALSE; bool header = FALSE; + char *report_file = 0; int i; int code; int this_opt, last_opt = '?'; @@ -323,7 +324,7 @@ main(int argc, char *argv[]) _nc_progname = _nc_rootname(argv[0]); - while ((this_opt = getopt(argc, argv, "0123456789ahuvUV")) != -1) { + while ((this_opt = getopt(argc, argv, "0123456789ahu:vU:V")) != -1) { /* handle optional parameter */ if (isdigit(this_opt)) { switch (last_opt) { @@ -349,12 +350,14 @@ main(int argc, char *argv[]) break; case 'u': direct_dependencies = TRUE; + report_file = optarg; break; case 'v': v_opt = 1; break; case 'U': invert_dependencies = TRUE; + report_file = optarg; break; case 'V': puts(curses_version()); @@ -365,15 +368,15 @@ main(int argc, char *argv[]) } set_trace_level(v_opt); - if (direct_dependencies || invert_dependencies) { - if (freopen(argv[optind], "r", stdin) == 0) { + if (report_file != 0) { + if (freopen(report_file, "r", stdin) == 0) { (void) fflush(stdout); - fprintf(stderr, "%s: can't open %s\n", _nc_progname, argv[optind]); + fprintf(stderr, "%s: can't open %s\n", _nc_progname, report_file); ExitProgram(EXIT_FAILURE); } /* parse entries out of the source file */ - _nc_set_source(argv[optind]); + _nc_set_source(report_file); _nc_read_entry_source(stdin, 0, FALSE, FALSE, NULLHOOK); } diff --git a/test/ncurses.c b/test/ncurses.c index e349da21..91acade3 100644 --- a/test/ncurses.c +++ b/test/ncurses.c @@ -40,7 +40,7 @@ AUTHOR Author: Eric S. Raymond 1993 Thomas E. Dickey (beginning revision 1.27 in 1996). -$Id: ncurses.c,v 1.292 2007/07/21 17:41:55 tom Exp $ +$Id: ncurses.c,v 1.296 2007/12/29 21:05:43 tom Exp $ ***************************************************************************/ @@ -608,6 +608,20 @@ remember_boxes(unsigned level, WINDOW *txt_win, WINDOW *box_win) winstack[level].frame = box_win; } +#if USE_SOFTKEYS && (NCURSES_VERSION_PATCH < 20071229) +static void +slk_repaint(void) +{ + /* this chunk is now done in resize_term() */ + slk_touch(); + slk_clear(); + slk_noutrefresh(); +} + +#else +#define slk_repaint() /* nothing */ +#endif + /* * For wgetch_test(), we create pairs of windows - one for a box, one for text. * Resize both and paint the box in the parent. @@ -623,12 +637,7 @@ resize_boxes(unsigned level, WINDOW *win) touchwin(stdscr); wnoutrefresh(stdscr); -#if USE_SOFTKEYS - /* FIXME: this chunk should be done in resizeterm() */ - slk_touch(); - slk_clear(); - slk_noutrefresh(); -#endif + slk_repaint(); for (n = 0; n < level; ++n) { wresize(winstack[n].frame, high, wide); @@ -829,6 +838,8 @@ static void getch_test(void) { int delay = begin_getch_test(); + + slk_restore(); wgetch_test(0, stdscr, delay); forget_boxes(); finish_getch_test(); @@ -836,7 +847,7 @@ getch_test(void) #if USE_WIDEC_SUPPORT /* - * For wgetch_test(), we create pairs of windows - one for a box, one for text. + * For wget_wch_test(), we create pairs of windows - one for a box, one for text. * Resize both and paint the box in the parent. */ #ifdef KEY_RESIZE @@ -851,12 +862,7 @@ resize_wide_boxes(unsigned level, WINDOW *win) touchwin(stdscr); wnoutrefresh(stdscr); -#if USE_SOFTKEYS - /* FIXME: this chunk should be done in resizeterm() */ - slk_touch(); - slk_clear(); - slk_noutrefresh(); -#endif + slk_repaint(); for (n = 0; n < level; ++n) { wresize(winstack[n].frame, high, wide); @@ -1044,6 +1050,8 @@ static void get_wch_test(void) { int delay = begin_getch_test(); + + slk_restore(); wget_wch_test(0, stdscr, delay); forget_boxes(); finish_getch_test(); @@ -2515,12 +2523,15 @@ slk_test(void) } break; #endif +#if defined(NCURSES_VERSION) && defined(KEY_RESIZE) && HAVE_WRESIZE + case KEY_RESIZE: + break; +#endif default: beep(); } - } while - ((c = Getchar()) != EOF); + } while (!isQuit(c = Getchar())); done: slk_clear(); @@ -2642,12 +2653,14 @@ wide_slk_test(void) call_slk_color(fg, bg); } break; - +#if defined(NCURSES_VERSION) && defined(KEY_RESIZE) && HAVE_WRESIZE + case KEY_RESIZE: + break; +#endif default: beep(); } - } while - ((c = Getchar()) != EOF); + } while (!isQuit(c = Getchar())); done: slk_clear(); @@ -6026,7 +6039,7 @@ rip_footer(WINDOW *win, int cols) wbkgd(win, A_REVERSE); werase(win); wmove(win, 0, 0); - wprintw(win, "footer: %d columns", cols); + wprintw(win, "footer: window %p, %d columns", win, cols); wnoutrefresh(win); return OK; } @@ -6037,7 +6050,7 @@ rip_header(WINDOW *win, int cols) wbkgd(win, A_REVERSE); werase(win); wmove(win, 0, 0); - wprintw(win, "header: %d columns", cols); + wprintw(win, "header: window %p, %d columns", win, cols); wnoutrefresh(win); return OK; } -- 2.44.0