newt (0.52.11-1) debian-dir only changes

Summary

 debian/README.Debian                              |   11 
 debian/README.whiptail                            |   14 
 debian/TODO                                       |    6 
 debian/changelog                                  | 1227 ++++++++++++
 debian/compat                                     |    1 
 debian/control                                    |   95 
 debian/copyright                                  |   16 
 debian/libnewt-dev.doc-base                       |    4 
 debian/libnewt-dev.docs                           |    1 
 debian/libnewt-dev.examples                       |    3 
 debian/libnewt-dev.install                        |    4 
 debian/libnewt-pic.install                        |    1 
 debian/libnewt0.52.install                        |    1 
 debian/libnewt0.52.postinst                       |    4 
 debian/libnewt0.52.postrm                         |    4 
 debian/newt-tcl.install                           |    1 
 debian/old-patches/620_asturian.patch             |   73 
 debian/old-patches/720_newt_combiwrap.patch       |   50 
 debian/patches/001_python.patch                   |   12 
 debian/patches/020_bidi.patch                     | 2160 ++++++++++++++++++++++
 debian/patches/030_tcl8.5.patch                   |   25 
 debian/patches/360-python-dbg.patch               |   20 
 debian/patches/400_python_memory_allocation.patch |   30 
 debian/patches/610_bengali.patch                  |   48 
 debian/patches/630_italian.patch                  |   44 
 debian/patches/700_escape-key.patch               |   11 
 debian/pycompat                                   |    1 
 debian/python-newt.examples                       |    2 
 debian/python-newt.prerm                          |    5 
 debian/rules                                      |  270 ++
 debian/test-newt.sh                               |    9 
 debian/tests/bug557960.py                         |   30 
 debian/whiptail.install                           |    1 
 debian/x.substvars                                |    1 
 34 files changed, 4185 insertions(+)

    
download this patch

Patch contents

--- newt-0.52.11.orig/debian/changelog
+++ newt-0.52.11/debian/changelog
@@ -0,0 +1,1227 @@
+newt (0.52.11-1) unstable; urgency=low
+
+  * New upstream. Closes: #575561. 
+    Merged upstream:
+     029_crash_fix.patch
+     040_pkgconfig.patch
+     310_libfixes.patch 
+     320_valgrind_fixes.patch (partial)
+     040_pkgconfig.patch
+     410_marathi.patch 
+     420_checkbox_width.patch
+     600_CVE-2009-2905.patch
+     720_newt_combiwrap.patch
+     730_gujarati.patch
+   * Fix to allow ESC key to work in whiptail. Closes: #584098.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Sat, 19 Jun 2010 20:54:29 +0100
+
+newt (0.52.10-8) unstable; urgency=low
+
+  * Remove unnecessary libgpm-dev, as it breaks kfreebsd. Closes: #572230. 
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Wed, 03 Mar 2010 10:14:59 +0000
+
+newt (0.52.10-7) unstable; urgency=low
+
+  * Enable GPM support on Linux, kFreeBSD. Closes: #572274, #569172 .
+  * Build-depend on libgpm-dev.
+  * Standards-Version: 3.8.4. No changes required. 
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Wed, 03 Mar 2010 08:34:30 +0000
+
+newt (0.52.10-6) unstable; urgency=low
+
+  * Fix for 020_bidi.patch that now requires TRUE/FALSE to be defined.
+    Thanks to Theppitak Karoonboonyanan. Closes: #570663.
+  * Initialize space for fribidi to zero. Fix thanks to Colin Watson.
+    Closes: #570581. 
+  * Fix for text incorrectly wrapping at combining characters.
+    Thanks to Theppitak Karoonboonyanan. Closes: #570630.
+  * Translations:
+     Gujarati, thanks to Kartik Mistry. Closes: #571682. 
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Tue, 02 Mar 2010 13:33:00 +0000
+
+newt (0.52.10-5) unstable; urgency=low
+
+  * Acknowledge NMU with thanks. 
+  * Remove double spaces in control that breaks dpkg-dev. Closes: #557543.
+  * Move to Standards-Version 3.8.3. No changes required.
+  * Add -ldl to Libs line. Closes: #560542, #555771.
+  * Translations:
+    Updated Bengali patch that documens plural forms. Closes: #524974
+    Updated Italian patch (in UTF-8). Closes: #559499.
+    Updated Asturian patch (in UTF-8). Closes: #538951.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Fri, 18 Dec 2009 02:07:51 +0000
+
+newt (0.52.10-4.1) unstable; urgency=high
+
+  * Non-maintainer upload by the testing Security Team.
+  * Include patch to fix buffer overflow in content processing code
+    Fixes: CVE-2009-2905 Closes: #548198
+
+ -- Giuseppe Iuculano <iuculano@debian.org>  Tue, 06 Oct 2009 17:29:33 +0200
+
+newt (0.52.10-4) unstable; urgency=low
+
+  * Add Ubuntu patch for python-newt-dbg package from Michael Vogt.
+    Closes: #531725.
+  * Add Ubuntu patch from Michael Vogt for crash when re-using text box
+    multiple times. Thanks. Closes: #531724. 
+  * Set the CHARSET specification in Marathi translation to UTF-8.
+    Thanks to Christian Perrier. Closes: #531394. 
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Wed, 03 Jun 2009 23:20:22 +0100
+
+newt (0.52.10-3) unstable; urgency=low
+
+  * Marathi translation, thanks to Priti Patil. Closes: #416811. 
+  * Patch from Neil Williams for cross-build support. Closes: #465105.
+  * Add patch from Baruch Evan to allow checkboxes be aligned;
+    wanted for LTR languages. Experimental API addition. Closes: #429351.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Tue, 05 May 2009 20:51:49 +0100
+
+newt (0.52.10-2) unstable; urgency=low
+
+  * Change Priority: for python-newt to optional. 
+  * Remove old message about experimental SONAME for
+    README.Debian. Closes: #430104. 
+  * Add asturian po file from Marcos Alverez Costales.  Closes: #518982.
+  * Add Homepage: and Vcs-Git: fields to debian/control. Closes: #489612.
+  * Cross-build support for kfreebsd from Guillem Jover. Closes: #465196.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Fri, 01 May 2009 11:09:34 +0100
+
+newt (0.52.10-1) unstable; urgency=low
+
+  * New upstream release.  
+    The following patches were merged, and have been removed:
+     015_slang2_utf8.patch
+     035_topleft_a11y.patch 
+     040_bengali.patch      
+     045_snack_entrywindow.patch 
+     050_updated_greek.patch
+     060_pgupdown_crash.patch 
+     065_scrollbars.patch
+     070_cursor_a11y.patch
+     080_pa_rename.patch
+     090_khmer.patch     
+     100_dzongkha.patch
+     110_a11y.patch
+     130_colors.patch
+     140_screensize.patch
+     150_thai.patch
+     160_esperanto.patch
+     170_nepali.patch
+     180_cursor.patch
+     190_focus.patch
+     200_cbtpos.patch
+     222_fix_gauge_crash.patch 
+     330_tamil.patch
+     340_sl_fix.patch
+     500_cope_with_backward_system_time_jumps.patch 
+  * Build-Conflicts: autoconf2.13 no longer necessary.
+  * Move DH_COMPAT=5 to file debian/COMPAT.
+  * Move to Standards-Version: 3.8.1: replace dependencies 
+    on Source-Version to binary:Version.
+  * newt-tcl now built with tcl8.5-dev and works with tcl8.{3,4,5}.
+  * Add libnewt.pc file to libnewt-dev.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Mon, 20 Apr 2009 22:57:48 +0100
+
+newt (0.52.2-11.3) unstable; urgency=low
+
+  * NMU
+  * Cherry-pick upstream patch to avoid breaking timers when the system
+    clock jumps backwards. Closes: #436497
+
+ -- Joey Hess <joeyh@debian.org>  Fri, 11 Jul 2008 14:48:49 -0400
+
+newt (0.52.2-11.2) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Apply ubuntu patch to use actually use pycentral.
+    Thanks to Steve Langasek for forwarding.
+    Closes: #445392.
+  * Fix python memory handling. Closes: #445392.
+
+ -- Thomas Viehmann <tv@beamnet.de>  Tue, 04 Mar 2008 23:33:17 +0100
+
+newt (0.52.2-11.1) unstable; urgency=medium
+
+  * NMU
+  * Fix bidi patch to link libnewt with -ldl.
+  * Include map file in the pic package.
+  * Closes: #443248
+
+ -- Joey Hess <joeyh@debian.org>  Wed, 19 Sep 2007 17:06:40 -0400
+
+newt (0.52.2-11) unstable; urgency=low
+
+  * Patch from Matthias Klose to deal with changed dpkg-architecure 
+    output. Closes: #435376.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Thu, 09 Aug 2007 19:44:20 +0100
+
+newt (0.52.2-10) unstable; urgency=low
+
+  * Correction to Slovenian translation: thanks to Matej Kovacic.
+    Closes: #405582.
+  * Fix whiptail --help response: --defaultno not -defaultno. Closes: #400972. 
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Mon, 22 Jan 2007 16:54:48 +0000
+
+newt (0.52.2-9) unstable; urgency=low
+
+  * Add Tamil translation from Senthil Kumar B. Closes: #404670.
+  * Add entry to LINGUAS file so that Kurdish translation is included.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Sun, 31 Dec 2006 10:29:31 +0000
+
+newt (0.52.2-8) unstable; urgency=low
+
+  * Change libnewt0.52 priority to important, as it is required by whiptail,
+    which is important.
+  * Fix by Eugeniy Meshcheryakov for inputbox breakage under non-ASCII
+    locales. Closes: #384391, #384787.
+  * Moved debhelper dependency to >= 5.0.37.2, to ensure latest python policy
+    support.
+  * libcheck: Remove unnecessary dependencies on -lm, -lslang, -lpopt from
+    libnewt and executables.
+  * When fribidi lookup fails, record the fact so we don't try to dlopen()
+    libfribidi on every text string printed.
+  * newt-tcl: rename /usr/lib/libtwhiptcl.so/ to /usr/lib/whiptcl for clarity.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Fri, 29 Sep 2006 13:25:33 +0100
+
+newt (0.52.2-7) unstable; urgency=low
+
+  * debian/patches/222_fix_gauge_crash.patch
+    - prevent a negative number input to the gauge dialog from crashing
+      whiptail by smashing the stack. Thanks to Ryan Lortie.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Thu, 10 Aug 2006 10:18:08 +0100
+
+newt (0.52.2-6) experimental; urgency=low
+
+  * Acknowledge NMU with thanks. Closes: #379566.
+  * Updated python change patch to only build on python2.3, python2.4; makes
+    no assumptions about python2.5, etc. Thanks to Matthias Klose.
+    Closes: #372811.
+  * Clear dlerror() state before trying dlopen(), to try fixing
+    failures in loading.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Fri, 28 Jul 2006 09:41:39 +0100
+
+newt (0.52.2-5.1) unstable; urgency=low
+
+  * NMU
+  * Apply patch from Eugeniy Meshcheryako to regenerate configure during build
+    so that bidi support is enabled again. Closes: #379566
+
+ -- Joey Hess <joeyh@debian.org>  Mon, 24 Jul 2006 12:24:38 -0400
+
+newt (0.52.2-5) unstable; urgency=low
+
+  * Acknowledge NMU with thanks. Closes: #372811.
+  * Move to new Python policy. This package should now work on
+    python2.3 and python2.4.
+  * Move to Standards-Version: 3.7.2 : No changes required.
+  * Patches from Fedora 0.52.2-7 :
+    - Make the default colours more friendly to 8-color terminals
+    - handle listbox and checkboxtree focus better. Closes: #189038.
+    - turn off cursor when entry terminated form
+    - fix handling windows larger than screen size
+    - fix checkboxtree positioning. 
+  * Translations:
+    - Thai, thanks to Theppitak Karoonboonyanan. Closes: #367230.
+    - Esperanto, thanks to Serge Leblanc. Closes: #366077, #369240.
+    - Nepali, thanks to Paras pradhan. Closes: #369357.
+  * Fixed bug that meant Bengali was not properly included.
+  * libnewt0.52: Move priority from required to standard, to match
+    overrides.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Tue, 20 Jun 2006 21:15:43 +0100
+
+newt (0.52.2-4.1) experimental; urgency=low
+
+  * Build for python2.4.
+  * Hardcode the python dependencies for this upload, so that we can build
+    without 2.4 as the default version.
+
+ -- Matthias Klose <doko@debian.org>  Sun, 11 Jun 2006 15:07:35 +0000
+
+newt (0.52.2-4) unstable; urgency=low
+
+  * Translations:
+    - Dzongkha, thanks to Pema Geyleg. Closes: #361793.
+  * Further accessability improvements by Samuel Thibault. Closes: #337171.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Tue, 11 Apr 2006 17:52:56 +0100
+
+newt (0.52.2-3) unstable; urgency=low
+
+  * Translations: 
+    - Khmer, thanks to  Khoem Sokhem. Closes: #359671.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Tue, 28 Mar 2006 21:52:06 +0100
+
+newt (0.52.2-2) unstable; urgency=low
+
+  * Change Punjabi from pa_IN to pa, following debian-i18n discussion.
+    Closes: #357611.
+  * Release as unstable, causing a transition to new libnewt0.52.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Sun, 19 Mar 2006 14:25:06 +0000
+
+newt (0.52.2-1) experimental; urgency=low
+
+  * New upstream release.
+  * Change whiptail section: from base to utils to match override.
+  * Updated Greek translation from Kostas Papadimas. Closes: #344583.
+  * Patches from RedHat:
+    - pgupdown-crash: fixes crash in checkboxtree using pgup/down
+    - scrollbar: more pleasing scrollbars.
+  * Include cursor-a11y.patch for better accessability. Closes: #337171.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Thu, 19 Jan 2006 21:44:03 +0000
+
+newt (0.52.1-3) experimental; urgency=low
+
+  * New Bengali translation by Progga. Closes: #340650.
+  * snack.py: function EntryWindow now works with preset values for entries.
+    Closes: #340366.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Fri, 25 Nov 2005 20:50:49 +0000
+
+newt (0.52.1-2) experimental; urgency=low
+
+  * Include a11y patches by Samuel Thibault for accessability.
+    Closes: #337171.
+  * move to DH_COMPAT=5; include ${misc:Depends} to Dependencies.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Sat, 19 Nov 2005 12:05:48 +0000
+
+newt (0.52.1-1) experimental; urgency=low
+
+  * New upstream release.
+  * New Kurdish translation by Erdal Ronahi. Closes: #335077.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Sat, 22 Oct 2005 20:20:38 +0100
+
+newt (0.51.6-31) unstable; urgency=low
+
+  * don't free() a pointer that will be NULL if fribidi is not installed.
+    Closes: #317451, #326068.
+  * Build-Depend on libfribid-dev, libnewt0.51 recommends libfribidi0.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Thu,  8 Sep 2005 22:30:22 +0100
+
+newt (0.51.6-30) unstable; urgency=low
+
+  * Improved BIDI patch from Eugeniy Meshcheryakov. Closes: #323832. 
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Mon, 22 Aug 2005 19:03:02 +0100
+
+newt (0.51.6-29) unstable; urgency=low
+
+  * Translations:
+    - Xhosa thanks to Xhosa team and Canonical. Closes: #319480.
+  * Fixed syntax errors in changelog that lintian now complains of.
+  * Better dependency generation for whiptail; no doubled dependencies
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Thu,  4 Aug 2005 18:56:34 +0100
+
+newt (0.51.6-28) unstable; urgency=low
+
+  * Patch from Eugeniy Meshcheryakov to do fribidi in newt. Closes: #318239. 
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Thu, 14 Jul 2005 21:54:38 +0100
+
+newt (0.51.6-27) unstable; urgency=low
+
+  * Translations:
+     - Wolof (wo) thanks to Mouhamadou Mamoune Mbacke. Closes: #317535.
+  * Add explanation to whiptail man page as to how to start text with a dash
+    '-'. Closes: #284708.
+  * Move to Standards-Version: 3.6.2 
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Sun, 10 Jul 2005 08:32:24 +0100
+
+newt (0.51.6-26) unstable; urgency=low
+
+  * Build against libslang2-dev (>= 2.0.4-2) for fribidi patch.
+  * Upload to unstable.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Sun, 26 Jun 2005 10:20:18 +0100
+
+newt (0.51.6-25) experimental; urgency=low
+
+  * libslang2: use SLutf8_enable(-1) to enable UTF8 handling.
+  * Patch from Eugeniy Meshcheryakov to handle incorrect input in
+    non-ASCII modes. Closes: #304657.
+  * libnewt0.51: set priority to required, to match override.
+  * whiptail: set priority to important, to match override.
+  * Generate newt.pot during package build. Closes: #313523.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Sat, 25 Jun 2005 13:12:54 +0100
+
+newt (0.51.6-24) experimental; urgency=low
+
+  * Build against libslang2
+  * Translations:
+    - Punjabi (pa_IN) thanks to Amanpreet Singh Alam. Closes: #309793.
+    - Estonian thanks to Siim Põder. Closes: #312465.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Mon, 13 Jun 2005 21:23:47 +0100
+
+newt (0.51.6-23) unstable; urgency=low
+
+  * Build against libc6 from unstable, not experimental. Closes: #308550. 
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Fri, 13 May 2005 07:43:48 +0100
+
+newt (0.51.6-22) unstable; urgency=low
+
+  * Translations:
+    - Vietnamese, thanks to Clytie Siddall. Closes: #306612.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Mon,  9 May 2005 20:53:22 +0100
+
+newt (0.51.6-21) unstable; urgency=low
+
+  * Translations:
+    - Tagalog, thanks to Eric Pareja. Closes: #288908.
+  * Corrections for typos in whiptail man page. Thanks to A. Costa.
+    Closes: #287349.
+  * whiptail: textbox help should say <file> not <text>. Closes: #287352.
+  * Interpret C-u as discard. Thanks to Matt Kraai for patch;
+    Closes: #275588.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Sun, 20 Feb 2005 15:33:50 +0000
+
+newt (0.51.6-20) unstable; urgency=low
+
+  * Upgrade bug; lbnewt0.51 was supplying /usr/lib/libnewt.so in conflict
+    with libnewt-dev. Closes: #283185.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Sat, 27 Nov 2004 09:49:00 +0000
+
+newt (0.51.6-19) unstable; urgency=low
+
+  * Translations:
+    - Welsh, thanks to  Dafydd Harries. Closes: #282178.
+    - Galician, thanks to Jacobo Tarrio. Closes: #282231.
+    - Albanian, thanks to Elian Myftiu. Closes: #282158.
+    - Malagasy, thanks to Jaonary Rabarisoa. Closes: #282444.
+    - Hindi, thanks to Ravishankar Shrivastava. Closes: #282445.
+  * Fix regression: Tradition Chinese translations that were over-written
+    by Simplified Chinese by mistake. Closes: #282948.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Thu, 25 Nov 2004 20:44:04 +0000
+
+newt (0.51.6-18) unstable; urgency=low
+
+  * Macedonian translation thanks to Georgi Stanojevski. Closes: #275778. 
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Sun, 17 Oct 2004 20:18:57 +0100
+
+newt (0.51.6-17) unstable; urgency=low
+
+  * Romanian translation thanks to Eddy Petrisor. Closes: #275121.
+  * Traditional Chinese translation thanks to Tetralet. Closes: #272618.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Wed,  6 Oct 2004 20:52:22 +0100
+
+newt (0.51.6-16) unstable; urgency=low
+
+  * Include Bulgarian translation by Ognyan Kulev.
+    Closes: #271425, #272378.
+  * Remove reference to hot-key numbers (a dialog-only feature) from
+    whiptail man-page. Closes: #267965.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Mon, 20 Sep 2004 21:45:32 +0100
+
+newt (0.51.6-15) unstable; urgency=low
+
+  * Ensure whiptail depends on ${Source-Version} of libnewt0.51.
+    Closes: #269835.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Sun,  5 Sep 2004 20:41:08 +0100
+
+newt (0.51.6-12) unstable; urgency=low
+
+  * Build for sid.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Fri, 27 Aug 2004 22:20:01 +0100
+
+newt (0.51.6-6sarge) testing-proposed-updates; urgency=low
+
+  *  Set reset charset properly when doing line-drawing; Closes: #263780
+  *  FTBFS on AMD64,alpha. Closes: #265214.
+  *  Build whiptail against shared libnewt.so; Closes: #265721 
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Sat, 14 Aug 2004 23:08:41 +0100
+
+newt (0.51.6-11) unstable; urgency=low
+
+  * Acknowledging NMU: Closes: #262107.
+  # Ensure wstrlen is visible to newt binaries. Closes: #264723.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Fri, 13 Aug 2004 20:29:31 +0100
+
+newt (0.51.6-10.1) unstable; urgency=high
+
+  * NMU
+  * libnewt-dev should depend on 0.51, not itself.
+
+ -- Joey Hess <joeyh@debian.org>  Thu, 29 Jul 2004 15:01:19 -0400
+
+newt (0.51.6-10) unstable; urgency=low
+
+  * Tighten dependencies to latest versions of newt, slang.
+    Closes: #261314, #260992.
+  * Translations:
+    - ar.po thanks to Arabeyes project. Closes: #260646.
+    - hr.po thanks to Krunoslav Gernhard. Closes: #261421.
+  * Add debian/watch file.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Mon, 26 Jul 2004 22:32:54 +0100
+
+newt (0.51.6-9) unstable; urgency=low
+
+  * Build against the correct slang libraries. Closes: #259283. 
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Tue, 13 Jul 2004 22:44:40 +0100
+
+newt (0.51.6-8) unstable; urgency=low
+
+  * FIx garbled display in top line of boxes. Closes: #257488. 
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Mon, 12 Jul 2004 19:22:55 +0100
+
+newt (0.51.6-7) unstable; urgency=low
+
+  * Fix display problem with 'hidden' checkbox entries in whiptail being
+    shown. Closes: #257807.
+  * Used versioned symbols in libnewt.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Thu,  8 Jul 2004 20:49:22 +0100
+
+newt (0.51.6-6) unstable; urgency=low
+
+  * Echo '*' in password field in whiptail. Closes: #254411.
+  * Fix segfaults on bad parameters (box sizes). Closes: #253512.
+  * Update copyright file to point to better source. Closes: #254975.
+  * ENTER in multiselect (check and radio lists) now selects; 
+    tabbing to OK not required. Closes: #252751.
+  * Removed XSI:'isms from python-newt.prerm.in ; Closes: #256508.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Mon, 28 Jun 2004 20:45:09 +0100
+
+newt (0.51.6-5) unstable; urgency=low
+
+  * Correction to Catalan translation. Closes: #251790. 
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Tue,  8 Jun 2004 22:29:40 +0100
+
+newt (0.51.6-4) unstable; urgency=low
+
+  * Change Catalan po file to reflect UTF-8 encoding. 
+    Closes: #251790, #251811.
+  * Bosnian translationi by  Safir Šećerović. Closes: #251138.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Mon, 31 May 2004 21:30:06 +0100
+
+newt (0.51.6-3) unstable; urgency=low
+
+  * Don't free ptr in entry.c twice. Closes: #246378. 
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Tue,  4 May 2004 20:24:09 +0100
+
+newt (0.51.6-2) unstable; urgency=low
+
+  * Translations:
+    - Portuguese by  Miguel Figueiredo. Closes: #241311.
+    - Slovak by Peter Mann. Closes: #246099.
+  * Fix python indentation in snack.py. Closes: #236837.
+  * Don't truncate strings in UTF-8 mode in whiptail. Closes: #232426.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Mon, 26 Apr 2004 20:27:23 +0100
+
+newt (0.51.6-1) unstable; urgency=low
+
+  * New Upstream release.
+  * Switched to dbs:
+    - Cleanup of debian/rules
+    - broke 0.51.4 changes into debian/patches
+  * newt.c: Don't spin on the terminal window dying. Closes: #203988.
+  * Use terminfo bindings: patch from Henning Makholm. Closes: #219043.
+  * Trim long titles rather than failing. Closes: #236114.
+  * Add GNU options --help, --version to whiptail.
+  * Translations:
+    - Turkish by Recai Oktas. Closes: #239149.
+    - Korean by  Changwoo Ryu. Closes: #241988.
+    - Indonesian by I Gede Wijaya S. Closes: #243454.
+    - Basque by Piarres Beobide Egaña. Closes: #243587.
+    - Hebrew by Lior Kaplan.
+  * Patch for non-ASCII input, thanks to Eugeniy Meshcheryakov.
+    Closes: #238873.
+  Special thanks to Eugeniy Meshcheryakov for fixes and testing.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Sun, 25 Apr 2004 19:12:19 +0000
+
+newt (0.51.4-21) unstable; urgency=low
+
+  * zh_CN.po: Simplified Chinese translation from Carlos Z.F. Liu.
+    Closes: #232134.
+  * whiptail.c: guessSize: fix wrapping/truncation of text when autosizing 
+    dialogs. Closes: #224333, #231634.    
+  * whiptail.c: Translate "\n" in text to newlines. Closes: #218991, #212255.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Wed, 11 Feb 2004 15:37:07 +0000
+
+newt (0.51.4-20) unstable; urgency=low
+
+  The "Further adventures in translation" release.
+  * cs.po: Czech translation from Miroslav Kure. Closes: #227116.
+  * nl.po: Dutch translation from Bart Cornelis. Closes: #227102.
+  * sl.po: Slovenian translation from Jure Cuhalev. Closes: #227519.
+  * lt.po: Lithuanian translation from Kęstutis Biliūnas. Closes: #227566.
+  * es.po: Improved Spanish translation from Carlos Valdivia Yagüe.
+  * da.po: Danish translation from Claus Hindsgaul.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Fri,  6 Feb 2004 18:04:25 +0000
+
+newt (0.51.4-19) unstable; urgency=medium
+
+  The "Do translators travel in packs?" release.
+  * fi.po: Finnish translation from Tommi Vainikainen. Closes: #226993.
+  * fr.po, ja.po: Fix comments; these are not German translations. 
+    Closes: #226964.
+  * ga.po: Convert to UTF-8.
+  * it.po: Italian translation from  Giuseppe Sacco, and build fix
+    for ja.po.
+    Closes: #226942, #226943.
+  * sl.po: Slovenian translation from  Jure Cuhalev. Closes: #226901.
+  * hu.po: New Hungarian translation from  VEROK Istvan. Closes: #226982.
+  * ru.po: New Russian translation from Nikolai Prokoschenko. Closes: #226945.
+  * sv.po: Fix spelling mistake. Thanks to André Dahlqvist.
+  * el.po: New Greek translation from Konstantinos Margaritis. 
+    Closes: #226922.
+  * pl.po: New Polish translation from  Bartosz Fenski aka fEnIo.
+    Closes: #226921.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Sat, 10 Jan 2004 07:28:36 +0000
+
+newt (0.51.4-18) unstable; urgency=low
+
+  * whiptail / whiptcl: Resize listboxes to fit on screen.
+    Closes: #201619, #206616.
+  * ESC key now works. Closes: #52477, #110268.
+  * Add examples to libnewt-dev.
+  * Update version, authors in whiptail(1).
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Fri, 19 Sep 2003 20:52:48 +0000
+
+newt (0.51.4-17) unstable; urgency=low
+
+  * whiptail: Return -1 on error, to distinguish Ok, Cancel, Error.
+    Closes: #86400. Closes: #209029.
+  * Add documentation for python-newt. Closes: #151783.
+  * Fix build error for po/Makefile.in.in. Closes: #207047.
+  * newt should Build-Depend on gettext. Closes: #207477.
+  * Build-Depend on debhelper >= 4.1.1. Closes: #207037.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Mon, 15 Sep 2003 20:35:56 +0100
+
+newt (0.51.4-16) unstable; urgency=low
+
+  * Ship files for python2.3, not python2.2.  Closes: #205481, #205505. 
+  * Change es.po to UTF-8, to correct charset error
+  * Correct spelling in sv.po. 
+    Closes: #206218, #206219, #206220, #206221.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Mon, 18 Aug 2003 22:02:11 +0100
+
+newt (0.51.4-15) unstable; urgency=low
+
+  * Removed unnecessary dependencies on python << 2.3; Closes: #204876.
+  * Changed maintainer email to mckinstry@debian.org
+  * Moved to Standards-Version: 3.6.0; no changes required.
+
+ -- Alastair McKinstry <mckinstry@debian.org>  Tue, 12 Aug 2003 22:09:43 +0100
+
+newt (0.51.4-14) unstable; urgency=low
+
+  * Added Brazilian Portugese translation from Andre Luis Lopes. 
+    Closes: #202101. 
+  * chmod +x ./mkinstalldirs. Closes: #202078.
+
+ -- Alastair McKinstry <mckinstry@computer.org>  Sun, 20 Jul 2003 09:28:44 +0100
+
+newt (0.51.4-13) unstable; urgency=low
+
+  * Fix installation of .mo files. Closes: #202003.
+  * Added french translation for whiptail from Christian Perrier. Closes: #201864.
+  * Added Japanese translation for whipatil from Tomohiro KUBOTA. Closes: #202005.
+
+ -- Alastair McKinstry <mckinstry@computer.org>  Sat, 19 Jul 2003 08:31:49 +0100
+
+newt (0.51.4-12) unstable; urgency=low
+
+  * Re-enabled Ctrl-U key. Closes: #184486, #191487.
+  * Enable i18n, with whiptail button translations to
+    Catalan, Spanish, Irish, German, Swedish and Norwegian. Closes: #54536.
+
+ -- Alastair McKinstry <mckinstry@computer.org>  Sun, 13 Jul 2003 12:33:58 +0100
+
+newt (0.51.4-11) unstable; urgency=low
+
+  * Fixed misleading colors in compact buttons. Closes: #195775,#198800.
+  * Updated to policy 3.6.0; no changes needed.
+
+ -- Alastair McKinstry <mckinstry@computer.org>  Mon, 14 Jul 2003 10:16:11 +0100
+
+newt (0.51.4-10) unstable; urgency=low
+
+  * libnewt0.51 replaces libnewt0, libnewt-utf8; whiptail can also use tcl8.4.
+    Closes: #196570.
+  * Add README.whiptail to document the purpose of whiptail. Closes: #67356.
+  * Added --default-item option added to whiptail, whiptcl.
+    Closes: #49352, #49796.
+  * Added shlibs fix from Daniel Schepler for whiptail dependency on alpha.
+    Closes: #196290.
+  * malloc, realloc failures in whiptail, whiptcl now generate a DLG_ERROR
+    return, not a segfault.
+
+ -- Alastair McKinstry <mckinstry@computer.org>  Mon, 16 Jun 2003 20:54:30 +0100
+
+newt (0.51.4-9) unstable; urgency=low
+
+  * libnewt0 replaces libnewt-utf8
+
+ -- Alastair McKinstry <mckinstry@computer.org>  Sun,  8 Jun 2003 08:28:55 +0100
+
+newt (0.51.4-8) unstable; urgency=low
+
+  * Fix problem with cursor position when no border drawn. Closes: #195545.
+  * Add --notags option to whiptail. Closes: #45957.
+  * Change newt-tcl whiptcl.so to libwhiptcl.so. Closes: #21697.
+  * Fix shlib dependency calculation to ensure dependency for whiptail on 
+    libnewt0.51 on sparc. Closes: #196290.
+
+ -- Alastair McKinstry <mckinstry@computer.org>  Fri,  6 Jun 2003 14:00:05 +0100
+
+newt (0.51.4-7) unstable; urgency=low
+
+  * Added --output-fd option. Closes: #153628.
+  * Use libc6.1 on Alpha rather than libc. Closes: #194877.
+
+ -- Alastair McKinstry <mckinstry@computer.org>  Fri, 30 May 2003 19:00:46 +0100
+
+newt (0.51.4-6) unstable; urgency=low
+
+  * Hardcode whiptail dependencies for the moment to ensure that
+    libnewt0.51 is included on !i386. Closes: #192767.
+  * Re-included --textbox, --passwordbox functionality that upstream had
+    dropped without mentioning it in documentation.
+    Closes: #191579, #191580, #192494, #192922, #192944, #193040.
+
+ -- Alastair McKinstry <mckinstry@computer.org>  Mon, 12 May 2003 22:31:37 +0100
+
+newt (0.51.4-5) unstable; urgency=low
+
+  * Re-insert code to ensure dialogboxes.o is -fPIC, this time to Makefile.in,
+    not Makefile.  Closes: #192393.
+
+ -- Alastair McKinstry <mckinstry@computer.org>  Sun, 11 May 2003 13:51:18 +0100
+
+newt (0.51.4-4) unstable; urgency=low
+
+  * Reset screen before leaving on exit. Closes: #55638.
+  * Removed incorrect 'and is maintained by' line from debian/copyright.
+  * Ensure dialogboxes.o is built -fPIC: its included in shared objects.
+    Closes: #192393.
+  * Ensure whiptail dependency on libnewt0.51. Closes: #192767.
+  * Added libnewt.so->libnewt.so.0.51 symlink to libnewt-dev. Closes: #192884.
+
+ -- Alastair McKinstry <mckinstry@computer.org>  Mon,  5 May 2003 14:29:15 +0100
+
+newt (0.51.4-3) unstable; urgency=low
+
+  * Also remore dh_testroot from configure target. Closes: #191123. 
+  * Change Sections to match overrides (devel->libdevel, interpreters->python)
+  * Fixed dependencies. Build-Depend, slang>>1.4.5-2; whiptail. 
+    Closes: #162429.
+  * Re-inserted the guessSize() code for autosizing from 0.50.17, with a bugfix to
+    allow it to work with UTF8. Closes: #191627.
+  * newt.c: Window placement calc: Don't assume 80x24! instead,  read from slang.
+    Closes: #191578
+  * include newt.spec in /usr/share/doc as it includes important changelog
+    info.
+  * Documented the removal of whiptail features --passwordbox, --textbox;
+    added explanation on how to select items in checklists, radiolists in
+    whiptail.1. Closes: #184471.
+  * Removed debian-test testsuite, as the debian-test package has been removed.
+
+ -- Alastair McKinstry <mckinstry@computer.org>  Thu,  1 May 2003 12:33:01 +0100
+
+newt (0.51.4-2) unstable; urgency=low
+
+  * build target no longer needs root. Closes: #191123. 
+  * Include snack.py in python-newt. Closes: #191445, #191446.
+
+ -- Alastair McKinstry <mckinstry@computer.org>  Wed, 30 Apr 2003 23:38:55 +0100
+
+newt (0.51.4-1) unstable; urgency=low
+
+  * New maintainer.
+  * Upgraded to new release 0.51.4, from RedHat, bumping SONAME to 0.51
+  * Merged newt, newt-utf8 now that SONAME has changed.
+
+ -- Alastair McKinstry <mckinstry@computer.org>  Mon, 14 Apr 2003 10:20:02 +0100
+
+newt (0.50.17-13) unstable; urgency=low
+
+  * textbox.c(addLine,doReflow,newtTextbox) add checks to try and fix (closes: 169788)
+  * add debian-test script and install it, but I haven't actually figured
+    out how really to use it.
+  * debian/control{,.utf8}:
+    Build-Depend on sgmltools-lite rather than sgmltools-2,
+    and libnewt-utf8-pic and libnewt-pic conflicts explicitly with each other
+  * Install libnewt-utf8_pic.a as libnewt_pic.a, 
+    I hope I don't break anybody's back with this change.
+    (closes: #182041)
+  * slightly update create-utf8.sh script.
+  * update README.Debian for a change.
+  
+ -- Junichi Uekawa <dancer@debian.org>  Fri, 28 Feb 2003 17:32:33 +0900
+
+newt (0.50.17-12) unstable; urgency=low
+
+  * no stripping if nostrip is specified in DEB_BUILD_OPTS.
+  - change configure.in to accept --with-nostrip
+  - change Makefile.in to use @INSTALL_S@ instead of install -s.
+  * No buffer overflow in pushhelpline (partially fixes #66349,
+  that it doesn't segv anymore, but something is surely wrong.)
+  * Possible buffer overflow in newt.c for keyinput fixed (closes: #140404)
+
+ -- Junichi Uekawa <dancer@debian.org>  Wed, 27 Nov 2002 16:40:41 +0900
+
+newt (0.50.17-11) unstable; urgency=low
+
+  * Apply patch from Robert Milan (mostly) for hurd compatbility.
+  (closes: #149318)
+
+ -- Junichi Uekawa <dancer@debian.org>  Wed, 30 Oct 2002 17:22:23 +0900
+
+newt (0.50.17-10) unstable; urgency=low
+
+  * New maintainer
+  * Build newt-utf8 also. versions -9.7 and -9.8 were not uploaded 
+  to Debian archive as utf-8 versions.
+  * Fix newt-utf8 portions that doko didn't touch.
+  * Fixed descriptions to clarify that newt-utf8 is not binary compatible,
+  and note that it's not wide-character support, but support for locales.
+  (closes: #135455, #152223)
+  * rename debian/README to debian/README.Debian
+  * update debian/copyright to include me.
+
+ -- Junichi Uekawa <dancer@debian.org>  Mon, 28 Oct 2002 22:46:25 +0900
+
+newt (0.50.17-9.8) unstable; urgency=low
+
+  * Makefile.in (PYVER): Set to 2.2 (closes: #158689).
+
+ -- Matthias Klose <doko@debian.org>  Fri, 30 Aug 2002 08:15:43 +0200
+
+newt (0.50.17-9.7) unstable; urgency=low
+
+  * NMU.
+  * Build using python2.2.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 24 Aug 2002 14:07:14 +0200
+
+newt (0.50.17-9.6) unstable; urgency=high
+
+  * Fix possible buffer overflow. (closes: #138363, #140493)
+    At least, this no longer segfaults for me: 
+    whiptail --menu "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" 30 120 0 aa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+
+ -- Junichi Uekawa <dancer@debian.org>  Sun, 31 Mar 2002 09:38:18 +0900
+
+newt (0.50.17-9.5) unstable; urgency=high
+
+  * NMU
+  * An urgency high upload to fix mistakes introduced in -9.3, 
+    and to let the fix trickle into testing.
+  * whiptail and whiptail-utf8 conflicts with each other
+    (closes: #135752, #136404)
+  * update build-depends to depend on slang 1.4.4-7.2 or greater
+
+ -- Junichi Uekawa <dancer@debian.org>  Sun,  3 Mar 2002 11:45:10 +0900
+
+newt (0.50.17-9.4) unstable; urgency=low
+
+  * NMU
+  * add setlocale(LC_ALL, ""); to whiptail, in utf8 mode.
+    mbrtowc most probably wants this.
+    Otherwise, we are getting question marks from whiptail-utf8.
+
+ -- Junichi Uekawa <dancer@debian.org>  Mon, 25 Feb 2002 02:51:17 +0900
+
+newt (0.50.17-9.3) unstable; urgency=low
+
+  * NMU
+  * "Creating the necessary binaries for building boot-floppies, and
+    fixing the non-arch porability"
+  * Makefile.in: fix some compilation warnings with -D_GNU_SOURCE for 
+    UTF8 mode, so that the program will run on other arches. 
+    (closes: #135386)
+  * newt_pr.h: added declaration for strwidth definition.
+  * debian/control: 
+    - libnewt-dev conflicts with libnewt-dev, 
+      libnewt-utf8-dev provides/conflicts libnewt-dev
+      introduce libnewt-utf8-dev
+    - whiptail conflicts/provides whiptail-provider
+      whiptail-utf8 conflicts/provides whiptail-provider
+    - whiptail-utf8 created (closes: #135382)
+    - libnewt-dev requires newt, and slang
+    - libnewt-utf8-dev requires newt-utf8 and slang-utf8
+    - tcl8.3-dev added to build-depends for utf8.
+    - libnewt-utf8-pic depends on libnewt-utf8-dev
+  * debian/rules: 
+    - add binary-runtime and binary-devel
+      to binarytarget for utf8.
+    - build document in utf8 also.
+    - remove *~ on clean
+  * Makefile.in: Accept BUILDING_UTF8=true as a sign of required UTF8
+    flag.
+  * debian/create-utf8.sh: sed shlibs/shlibs.local so that 
+    packages compiled against utf8 version will require utf8
+    libs.
+  * debian/README: added some documentation on the package.
+  * debian/shlibs.local: update shlibs file to depend on utf8 version
+    greater than 0.50.17-9.3.
+  * With this, whiptail-utf8 should be used with slang1-utf8
+    (closes: #124083)
+
+ -- Junichi Uekawa <dancer@debian.org>  Sun, 24 Feb 2002 14:09:53 +0900
+
+newt (0.50.17-9.2) unstable; urgency=low
+
+  * NMU
+  * Split out newt-utf8 and newt source packages (closes: #133936)
+  * debian/create-utf8.sh: created, to facilitate creation of newt-utf8 version
+    from newt. Portions ripped off from fetchmail sources.
+  * debian/control.utf8: for utf8 version.
+  * this version keeps the single -dev file. It might cause problems
+    if packages linked to newt try to use slang too.
+  * bump up the version build-dependency for slang1-*-dev
+  * libnewt-pic: Depends on libnewt-dev
+
+ -- Junichi Uekawa <dancer@debian.org>  Fri, 15 Feb 2002 18:50:36 +0900
+
+newt (0.50.17-9.1) unstable; urgency=low
+
+  * Non Maintainer Upload.
+  * fix problems with mono mode, patch thanks to 
+    Klaus Weidner <kw@w-m-p.com> (closes: #128941)
+  * fixed char signedness problem patch thanks to 
+    Martin Michlmayr <tbm@cyrius.com> (closes: #127105)
+
+ -- David Kimdon <dwhedon@debian.org>  Mon, 11 Feb 2002 21:55:10 -0800
+
+newt (0.50.17-9) unstable; urgency=high
+
+  * Oops, fix the memory leak that I created while trying to fix the
+    memory leak in newtTextboxSetText. (Closes: #124117)
+
+ -- Enrique Zanardi <ezanard@debian.org>  Tue, 18 Dec 2001 13:33:50 +0000
+
+newt (0.50.17-8) unstable; urgency=high
+
+  * MU, close the bugs fixed in NMUs. (Closes: #119815, #120245, #119281, #119354, #117455, #115409, #116566, #121062, #117878, #109441)
+  * libnewt.so points to libnewt.so.0.50 (Closes: #121893)
+  * -pic packages now depend on non-pic ones. (Closes: #123325)
+  * Fix memory leak in newtTextboxSetText. (Closes: #121505)
+  * Use the proper package name in the prerm script for python-newt. 
+    (Closes: #121716)
+
+ -- Enrique Zanardi <ezanard@debian.org>  Wed, 12 Dec 2001 10:20:06 +0000
+
+newt (0.50.17-7.3) unstable; urgency=high
+
+  * NMU for woody deadline
+  * Include patch from Philip Blundell to fix UTF8.  Closes: #119354
+  * Remove snack.py~ and Makefile.in~ which seem to have been introduced
+    in the last NMU.
+
+ -- Matthew Wilcox <willy@debian.org>  Wed, 28 Nov 2001 09:28:01 -0700
+
+newt (0.50.17-7.2) unstable; urgency=high
+
+  * NMU to include corrected snack.py.  (Closes: #119815, #120245, #119281)
+
+ -- Chris Lawrence <lawrencc@debian.org>  Sat, 24 Nov 2001 17:57:55 -0600
+
+newt (0.50.17-7.1) unstable; urgency=low
+
+  * NMU to build with python (2.1). Somewhat fixes #109441.
+  * Add postinst/prerm for python-newt to compile/remove .py files.
+    Closes: #117455.
+  * Build Tcl module for tcl8.3.
+  * Call ldconfig, only when configuring.
+  * Make libnewt0 depend on slang1-dev (>= 1.4.4-2) | slang1-utf8-dev
+    (Closes: #115409).
+
+ -- Matthias Klose <doko@debian.org>  Sun, 21 Oct 2001 19:33:50 +0200
+
+newt (0.50.17-7) unstable; urgency=low
+
+  * Changed colors for inactive buttons. (Closes: #99652, #54265, #60855, #61150)
+
+ -- Enrique Zanardi <ezanard@debian.org>  Mon,  4 Jun 2001 10:20:06 +0100
+
+newt (0.50.17-6) unstable; urgency=low
+
+  * Oops, there was a bug in the patch.
+
+ -- Enrique Zanardi <ezanard@debian.org>  Fri, 27 Apr 2001 08:44:37 +0100
+
+newt (0.50.17-5) unstable; urgency=low
+
+  * Some utf8-related fixes (Patch by Edmund Grimley Evans):
+    - remove all use of mbtowc and wctomb, which are evil in a library,
+      as they change an anonymous global state
+    - fix a possible segfault in doReflow() if !resultPtr
+    - remove some historical #if 0 code
+
+ -- Enrique Zanardi <ezanard@debian.org>  Thu, 26 Apr 2001 14:08:49 +0100
+
+newt (0.50.17-4) unstable; urgency=low
+
+  * Rebuilt with utf8 version of slang1. (Closes: #93276)
+
+ -- Enrique Zanardi <ezanard@debian.org>  Fri, 20 Apr 2001 10:02:54 +0100
+
+newt (0.50.17-3) unstable; urgency=low
+
+  * Builds utf8 versions of libnewt and libnewt-pic. (Closes: Bug#91963)
+    Patch by Edmund Grimley Evans.
+
+ -- Enrique Zanardi <ezanard@debian.org>  Wed, 11 Apr 2001 22:17:20 +0100
+
+newt (0.50.17-2) unstable; urgency=low
+
+  * Builds a PIC version of libnewt. (Closes: Bug#91951)
+  * Builds a directory of html files. (Closes: Bug#89906)
+  * Include the right file location in copyright file. (Closes: Bug#91962)
+
+ -- Enrique Zanardi <ezanard@debian.org>  Wed, 11 Apr 2001 20:21:04 +0100
+
+newt (0.50.17-1) unstable; urgency=low
+
+  * New upstream version
+  * Added a "abort signal" callback to libnewt, and a "suspend" callback
+    to whiptail. (Closes: Bug#52952, Bug#61807, Bug#84054)
+  * Closing ancient non-bug (just a difference in the way getopt and popt
+    handle arguments). (Closes: Bug#17786)
+  * Added Build-Depends. (Closes: Bug#70101)
+  * Added patch by Oskar Liljeblad <osk@hem.passagen.se> to handle
+    NEWT_KEY_{HOME,END}. (Closes: Bug#80961)
+
+ -- Enrique Zanardi <ezanard@debian.org>  Sun, 18 Feb 2001 10:32:49 +0000
+
+newt (0.50.8-2) unstable; urgency=low
+
+  * Added -I/usr/include/tcl8.2/ to the list of include dirs for whiptcl
+    and tcl8.2-dev >= 8.2.3-3. (Closes: Bug#67066)
+  * Added --scrolltext description to whiptail.1 manpage (Closes: Bug#75316)
+  * Fixed typo in whiptail.1 manpage (Closes: Bug#75653)
+
+ -- Enrique Zanardi <ezanard@debian.org>  Fri, 27 Oct 2000 09:52:53 +0100
+
+newt (0.50.8-1) unstable; urgency=low
+
+  * New upstream version.
+  * whiptcl doesn't have hardcoded terminal size (Closes: Bug#62252)
+  * Close bugs fixed in NMUs. (Closes: Bug#58059, Bug#47855, Bug#57651,
+    Bug#56710, Bug#58817)
+  * Whiptail remembers the state of the screen and restores it on exit
+    (Closes: Bug#57455)
+  * Latest stable version of newt. (Closes: Bug#52834, Bug#54474)
+
+ -- Enrique Zanardi <ezanard@debian.org>  Wed, 28 Jun 2000 13:38:38 +0100
+
+newt (0.50-7) frozen unstable; urgency=high
+
+  * Ctrl-U must clear the whole buffer! . Closes: Bug#62828
+
+ -- Enrique Zanardi <ezanard@debian.org>  Sat, 22 Apr 2000 13:38:04 +0100
+
+newt (0.50-6) frozen unstable; urgency=low
+
+  * Use "-O2" on compilation to let it build on m68k and get rid of
+  RC bug 59150 as suggested by Bjoern Brill.
+
+ -- Enrique Zanardi <ezanard@debian.org>  Thu, 23 Mar 2000 19:37:15 +0000
+
+newt (0.50-5.4) frozen unstable; urgency=low
+
+  * Non-maintainer upload
+  * Fixes bad cursor position in listboxes, Closes: Bug#58059
+
+ -- Eric Delaunay <delaunay@lix.polytechnique.fr>  Fri, 10 Mar 2000 22:11:16 +0100
+
+newt (0.50-5.3) frozen unstable; urgency=low
+
+  * Non-maintainer upload
+  * Don't install libnewt.a with install -s, Closes: Bug#57651
+
+ -- Wichert Akkerman <wakkerma@debian.org>  Sun, 20 Feb 2000 15:38:54 +0100
+
+newt (0.50-5.2) unstable; urgency=low
+
+  * Non-maintainer upload
+  * Fixes dependency calculation on debian/rules. closes: #53181
+
+ -- Randolph Chung <tausq@debian.org>  Wed, 22 Dec 1999 16:17:56 -0700
+
+newt (0.50-5.1) unstable; urgency=low
+
+  * Non-maintainer upload
+  * Adds clear line feature (c-u) to libnewt. closes: #36587
+  * break lines properly, closes: #43270
+  * Missing "val" in newt.h; "//" in form.c, closes: #47855
+  * Fixes sizing code for menu dialogs, closes: #51019
+  * Fixes whiptail dependencies, closes: #48475, #50165, #50346, #52311
+
+ -- Randolph Chung <tausq@debian.org>  Tue, 14 Dec 1999 21:57:11 -0700
+
+newt (0.50-5) unstable; urgency=low
+
+  * If gpm is not running ignore gpm support.
+
+ -- Enrique Zanardi <ezanard@debian.org>  Sun,  7 Nov 1999 19:59:43 +0000
+
+newt (0.50-4) unstable; urgency=low
+
+  * (finally) enabled gpm support.
+  * fixed whiptail dependencies.
+
+ -- Enrique Zanardi <ezanard@debian.org>  Sat,  9 Oct 1999 22:32:23 +0100
+
+newt (0.50-3) unstable; urgency=low
+
+  * explicitly linked to libdl.
+
+ -- Enrique Zanardi <ezanard@debian.org>  Sat,  9 Oct 1999 21:22:16 +0100
+
+newt (0.50-2) unstable; urgency=low
+
+  * added a Replaces/Conflicts: newt0.25-dev to allow clean upgrades from
+    slink. (Closes: #47025).
+
+ -- Enrique Zanardi <ezanard@debian.org>  Sat,  9 Oct 1999 21:22:16 +0100
+
+newt (0.50-1) unstable; urgency=low
+
+  * new upstream version (Closes: #43427, #45955).
+  * linked to slang 1.3 (Closes: #46951)
+  * stripped debugging symbols from libnewt.a (Closes: #31246).
+  * whiptail is on its own base package (Closes: #36435).
+  * fixed documentation bug about "--clear" (Closes: #24972).
+  * newtRedrawHelpLine() now test for length before memcpy'ng
+  (Closes: #37032, #38602)
+  * manpage updated to describe new options (Closes: #41304).
+  * fixed typo in whiptail output (Closes: #44754).
+  * added support for "password boxes". Patch by Joey Hess
+  <joey@kitenet.net> (Closes: #45961).
+
+ -- Enrique Zanardi <ezanard@debian.org>  Tue,  5 Oct 1999 23:47:17 +0100
+
+newt (0.30-1) unstable; urgency=low
+
+  * New upstream version.
+
+ -- Enrique Zanardi <ezanard@debian.org>  Thu, 10 Dec 1998 14:28:40 +0000
+
+newt (0.25-3) frozen unstable; urgency=low
+
+  * Back ported bugfix from newt-0.30 to make whiptail display messages
+    properly. Without this fix, whiptail doesn't show the last word in a
+    message.
+
+ -- Enrique Zanardi <ezanard@debian.org>  Thu, 10 Dec 1998 12:26:13 +0000
+
+newt (0.25-2) unstable; urgency=low
+
+  * Excluded tcl and python wrappers. Added code to debian/rules and
+    debian/control-snippet to build a new package, newt-scripting, when
+    the wrappers are mature enough.
+
+ -- Enrique Zanardi <ezanard@debian.org>  Mon,  3 Aug 1998 13:52:29 +0100
+
+newt (0.25-1) unstable; urgency=low
+
+  * New upstream version.
+
+ -- Enrique Zanardi <ezanard@debian.org>  Thu, 30 Jul 1998 17:00:39 +0100
+
+newt (0.21-6) unstable; urgency=low
+
+  * debian/shlibs really fixed now.
+
+ -- Enrique Zanardi <ezanardi@molec1.dfis.ull.es>  Wed,  4 Mar 1998 15:38:19 +0000
+
+newt (0.21-5) unstable; urgency=low
+
+  * Install shared lib mode 644.
+  * debian/shlibs file fixed.
+  * updated Standards-Version.
+
+ -- Enrique Zanardi <ezanardi@molec1.dfis.ull.es>  Thu, 12 Feb 1998 11:44:44 +0000
+
+newt (0.21-4) unstable; urgency=low
+
+  * whiptail now has its own package, fixes: Bug#17476
+  * newt0.21-dev now provides and conflicts newt-dev, fixes: Bug#17477
+  * Added whiptail(1) manpage, fixes: Bug#16857
+  * whiptail now uses full screen, fixes: Bug#17155
+  * Defines the dependency on libc*-dev at build-time, fixes: Bug#17208
+
+ -- Enrique Zanardi <ezanardi@molec1.dfis.ull.es>  Sat, 30 Jan 1998 20:14:09 +0000
+
+newt (0.21-3) unstable; urgency=low
+
+  * Defined newtTextboxAddLine.
+
+ -- Enrique Zanardi <ezanardi@molec1.dfis.ull.es>  Sat, 10 Jan 1998 03:18:20 +0000
+
+newt (0.21-2) unstable; urgency=low
+
+  * Added patches by Bruce Perens:
+  *  - whiptail don't make over-size windows.
+  *  - whiptail will scroll the text and/or the menu to fit on the screen.
+  *  - some variables now defined as const.
+
+ -- Enrique Zanardi <ezanardi@molec1.dfis.ull.es>  Wed,  7 Jan 1998 13:42:34 +0000
+
+newt (0.21-1) unstable; urgency=low
+
+  * New upstream version.
+  * Not included python support.
+
+ -- Enrique Zanardi <ezanardi@molec1.dfis.ull.es>  Mon,  5 Jan 1998 16:56:29 +0000
+
+newt (0.10-1) unstable; urgency=low
+
+  * New package.
+
+ -- Enrique Zanardi <ezanardi@molec1.dfis.ull.es>  Fri,  26 Dec 1997 18:58:38 +0000
+
--- newt-0.52.11.orig/debian/TODO
+++ newt-0.52.11/debian/TODO
@@ -0,0 +1,6 @@
+- Figure out #192767 -- why is libnewt0.51 not being included in the
+dependencies for whiptail on !i386?
+
+For the moment this is hard-coded to allow builds to happen.
+
+	- Alastair, 2003-05-12
--- newt-0.52.11.orig/debian/python-newt.examples
+++ newt-0.52.11/debian/python-newt.examples
@@ -0,0 +1,2 @@
+build-tree/*/peanuts.py
+build-tree/*/popcorn.py
--- newt-0.52.11.orig/debian/x.substvars
+++ newt-0.52.11/debian/x.substvars
@@ -0,0 +1 @@
+python:Versions=all
--- newt-0.52.11.orig/debian/libnewt-dev.examples
+++ newt-0.52.11/debian/libnewt-dev.examples
@@ -0,0 +1,3 @@
+build-tree/*/testtree.c
+build-tree/*/test.c
+build-tree/*/testgrid.c
--- newt-0.52.11.orig/debian/pycompat
+++ newt-0.52.11/debian/pycompat
@@ -0,0 +1 @@
+2
--- newt-0.52.11.orig/debian/libnewt-dev.doc-base
+++ newt-0.52.11/debian/libnewt-dev.doc-base
@@ -0,0 +1,4 @@
+build-tree/*/tutorial/t1.html
+build-tree/*/tutorial/x100.html
+build-tree/*/tutorial/x197.html  
+build-tree/*/tutorial/x223.html
--- newt-0.52.11.orig/debian/control
+++ newt-0.52.11/debian/control
@@ -0,0 +1,95 @@
+Source: newt
+Section: devel
+Priority: optional
+Maintainer: Alastair McKinstry <mckinstry@debian.org>
+Standards-Version: 3.8.4
+Homepage: https://fedorahosted.org/newt/
+Vcs-Git: git://git.fedorahosted.org/git/newt
+XS-Python-Version: all
+Build-Depends: dbs, sgmltools-lite, libslang2-dev  (>=2.0.4-2), libpopt-dev, debhelper (>=5.0.37.2), gettext, libfribidi-dev, tcl8.5-dev, python-all-dev (>= 2.3.5-7), python-central (>= 0.5), autoconf, python-all-dbg
+
+Package: libnewt-dev
+Architecture: any
+Section: libdevel
+Priority: optional
+Conflicts: newt0.30-dev, newt0.25-dev, libnewt-utf8-dev
+Replaces: newt0.30-dev, newt0.25-dev, libnewt-utf8-dev
+Depends: ${shlibs:Depends}, ${libcdev}, libslang2-dev (>= 2.0.2), libnewt0.52 (=${binary:Version}), ${misc:Depends}
+Description: Developer's toolkit for newt windowing library
+ These are the header files and libraries for developing applications
+ which use newt. Newt is a windowing toolkit for text mode, which provides
+ many widgets and stackable windows.
+
+Package: libnewt-pic
+Architecture: any
+Section: libdevel
+Priority: extra
+Depends: libnewt-dev (=${binary:Version}), ${misc:Depends}
+Conflicts: libnewt-utf8-pic
+Replaces: libnewt-utf8-pic
+Description: Not Erik's Windowing Toolkit, shared library subset kit
+ This is used to develop subsets of the newt shared libraries for use on
+ custom installation floppies and in embedded systems. Unless you're
+ making one of those, you won't need this package.
+
+Package: newt-tcl
+Architecture: any
+Section: interpreters
+Priority: extra
+Depends: libnewt0.52 (=${binary:Version}) , tcl8.3 | tcl8.4 | tcl8.5, ${misc:Depends}, ${shlibs:Depends}
+Description: A newt module for Tcl
+ This module allows you to build a text UI for your Tcl scripts
+ using newt.
+
+Package: python-newt
+Architecture: any
+Section: python
+Priority: optional
+XB-Python-Version: ${python:Versions}
+Provides: ${python:Provides}
+Depends: libnewt0.52 (=${binary:Version}) , ${python:Depends}, ${misc:Depends}, ${shlibs:Depends}
+Description: A NEWT module for Python
+ This module allows you to built a text UI for your Python scripts
+ using newt.
+
+Package: python-newt-dbg
+Architecture: any
+Section: debug
+Priority: extra
+Depends: libnewt0.52 (=${binary:Version}), python-newt (=${binary:Version}), python-dbg, ${misc:Depends}, ${shlibs:Depends}
+Description: A NEWT module for Python (debug extension)
+ This module allows you to built a text UI for your Python scripts
+ using newt.
+ .
+ This package contains the extension built for the Python debug interpreter.
+
+
+Package: libnewt0.52
+Architecture: any
+Section: libs
+Priority: important
+Replaces: libnewt-utf8, libnewt0, libnewt0.51
+Conflicts: libnewt0.51
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Recommends: libfribidi0
+Description: Not Erik's Windowing Toolkit - text mode windowing with slang
+ Newt is a windowing toolkit for text mode built from the slang library.
+ It allows color text mode applications to easily use stackable windows,
+ push buttons, check boxes, radio buttons, lists, entry fields, labels,
+ and displayable text. Scrollbars are supported, and forms may be nested
+ to provide extra functionality. This package contains the shared library
+ for programs that have been built with newt.
+
+Package: whiptail
+Architecture: any
+Section: utils
+Priority: important
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Replaces: newt0.10, newt0.21 (<< 0.21-4), whiptail-utf8
+Conflicts: whiptail-provider
+Provides: whiptail-provider, whiptail-utf8
+Description: Displays user-friendly dialog boxes from shell scripts
+ Whiptail is a "dialog" replacement using newt instead of ncurses. It
+ provides a method of displaying several different types of dialog boxes
+ from shell scripts. This allows a developer of a script to interact with
+ the user in a much friendlier manner.
--- newt-0.52.11.orig/debian/python-newt.prerm
+++ newt-0.52.11/debian/python-newt.prerm
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+set -e
+
+#DEBHELPER#
--- newt-0.52.11.orig/debian/test-newt.sh
+++ newt-0.52.11/debian/test-newt.sh
@@ -0,0 +1,9 @@
+#!/bin/bash 
+# the following should work 
+set -x
+
+whiptail --msgbox 'hoge a You are a normal test' 10 20
+whiptail --msgbox 'hoge a You are a normal test' 10 20
+whiptail --msgbox ha 1 4
+whiptail --msgbox ha 1 5
+
--- newt-0.52.11.orig/debian/whiptail.install
+++ newt-0.52.11/debian/whiptail.install
@@ -0,0 +1 @@
+whiptail	usr/bin
--- newt-0.52.11.orig/debian/libnewt-dev.docs
+++ newt-0.52.11/debian/libnewt-dev.docs
@@ -0,0 +1 @@
+newt.spec
--- newt-0.52.11.orig/debian/newt-tcl.install
+++ newt-0.52.11/debian/newt-tcl.install
@@ -0,0 +1 @@
+whiptcl.so usr/lib/whiptcl
--- newt-0.52.11.orig/debian/libnewt-pic.install
+++ newt-0.52.11/debian/libnewt-pic.install
@@ -0,0 +1 @@
+libnewt_pic.a	usr/lib
--- newt-0.52.11.orig/debian/README.Debian
+++ newt-0.52.11/debian/README.Debian
@@ -0,0 +1,11 @@
+Note that libnewt ships with some locale files.
+These are not used by libnewt directly, but by whiptail, and its
+derivatives newt-tcl and python-newt. It is simpler to include
+them in the library, which is required by the other packages, than to create
+a package exclusively for these small files.
+
+Debian's version of newt include Bidirectional text support not yet present
+upstream, including an API addition "newtCheckboxSetWidth". Please only use
+this within Debian until it is supported upstream.
+
+- Alastair McKinstry <mckinstry@debian.org>
--- newt-0.52.11.orig/debian/README.whiptail
+++ newt-0.52.11/debian/README.whiptail
@@ -0,0 +1,14 @@
+whiptail(1) is a lightweight replacement for dialog(1),
+to provide dialog boxes for shell scripts. It is built on the 
+newt windowing library rather than the ncurses library, allowing
+it to be smaller in embedded enviroments such as installers,
+rescue disks, etc.
+
+whiptail is designed to be drop-in compatible with dialog, but
+has less features: some dialog boxes are not implemented, such
+as tailbox, timebox, calendarbox, etc.
+
+Please see the whiptail(1) man page for details.
+
+Regards,
+Alastair McKinstry, 2003-06-08.
--- newt-0.52.11.orig/debian/libnewt0.52.postinst
+++ newt-0.52.11/debian/libnewt0.52.postinst
@@ -0,0 +1,4 @@
+#!/bin/sh
+set -e
+
+#DEBHELPER#
--- newt-0.52.11.orig/debian/libnewt0.52.install
+++ newt-0.52.11/debian/libnewt0.52.install
@@ -0,0 +1 @@
+libnewt.so*	usr/lib
--- newt-0.52.11.orig/debian/copyright
+++ newt-0.52.11/debian/copyright
@@ -0,0 +1,16 @@
+This is the Debian version of the newt library.
+newt was written by Erik Troan <ewt@redhat.com>.
+
+The original package was put together by Enrique Zanardi
+<ezanard@debian.org>, from sources obtained from:
+  ftp://ftp.redhat.com/pub/redhat/redhat-7.0-en/os/i386/SRPMS/newt-0.50.17-1.src.rpm
+Recent upstream versions can be found at: http://fedora.redhat.com/
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+newt is available under the terms of the GNU Library General Public
+License, version 2. On Debian GNU/Linux systems, the complete text of this
+license can be found in `/usr/share/common-licenses/LGPL-2'.
--- newt-0.52.11.orig/debian/rules
+++ newt-0.52.11/debian/rules
@@ -0,0 +1,270 @@
+#!/usr/bin/make -f
+#
+# Created 20 December 1997 by Enrique Zanardi <ezanardi@ull.es>
+# Modified 2002-2004 by Alastair McKinstry, <mckinstry@debian.org>
+#
+# Copying and modification is unlimited, provided that the modified
+# version is marked as being modified.
+
+# Uncomment this to turn on verbose mode.
+# export DH_VERBOSE=1
+
+
+DEB_HOST_GNU_TYPE=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE=$(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+ifneq ($(DEB_HOST_GNU_TYPE), $(DEB_BUILD_GNU_TYPE))
+CROSS=--build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
+CROSSCC=$(DEB_HOST_GNU_TYPE)-gcc
+else
+CROSS=
+CROSSCC=gcc
+endif
+
+VERSION=0.52.11
+SONAME=0.52
+PYVERS=$(shell pyversions -vr debian/control)
+
+LIB_PKG=libnewt$(SONAME)
+DEV_PKG=libnewt-dev
+PIC_PKG=libnewt-pic
+TCL_PKG=newt-tcl
+PYTHON_PKG=python-newt
+PYTHON_DBG_PKG=python-newt-dbg
+WHIPTAIL_PKG=whiptail
+
+# the dbs rules
+TAR_DIR=newt-$(VERSION)
+include /usr/share/dbs/dbs-build.mk
+
+ifeq (,$(DEB_HOST_ARCH_OS))
+ include /usr/share/dbs/dpkg-arch.mk
+endif
+
+DEB_HOST_ARCH_OS  ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
+DEB_HOST_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
+
+# get the items created here.
+binarytarget=binary-devel binary-shared binary-runtime binary-tcl \
+	binary-python binary-python-dbg binary-pic 
+
+#target specific configurations come here:
+LIBCDEV=libc-dev
+GPMSUPPORT= --with-gpm-support
+
+ifneq ($(DEB_HOST_ARCH_OS),linux)
+LIBCDEV=libc6-dev
+ifeq ($(DEB_HOST_ARCH_CPU),alpha)
+LIBCDEV=libc6.1-dev
+endif
+ifeq ($(DEB_HOST_ARCH_CPU),ia64)
+LIBCDEV=libc6.1-dev
+endif
+endif
+
+ifeq ($(DEB_HOST_ARCH_OS),hurd)
+GPMSUPPORT=
+LIBCDEV=libc0.3-dev
+endif
+
+ifeq ($(DEB_HOST_ARCH_OS),kfreebsd)
+LIBCDEV=libc0.1-dev
+endif
+
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+NOSTRIP=--with-nostrip=no
+else
+NOSTRIP=--with-nostrip=yes
+endif
+
+build-stamp=$(STAMP_DIR)/build-stamp
+configure-stamp=$(STAMP_DIR)/configure-stamp
+
+$(configure-stamp):  $(patched)
+	dh_testdir
+	cp newt.spec $(BUILD_TREE)
+	rm -f $(BUILD_TREE)/.depend
+	( cd $(BUILD_TREE) && autoconf --force -i )
+	( cd $(BUILD_TREE) && ./configure --prefix=/usr  $(GPMSUPPORT) $(NOSTRIP) $(CROSS) )
+	touch $@
+
+build: $(build-stamp)
+$(build-stamp): $(configure-stamp)
+	dh_testdir
+	( cd $(BUILD_TREE) && sgmltools --backend html tutorial.sgml )
+	CC=$(CROSSCC) $(MAKE) -C $(BUILD_TREE)
+	( cd $(BUILD_TREE) && ar cqv libnewt_pic.a shared/*.o )
+	# build POT file for translators
+	make -C $(BUILD_TREE)/po newt.pot
+	touch $@
+
+clean:
+	dh_testdir
+	dh_testroot
+	dh_clean 
+	rm -rf $(SOURCE_DIR) $(STAMP_DIR)
+	rm -f debian/python-newt*.dirs debian/python-newt*.install debian/python-newt.postinst
+	# rm -rf   debian/substvars debian/*.bak debian/*~ *~ 
+
+binary: binary-indep binary-arch
+
+binary-indep:
+
+binary-arch: $(LIB_PKG) $(DEV_PKG) $(PIC_PKG) $(TCL_PKG) $(PYTHON_PKG) $(PYTHON_DBG_PKG) $(WHIPTAIL_PKG)
+
+$(LIB_PKG): build
+	dh_testdir
+	dh_testroot 
+	dh_installdirs -p $@ 
+	dh_install -p $@ --sourcedir=$(BUILD_TREE)
+	# chmod +x $(BUILD_TREE)/mkinstalldirs
+	CC=$(CROSSCC) $(MAKE) -C $(BUILD_TREE)/po datadir=../../../debian/$(LIB_PKG)/usr/share HAVE_XGETTEXT=yes install
+	dh_strip -p $@
+	dh_makeshlibs -p $@
+	dh_shlibdeps -L $(LIB_PKG) -l debian/$@/usr/lib
+	dh_installdocs -p $@  
+	dh_link -p $@  /usr/lib/libnewt.so.$(VERSION) /usr/lib/libnewt.so.$(SONAME)
+	rm debian/$@/usr/lib/libnewt.so
+	# Currently disabled, as debian-test has been removed.
+	# chmod +x debian/whiptail/usr/lib/debian-test/tests/whiptail/test-newt.sh/test-newt.sh
+	dh_installchangelogs -p $@ 
+	dh_compress -p $@
+	dh_installdeb  -p $@
+	dh_fixperms -p $@
+	dh_gencontrol -p $@ 
+	dh_md5sums -p $@
+	dh_builddeb -p $@
+
+$(PIC_PKG): build
+	dh_testdir
+	dh_testroot 
+	dh_installdirs -p $@
+	dh_install -p $@ --sourcedir=$(BUILD_TREE)
+	cp $(BUILD_TREE)/newt*.ver debian/libnewt-pic/usr/lib/libnewt_pic.map
+	dh_strip -p $@
+	dh_makeshlibs -p $@
+	dh_installdocs -p $@  -p $@ $(BUILD_TREE)/newt.spec
+	# Currently disabled, as debian-test has been removed.
+	# chmod +x debian/whiptail/usr/lib/debian-test/tests/whiptail/test-newt.sh/test-newt.sh
+	dh_installchangelogs -p $@ 
+	dh_compress -p $@
+	dh_shlibdeps -p $@  -ldebian/$@/usr/lib
+	dh_fixperms -p $@
+	dh_installdeb  -p $@
+	dh_gencontrol -p $@ 
+	dh_md5sums -p $@
+	dh_builddeb -p $@
+
+$(DEV_PKG): build
+	dh_testdir
+	dh_testroot 
+	dh_installdirs -p $@
+	dh_install -p $@ --sourcedir=$(BUILD_TREE)
+	dh_strip -p $@
+	dh_makeshlibs -p $@
+	dh_installdocs -p $@  -p $@ $(BUILD_TREE)/newt.spec
+	dh_link -p $@ /usr/lib/libnewt.so.$(VERSION) /usr/lib/libnewt.so
+	dh_link -p $@ \
+	  /usr/share/doc/libnewt-dev/tutorial.html/t1.html \
+	  /usr/share/doc/libnewt-dev/tutorial.html/index.html	
+	# Currently disabled, as debian-test has been removed.
+	# chmod +x debian/whiptail/usr/lib/debian-test/tests/whiptail/test-newt.sh/test-newt.sh
+	dh_installchangelogs -p $@
+	dh_installexamples -p $@ 
+	dh_compress -p $@
+	dh_shlibdeps -p $@ -ldebian/$@/usr/lib
+	dh_fixperms -p $@
+	dh_installdeb  -p $@
+	dh_gencontrol -p $@ 
+	dh_md5sums -p $@
+	dh_builddeb -p $@
+
+$(TCL_PKG): build
+	dh_testdir
+	dh_testroot 
+	dh_installdirs -p $@
+	dh_install -p $@ --sourcedir=$(BUILD_TREE)
+	dh_strip -p $@
+	dh_makeshlibs -p $@
+	dh_installdocs -p $@  -p $@ $(BUILD_TREE)/newt.spec
+	# Currently disabled, as debian-test has been removed.
+	# chmod +x debian/whiptail/usr/lib/debian-test/tests/whiptail/test-newt.sh/test-newt.sh
+	dh_installchangelogs -p $@ 
+	dh_compress -p $@
+	dh_shlibdeps -p $@ -ldebian/$@/usr/lib
+	dh_fixperms -p $@
+	dh_installdeb  -p $@
+	dh_gencontrol -p $@ 
+	dh_md5sums -p $@
+	dh_builddeb -p $@
+
+$(PYTHON_PKG): build
+	dh_testdir
+	dh_testroot 
+	for v in $(PYVERS); do \
+		pylib=$$(python$$v -c 'from distutils import sysconfig; print sysconfig.get_python_lib()'); \
+		echo $$pylib >> debian/$@.dirs; \
+		echo python$$v/_snackmodule.so $$pylib/ \
+		>> debian/$@.install; \
+		echo snack.py $$pylib \
+		>> debian/$@.install; \
+	done
+	dh_installdirs -p $@ 
+	dh_install -p $@ --sourcedir=$(BUILD_TREE)
+	dh_strip -p $@ --dbg-package python-newt-dbg
+	DH_PYCENTRAL=include-links dh_pycentral -p $@
+	dh_installdocs -p $@ $(BUILD_TREE)/newt.spec
+	# Currently disabled, as debian-test has been removed.
+	# chmod +x debian/whiptail/usr/lib/debian-test/tests/whiptail/test-newt.sh/test-newt.sh
+	dh_installchangelogs -p $@ 
+	dh_installexamples -p $@
+	dh_compress -p $@
+	dh_shlibdeps -p $@ -ldebian/$@/usr/lib
+	dh_fixperms -p $@
+	dh_installdeb  -p $@
+	dh_gencontrol -p $@ 
+	dh_md5sums -p $@
+	dh_builddeb -p $@
+
+$(PYTHON_DBG_PKG): build $(PYTHON_PKG)
+	dh_testdir
+	dh_testroot 
+	for v in $(PYVERS); do \
+		pylib=$$(python$$v -c 'from distutils import sysconfig; print sysconfig.get_python_lib()'); \
+		echo $$pylib >> debian/$@.dirs; \
+		echo python$$v/_snackmodule_d.so $$pylib/ \
+		>> debian/$@.install; \
+	done
+	dh_installdirs -p $@ 
+	dh_install -p $@ --sourcedir=$(BUILD_TREE)
+	DH_PYCENTRAL=include-links dh_pycentral -p $@
+	mkdir -p debian/python-newt-dbg/usr/share/doc
+	ln -sf python-newt debian/python-newt-dbg/usr/share/doc/python-newt-dbg
+	dh_compress -p $@
+	dh_shlibdeps -p $@ -ldebian/$@/usr/lib
+	dh_fixperms -p $@
+	dh_installdeb -p $@
+	dh_gencontrol -p $@ 
+	dh_md5sums -p $@
+	dh_builddeb -p $@
+
+$(WHIPTAIL_PKG): build
+	dh_testdir
+	dh_testroot 
+	dh_installdirs -p $@
+	dh_install -p $@ --sourcedir=$(BUILD_TREE)
+	dh_strip -p $@
+	dh_makeshlibs   -V
+	dh_installdocs -p $@  -p $@ $(BUILD_TREE)/newt.spec debian/README.whiptail
+	dh_installman -p $@ $(BUILD_TREE)/whiptail.1
+	# Currently disabled, as debian-test has been removed.
+	# chmod +x debian/whiptail/usr/lib/debian-test/tests/whiptail/test-newt.sh/test-newt.sh
+	dh_installchangelogs -p $@
+	dh_compress -p $@
+	dh_shlibdeps -p $@  -L $(LIB_PKG) -l debian/$(LIB_PKG)/usr/lib
+	dh_fixperms -p $@
+	dh_installdeb  -p $@
+	dh_gencontrol -p $@ 
+	dh_md5sums -p $@
+	dh_builddeb -p $@
+
+.PHONY: binary-arch clean source diff  binary binary-indep
--- newt-0.52.11.orig/debian/libnewt-dev.install
+++ newt-0.52.11/debian/libnewt-dev.install
@@ -0,0 +1,4 @@
+libnewt.a	usr/lib
+newt.h		usr/include
+libnewt.pc	usr/lib/pkgconfig
+tutorial/*	usr/share/doc/libnewt-dev/tutorial.html
--- newt-0.52.11.orig/debian/compat
+++ newt-0.52.11/debian/compat
@@ -0,0 +1 @@
+5
--- newt-0.52.11.orig/debian/libnewt0.52.postrm
+++ newt-0.52.11/debian/libnewt0.52.postrm
@@ -0,0 +1,4 @@
+#!/bin/sh
+set -e
+
+#DEBHELPER#
--- newt-0.52.11.orig/debian/old-patches/720_newt_combiwrap.patch
+++ newt-0.52.11/debian/old-patches/720_newt_combiwrap.patch
@@ -0,0 +1,50 @@
+Description: Text incorrectly wrapping at combining characters
+Bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=570630
+Author: Theppitak Karoonboonyanan
+
+diff -ruN8p newt-0.52.11-old/textbox.c newt-0.52.11/textbox.c
+--- newt-0.52.11-old/textbox.c	2010-02-20 21:22:43.000000000 +0700
++++ newt-0.52.11/textbox.c	2010-02-20 21:23:04.000000000 +0700
+@@ -205,34 +205,36 @@ static void doReflow(const char * text,
+ 		fprintf(stderr,"adding %d\n",((width / 2) - (len)) / 2);
+ #endif					
+ 		    howbad += ((width / 2) - (len)) / 2;
+ 		}
+ 		text = end;
+ 		if (*text) text++;
+ 	    } else {
+ 		const char *spcptr = NULL;
+-	        int spc =0,w2, x;
++	        int spc =0,w2, x, w;
+ 
+ 	        chptr = text;
+ 		w2 = 0;
+-		for (i = 0; i < width - 1;) {
++		for (i = 0; ;) {
+ 			if ((x=mbrtowc(&tmp,chptr,end-chptr,&ps))<=0)
+ 				break;
++			w = wcwidth(tmp);
++			if (w>0)
++			    i+=w;
++			if (i >= width)
++			    break;
+ 		        if (spc && !iswspace(tmp))
+ 				spc = 0;
+ 			else if (!spc && iswspace(tmp)) {
+ 				spc = 1;
+ 				spcptr = chptr;
+ 				w2 = i;
+ 			}
+ 			chptr += x;
+-			x = wcwidth(tmp);
+-			if (x>0)
+-			    i+=x;
+ 		}
+ 		howbad += width - w2 + 1;
+ #ifdef DEBUG_WRAP		    
+ 		fprintf(stderr,"adding %d\n",width - w2 + 1, chptr);
+ #endif					
+ 		if (spcptr) chptr = spcptr;
+ 		if (result) {
+ 		    strncat(result, text, chptr - text );
+
--- newt-0.52.11.orig/debian/old-patches/620_asturian.patch
+++ newt-0.52.11/debian/old-patches/620_asturian.patch
@@ -0,0 +1,73 @@
+diff -ruN newt-0.52.11-old/po/ast.po newt-0.52.11/po/ast.po
+--- newt-0.52.11-old/po/ast.po	2009-12-18 02:18:12.000000000 +0000
++++ newt-0.52.11/po/ast.po	2009-12-18 02:15:00.000000000 +0000
+@@ -1,34 +1,35 @@
+-# Spanish translations for newt
+-# Copyright (C) 2003 Free Software Foundation
+-# This file is distributed under the same license as the newt package.
+-# Alastair McKinstry <mckinstry@debian.org>, 2003
+-msgid ""
+-msgstr ""
+-"Project-Id-Version: newt 0.51.4\n"
+-"Report-Msgid-Bugs-To: mckinstry@debian.org\n"
+-"POT-Creation-Date: 2005-11-22 09:35+0100\n"
+-"PO-Revision-Date: 2009-03-09 07:36+0100\n"
+-"Last-Translator: Marcos Alvarez Costales <marcos.alvarez.costales@gmail.com>\n"
+-"Language-Team: Spanish <es@li.org>\n"
+-"MIME-Version: 1.0\n"
+-"Content-Type: text/plain; charset=ISO-8859-15\n"
+-"Content-Transfer-Encoding: 8bit\n"
+-
+-#: dialogboxes.c:43
+-#: dialogboxes.c:48
+-#: dialogboxes.c:493
+-msgid "Ok"
+-msgstr "Aceutar"
+-
+-#: dialogboxes.c:51
+-msgid "Cancel"
+-msgstr "Encaboxar"
+-
+-#: dialogboxes.c:498
+-msgid "Yes"
+-msgstr "Sí"
+-
+-#: dialogboxes.c:500
+-msgid "No"
+-msgstr "Non"
+-
++# Newt Debian.
++# Copyright (C) 2009
++# This file is distributed under the same license as the PACKAGE package.
++# Marcos <marcos.alvarez.costales@gmail.com>, 2009.
++#
++msgid ""
++msgstr ""
++"Project-Id-Version: Newt Debian\n"
++"Report-Msgid-Bugs-To: \n"
++"POT-Creation-Date: 2006-09-14 16:03+0200\n"
++"PO-Revision-Date: 2009-07-28 08:13+0100\n"
++"Last-Translator: Marcos <marcos.alvarez.costales@gmail.com>\n"
++"Language-Team: Asturian <alministradores@softastur.org>\n"
++"MIME-Version: 1.0\n"
++"Content-Type: text/plain; charset=utf-8\n"
++"Content-Transfer-Encoding: 8bit\n"
++
++#: ../dialogboxes.c:43
++#: ../dialogboxes.c:48
++#: ../dialogboxes.c:493
++msgid "Ok"
++msgstr "Aceutar"
++
++#: ../dialogboxes.c:51
++msgid "Cancel"
++msgstr "Encaboxar"
++
++#: ../dialogboxes.c:498
++msgid "Yes"
++msgstr "Sí"
++
++#: ../dialogboxes.c:500
++msgid "No"
++msgstr "Non"
++
--- newt-0.52.11.orig/debian/patches/360-python-dbg.patch
+++ newt-0.52.11/debian/patches/360-python-dbg.patch
@@ -0,0 +1,20 @@
+diff -ruN newt-0.52.11-old/Makefile.in newt-0.52.11/Makefile.in
+--- newt-0.52.11-old/Makefile.in	2009-04-30 14:37:20.000000000 +0200
++++ newt-0.52.11/Makefile.in	2009-04-30 14:39:08.000000000 +0200
+@@ -72,6 +72,8 @@
+ 	    	mkdir -p $$ver ;\
+ 	        $(CC) $(CFLAGS) -I/usr/include/$$ver $(SHCFLAGS) -c -o $$ver/snackmodule.o snackmodule.c ;\
+ 		$(CC) --shared $(SHCFLAGS) -o $$ver/_snackmodule.so $$ver/snackmodule.o -L .  -lnewt ;\
++	        $(CC) $(subst -O2,-O0,$(CFLAGS)) -I/usr/include/$${ver}_d -fPIC -c -o $$ver/snackmodule_d.o snackmodule.c ;\
++		$(CC) --shared $(SHCFLAGS) -o $$ver/_snackmodule_d.so $$ver/snackmodule_d.o -L .  -lnewt  ;\
+ 	done
+ 	touch $@
+ 
+@@ -130,6 +132,7 @@
+ 	for ver in $(PYTHONVERS) ; do \
+ 	   [ -d $(instroot)/$(libdir)/$$ver/site-packages ] || install -m 755 -d $(instroot)/$(libdir)/$$ver/site-packages ;\
+ 	   install -m 755 $$ver/_snackmodule.so $(instroot)/$(libdir)/$$ver/site-packages ;\
+++	   install -m 755 $$ver/_snackmodule_d.so $(instroot)/$(libdir)/$$ver/site-packages ;\
+ 	   install -m 644 snack.py $(instroot)/$(libdir)/$$ver/site-packages ;\
+ 	done
+ 
--- newt-0.52.11.orig/debian/patches/610_bengali.patch
+++ newt-0.52.11/debian/patches/610_bengali.patch
@@ -0,0 +1,48 @@
+diff -ruN newt-0.52.11-old/po/bn.po newt-0.52.11/po/bn.po
+--- newt-0.52.11-old/po/bn.po	2008-07-30 13:42:55.000000000 +0100
++++ newt-0.52.11/po/bn.po	2009-12-18 02:09:59.000000000 +0000
+@@ -2,31 +2,33 @@
+ # Copyright (C) 2005, Debian Foundation.
+ # This file is distributed under the same license as the Newt_Newt package. 
+ # Progga <progga@BengaLinux.Org>, 2005.
+-#
++# Md. Rezwan Shahid <rezwan@ankur.org.bd>, 2009.
+ msgid ""
+ msgstr ""
+ "Project-Id-Version: Newt_Newt HEAD\n"
+-"Report-Msgid-Bugs-To: \n"
+-"POT-Creation-Date: 2006-09-14 16:03+0200\n"
+-"PO-Revision-Date: 2005-11-20 19:00+0600\n"
+-"Last-Translator: Progga <progga@BengaLinux.Org>\n"
+-"Language-Team: Bangla <core@BengaLinux.Org>\n"
++"Report-Msgid-Bugs-To: mckinstry@debian.org\n"
++"POT-Creation-Date: 2005-11-22 09:35+0100\n"
++"PO-Revision-Date: 2009-04-19 10:29+0600\n"
++"Last-Translator: Md. Rezwan Shahid <rezwan@ankur.org.bd>\n"
++"Language-Team: Bengali <ankur-bd-l10n@googlegroups.com>\n"
+ "MIME-Version: 1.0\n"
+-"Content-Type: text/plain; charset=UTF-8\n"
++"Content-Type: text/plain; charset=UTf-8\n"
+ "Content-Transfer-Encoding: 8bit\n"
++"Plural-Forms: nplurals=2; plural=(n != 1);\n"
++"X-Generator: WordForge 0.5-beta1\n"
+ 
+-#: ../dialogboxes.c:43 ../dialogboxes.c:48 ../dialogboxes.c:493
++#: dialogboxes.c:43 dialogboxes.c:48 dialogboxes.c:493
+ msgid "Ok"
+ msgstr "ঠিক আছে"
+ 
+-#: ../dialogboxes.c:51
++#: dialogboxes.c:51
+ msgid "Cancel"
+ msgstr "বাতিল"
+ 
+-#: ../dialogboxes.c:498
++#: dialogboxes.c:498
+ msgid "Yes"
+ msgstr "হ্যাঁ"
+ 
+-#: ../dialogboxes.c:500
++#: dialogboxes.c:500
+ msgid "No"
+ msgstr "না"
--- newt-0.52.11.orig/debian/patches/030_tcl8.5.patch
+++ newt-0.52.11/debian/patches/030_tcl8.5.patch
@@ -0,0 +1,25 @@
+diff -ruN newt-0.52.11-old/Makefile.in newt-0.52.11/Makefile.in
+--- newt-0.52.11-old/Makefile.in	2009-04-20 21:44:14.000000000 +0100
++++ newt-0.52.11/Makefile.in	2009-04-20 21:49:26.000000000 +0100
+@@ -1,10 +1,10 @@
+ LIBS = -lslang
+-LIBTCL = -ltcl8.4
++LIBTCL = -ltcl8.5
+ 
+ CC = @CC@
+ CPP = @CPP@
+ CFLAGS = @CFLAGS@
+-CPPFLAGS = -D_GNU_SOURCE -I/usr/include/slang @CPPFLAGS@ 
++CPPFLAGS = -D_GNU_SOURCE -I/usr/include/slang -I/usr/include/tcl8.5@CPPFLAGS@ 
+ 
+ SHLIBFLAGS= -Wl,--version-script,newt.0.52.ver
+ VERSION = @VERSION@
+@@ -49,7 +49,7 @@
+ TARGET=depend $(PROGS)
+ endif
+ 
+-all:	$(TARGET) _snackmodule.so
++all:	$(TARGET) _snackmodule.so whiptcl.so
+ 
+ test:	test.o $(LIBNEWT)
+ 	$(CC) -g -o test test.o $(LIBNEWT) $(LIBS)
--- newt-0.52.11.orig/debian/patches/630_italian.patch
+++ newt-0.52.11/debian/patches/630_italian.patch
@@ -0,0 +1,44 @@
+diff -ruN newt-0.52.11-old/po/it.po newt-0.52.11/po/it.po
+--- newt-0.52.11-old/po/it.po	2008-07-30 13:42:55.000000000 +0100
++++ newt-0.52.11/po/it.po	2009-12-18 02:17:46.000000000 +0000
+@@ -1,23 +1,23 @@
+ # Italian translations for newt
+-# Copyright (C) 2003 Free Software Foundation
++# Copyright (C) 2003-2009 Free Software Foundation
+ # This file is distributed under the same license as the newt package.
+ # Giuseppe Sacco <eppesuig@debian.org>, 2004.
+-#
++# Milo Casagrande <milo@ubuntu.com>, 2009.
+ msgid ""
+ msgstr ""
+-"Project-Id-Version: newt 0.51.4\n"
++"Project-Id-Version: newt\n"
+ "Report-Msgid-Bugs-To: \n"
+ "POT-Creation-Date: 2006-09-14 16:03+0200\n"
+-"PO-Revision-Date: 2003-07-19 11:25+0100\n"
+-"Last-Translator: Giuseppe Sacco <eppesuig@debian.org>\n"
+-"Language-Team: Debian Italian <debian-l10n-italian@lists.debian.org>\n"
++"PO-Revision-Date: 2009-12-04 22:23+0100\n"
++"Last-Translator: Milo Casagrande <milo@ubuntu.com>\n"
++"Language-Team: Italian <tp@lists.linux.it>\n"
+ "MIME-Version: 1.0\n"
+-"Content-Type: text/plain; charset=ISO-8859-1\n"
++"Content-Type: text/plain; charset=UTF-8\n"
+ "Content-Transfer-Encoding: 8bit\n"
+ 
+ #: ../dialogboxes.c:43 ../dialogboxes.c:48 ../dialogboxes.c:493
+ msgid "Ok"
+-msgstr "Ok"
++msgstr "OK"
+ 
+ #: ../dialogboxes.c:51
+ msgid "Cancel"
+@@ -25,7 +25,7 @@
+ 
+ #: ../dialogboxes.c:498
+ msgid "Yes"
+-msgstr "Sì"
++msgstr "Sì"
+ 
+ #: ../dialogboxes.c:500
+ msgid "No"
--- newt-0.52.11.orig/debian/patches/020_bidi.patch
+++ newt-0.52.11/debian/patches/020_bidi.patch
@@ -0,0 +1,2160 @@
+diff -ruN newt-0.52.11-old/button.c newt-0.52.11/button.c
+--- newt-0.52.11-old/button.c	2009-09-24 16:03:09.000000000 +0100
++++ newt-0.52.11/button.c	2010-06-21 13:12:53.000000000 +0100
+@@ -113,7 +113,7 @@
+ 	    SLsmg_set_color(NEWT_COLORSET_ACTBUTTON);
+ 	newtGotorc(co->top+ pushed, co->left + 1 + pushed);
+ 	SLsmg_write_char('<');
+-	SLsmg_write_string(bu->text);
++	write_string_int(bu->text, NULL);
+ 	SLsmg_write_char('>');
+     } else {
+ 	if (pushed) {
+@@ -145,7 +145,7 @@
+ 
+     newtGotorc(co->top + 1 + pushed, co->left + 1 + pushed);
+     SLsmg_write_char(' ');
+-    SLsmg_write_string(bu->text);
++    write_string_int(bu->text, NULL);
+     SLsmg_write_char(' ');
+ }
+ 
+diff -ruN newt-0.52.11-old/checkbox.c newt-0.52.11/checkbox.c
+--- newt-0.52.11-old/checkbox.c	2009-09-24 16:03:09.000000000 +0100
++++ newt-0.52.11/checkbox.c	2010-06-21 13:12:53.000000000 +0100
+@@ -210,7 +210,7 @@
+ 	break;
+     }
+ 
+-    SLsmg_write_string(cb->text);
++    write_string_int(cb->text, NULL);
+ 
+     if (cb->hasFocus)
+ 	SLsmg_set_color(cb->active);
+diff -ruN newt-0.52.11-old/checkboxtree.c newt-0.52.11/checkboxtree.c
+--- newt-0.52.11-old/checkboxtree.c	2009-09-24 16:03:09.000000000 +0100
++++ newt-0.52.11/checkboxtree.c	2010-06-21 13:12:53.000000000 +0100
+@@ -491,7 +491,7 @@
+ 	    currRow = co->top + i;
+ 	}
+ 
+-	SLsmg_write_nstring((*item)->text, co->width - 4 - (3 * (*item)->depth));
++        write_nstring_int((*item)->text, co->width - 4 - (3 * (*item)->depth), NULL);
+ 
+ 	item++;
+ 	i++;
+diff -ruN newt-0.52.11-old/config.h.in newt-0.52.11/config.h.in
+--- newt-0.52.11-old/config.h.in	2009-09-24 16:04:29.000000000 +0100
++++ newt-0.52.11/config.h.in	2010-06-21 13:12:53.000000000 +0100
+@@ -6,6 +6,12 @@
+ /* Define to 1 if you have the <alloca.h> header file. */
+ #undef HAVE_ALLOCA_H
+ 
++/* Define if you have the <dlfcn.h> header file.  */
++#undef HAVE_DLFCN_H
++ 
++/* Define if you have the <fribidi/fribidi.h> header file.  */
++#undef HAVE_FRIBIDI_FRIBIDI_H
++
+ /* Define to 1 if you have the <inttypes.h> header file. */
+ #undef HAVE_INTTYPES_H
+ 
+diff -ruN newt-0.52.11-old/configure.ac newt-0.52.11/configure.ac
+--- newt-0.52.11-old/configure.ac	2009-09-24 16:03:09.000000000 +0100
++++ newt-0.52.11/configure.ac	2010-06-21 13:12:53.000000000 +0100
+@@ -14,7 +14,7 @@
+ AC_PROG_INSTALL
+ AC_PROG_LN_S
+ 
+-AC_CHECK_HEADERS([sys/select.h alloca.h])
++AC_CHECK_HEADERS(sys/select.h alloca.h fribidi/fribidi.h dlfcn.h)
+ 
+ AC_MSG_CHECKING([for python versions])
+ PYTHONVERS=$(echo /usr/include/python*/Python.h | sed "s|/usr/include/||g"| sed "s|/Python.h||g" 2> /dev/null)
+diff -ruN newt-0.52.11-old/entry.c newt-0.52.11/entry.c
+--- newt-0.52.11-old/entry.c	2009-09-24 16:03:09.000000000 +0100
++++ newt-0.52.11/entry.c	2010-06-21 13:12:53.000000000 +0100
+@@ -228,12 +228,15 @@
+ 
+     if (len <= co->width) {
+ 	i = len;
+-	SLsmg_write_string(chptr);
++       /* BIDI: do not replaced, because it will not work.
++        * More work needed */
++	SLsmg_write_nstring(chptr, len);
+ 	while (i < co->width) {
+ 	    SLsmg_write_char('_');
+ 	    i++;
+ 	}
+     } else
++	 /* BIDI: will not work for RTL text */
+ 	SLsmg_write_nstring(chptr, co->width);
+ 
+     newtGotorc(co->top, co->left + wstrlen(en->buf+en->firstChar, en->cursorPosition - en->firstChar));
+diff -ruN newt-0.52.11-old/label.c newt-0.52.11/label.c
+--- newt-0.52.11-old/label.c	2009-09-24 16:03:09.000000000 +0100
++++ newt-0.52.11/label.c	2010-06-21 13:12:53.000000000 +0100
+@@ -71,7 +71,9 @@
+     SLsmg_set_color(COLORSET_LABEL);
+ 
+     newtGotorc(co->top, co->left);
+-    SLsmg_write_string(la->text);
++    /* BIDI: need to check if nstring is really needed.
++     * Where it is used? */
++    write_nstring_int(la->text, co->width, NULL);
+ }
+ 
+ static void labelDestroy(newtComponent co) {
+diff -ruN newt-0.52.11-old/listbox.c newt-0.52.11/listbox.c
+--- newt-0.52.11-old/listbox.c	2009-09-24 16:03:09.000000000 +0100
++++ newt-0.52.11/listbox.c	2010-06-21 13:12:53.000000000 +0100
+@@ -529,7 +529,7 @@
+ 	else
+ 	    SLsmg_set_color(NEWT_COLORSET_LISTBOX);
+ 
+-	SLsmg_write_nstring(item->text, li->curWidth);
++	write_nstring_int(item->text, li->curWidth, NULL);
+ 
+ 	if (li->flags & NEWT_FLAG_MULTIPLE) {
+ 	    newtGotorc(co->top + i + li->bdyAdjust, co->left + li->bdxAdjust);
+diff -ruN newt-0.52.11-old/newt.c newt-0.52.11/newt.c
+--- newt-0.52.11-old/newt.c	2009-09-24 16:03:09.000000000 +0100
++++ newt-0.52.11/newt.c	2010-06-21 13:50:26.000000000 +0100
+@@ -18,6 +18,478 @@
+ #include "newt.h"
+ #include "newt_pr.h"
+ 
++#if defined(HAVE_FRIBIDI_FRIBIDI_H) && defined(HAVE_DLFCN_H)
++#include <fribidi/fribidi.h>
++#include <dlfcn.h>
++
++#ifndef TRUE
++#define TRUE 1
++#endif
++#ifndef FALSE
++#define FALSE 0
++#endif
++
++/* No sense in enabling shaping if we don't have BIDI support. */
++typedef struct
++{
++	int is_shaped;
++	wchar_t isolated;
++	wchar_t initial;
++	wchar_t medial;
++	wchar_t final;
++}
++arabic_char_node;
++
++#define ARABIC_BASE	0x621
++#define ARABIC_END	0x64A
++
++static const arabic_char_node arabic_shaping_table[] = {
++/* 0x621 */  { TRUE , 0xFE80, 0x0000, 0x0000, 0x0000},
++/* 0x622 */  { TRUE , 0xFE81, 0x0000, 0x0000, 0xFE82},
++/* 0x623 */  { TRUE , 0xFE83, 0x0000, 0x0000, 0xFE84},
++/* 0x624 */  { TRUE , 0xFE85, 0x0000, 0x0000, 0xFE86},
++/* 0x625 */  { TRUE , 0xFE87, 0x0000, 0x0000, 0xFE88},
++/* 0x626 */  { TRUE , 0xFE89, 0xFE8B, 0xFE8C, 0xFE8A},
++/* 0x627 */  { TRUE , 0xFE8D, 0x0000, 0x0000, 0xFE8E},
++/* 0x628 */  { TRUE , 0xFE8F, 0xFE91, 0xFE92, 0xFE90},
++/* 0x629 */  { TRUE , 0xFE93, 0x0000, 0x0000, 0xFE94},
++/* 0x62A */  { TRUE , 0xFE95, 0xFE97, 0xFE98, 0xFE96},
++/* 0x62B */  { TRUE , 0xFE99, 0xFE9B, 0xFE9C, 0xFE9A},
++/* 0x62C */  { TRUE , 0xFE9D, 0xFE9F, 0xFEA0, 0xFE9E},
++/* 0x62D */  { TRUE , 0xFEA1, 0xFEA3, 0xFEA4, 0xFEA2},
++/* 0x62E */  { TRUE , 0xFEA5, 0xFEA7, 0xFEA8, 0xFEA6},
++/* 0x62F */  { TRUE , 0xFEA9, 0x0000, 0x0000, 0xFEAA},
++/* 0x630 */  { TRUE , 0xFEAB, 0x0000, 0x0000, 0xFEAC},
++/* 0x631 */  { TRUE , 0xFEAD, 0x0000, 0x0000, 0xFEAE},
++/* 0x632 */  { TRUE , 0xFEAF, 0x0000, 0x0000, 0xFEB0},
++/* 0x633 */  { TRUE , 0xFEB1, 0xFEB3, 0xFEB4, 0xFEB2},
++/* 0x634 */  { TRUE , 0xFEB5, 0xFEB7, 0xFEB8, 0xFEB6},
++/* 0x635 */  { TRUE , 0xFEB9, 0xFEBB, 0xFEBC, 0xFEBA},
++/* 0x636 */  { TRUE , 0xFEBD, 0xFEBF, 0xFEC0, 0xFEBE},
++/* 0x637 */  { TRUE , 0xFEC1, 0xFEC3, 0xFEC4, 0xFEC2},
++/* 0x638 */  { TRUE , 0xFEC5, 0xFEC7, 0xFEC8, 0xFEC6},
++/* 0x639 */  { TRUE , 0xFEC9, 0xFECB, 0xFECC, 0xFECA},
++/* 0x63A */  { TRUE , 0xFECD, 0xFECF, 0xFED0, 0xFECE},
++/* 0x63B */  { FALSE, 0x0000, 0x0000, 0x0000, 0x0000},
++/* 0x63C */  { FALSE, 0x0000, 0x0000, 0x0000, 0x0000},
++/* 0x63D */  { FALSE, 0x0000, 0x0000, 0x0000, 0x0000},
++/* 0x63E */  { FALSE, 0x0000, 0x0000, 0x0000, 0x0000},
++/* 0x63F */  { FALSE, 0x0000, 0x0000, 0x0000, 0x0000},
++/* 0x640 */  { TRUE , 0x0640, 0x0640, 0x0640, 0x0640},
++/* 0x641 */  { TRUE , 0xFED1, 0xFED3, 0xFED4, 0xFED2},
++/* 0x642 */  { TRUE , 0xFED5, 0xFED7, 0xFED8, 0xFED6},
++/* 0x643 */  { TRUE , 0xFED9, 0xFEDB, 0xFEDC, 0xFEDA},
++/* 0x644 */  { TRUE , 0xFEDD, 0xFEDF, 0xFEE0, 0xFEDE},
++/* 0x645 */  { TRUE , 0xFEE1, 0xFEE3, 0xFEE4, 0xFEE2},
++/* 0x646 */  { TRUE , 0xFEE5, 0xFEE7, 0xFEE8, 0xFEE6},
++/* 0x647 */  { TRUE , 0xFEE9, 0xFEEB, 0xFEEC, 0xFEEA},
++/* 0x648 */  { TRUE , 0xFEED, 0x0000, 0x0000, 0xFEEE},
++/* 0x649 */  { TRUE , 0xFEEF, 0x0000, 0x0000, 0xFEF0},
++/* 0x64A */  { TRUE , 0xFEF1, 0xFEF3, 0xFEF4, 0xFEF2}
++};
++
++typedef struct {
++	wchar_t c;
++	arabic_char_node ar_node;
++}
++extra_char_node;
++
++#define EXTRA_BASE 0x67E
++#define EXTRA_END 0x6CC
++static const extra_char_node extra_shaping_table[] = {
++    {0x067E, {TRUE, 0xFB56, 0xFB58, 0xFB59, 0xFB57}},
++    {0x0686, {TRUE, 0xFB7A, 0xFB7C, 0xFB7D, 0xFB7B}},
++    {0x0698, {TRUE, 0xFB8A, 0x0000, 0x0000, 0xFB8B}},
++    {0x06A9, {TRUE, 0xFB8E, 0xFB90, 0xFB91, 0xFB8F}},
++    {0x06AF, {TRUE, 0xFB92, 0xFB94, 0xFB95, 0xFB93}},
++    {0x06CC, {TRUE, 0xFBFC, 0xFBFE, 0xFBFF, 0xFBFD}},
++    {0x0000, {FALSE, 0x0000, 0x0000, 0x0000, 0x0000}},
++};
++
++static const arabic_char_node *get_char_node(wchar_t w)
++{
++	if (w >= ARABIC_BASE && w <= ARABIC_END)
++		return &arabic_shaping_table[w - ARABIC_BASE];
++	else if (w >= EXTRA_BASE && w <= EXTRA_END) {
++		const extra_char_node *node = extra_shaping_table;
++		
++		while (node->c) {
++			if (node->c == w)
++				return &node->ar_node;
++			node++;
++		}
++		return NULL;
++	}
++	return NULL;
++}
++
++static int do_shaping(wchar_t *buf, int len) {
++    int i,j;
++
++    wchar_t *newbuf;
++
++    if (len < 1)
++	return 0;
++
++    newbuf = (wchar_t *)malloc(sizeof(wchar_t)*len);
++
++    for (i = 0, j = 0; i < len; i++, j++) {
++	int have_previous = FALSE, have_next = FALSE;
++	const arabic_char_node *node, *node1;
++	int prev, next;
++	
++	if (buf[i] == L'\0')
++	    break;
++
++	/* If it is non-joiner, ignore it */
++	if (buf[i] == 0x200C) {
++	    j--;
++	    continue;
++	}
++	
++	newbuf[j] = buf[i];
++
++	/* If it's not in our range, skip it. */
++	node = get_char_node(buf[i]);
++	if (!node)
++	{
++	    continue;
++	}
++
++	/* The character wasn't included in the unicode shaping table. */
++	if (!node->is_shaped)
++	{
++	    continue;
++	}
++	
++	for (prev = i - 1; prev >= 0; prev--)
++	    if (wcwidth(buf[prev]) || buf[prev] == 0x200C)
++	       break;
++	
++	if (prev >= 0 && (node1 = get_char_node(buf[prev]))
++		&& ( node1->initial || node1->medial))
++	{
++	    have_previous = TRUE;
++	}
++	
++	for (next = i + 1; next < len; next++)
++ 	    if (wcwidth(buf[next]) || buf[next] == 0x200C)
++	       break;
++	
++	if (next < len && (node1 = get_char_node(buf[next]))
++	    && (node1->medial || node1->final))
++	{
++	    have_next = TRUE;
++	}
++
++	/*
++	 * FIXME: do not make ligature if there are combining 
++	 * characters between two parts.
++	 */
++	if (buf[i] == 0x644 && have_next && next == i + 1)
++	{
++	    switch (buf[next])
++	    {
++		case 0x622:
++		    newbuf[j] = 0xFEF5 + (have_previous ? 1 : 0);
++		    i++;
++		    continue;
++		case 0x623:
++		    newbuf[j] = 0xFEF7 + (have_previous ? 1 : 0);
++		    i++;
++		    continue;
++		case 0x625:
++		    newbuf[j] = 0xFEF9 + (have_previous ? 1 : 0);
++		    i++;
++		    continue;
++		case 0x627:
++		    newbuf[j] = 0xFEFB + (have_previous ? 1 : 0);
++		    i++;
++		    continue;
++		default:
++		    break;
++	    }
++	}
++
++	/** Medial **/
++	if (have_previous && have_next && node->medial)
++	{
++	    newbuf[j] = node->medial;
++	}
++
++	/** Final **/
++	else if (have_previous && node->final)
++	{
++	    newbuf[j] = node->final;
++	}
++
++	/** Initial **/
++	else if (have_next && node->initial)
++	{
++	    newbuf[j] = node->initial;
++	}
++
++	/** Isolated **/
++	else if (node->isolated)
++	{
++	    newbuf[j] = node->isolated;
++	}
++    }
++    for (i = 0; i < len && i < j; i++) {
++	buf[i] = newbuf[i];
++    }
++    while (i < len) {
++	buf[i++] = L'\0';
++    }
++
++    free(newbuf);
++    return 0;
++}
++
++/* Converts bidi wchar text {in} to visual wchar text which is displayable 
++ * in text mode. Uses {base_dir} as default base direction.
++ * Returns malloc'ed converted text or NULL in case of error or if {need_out} is
++ * not set. Modifies {base_dir} to reflect actual direction.
++ */
++static wchar_t* wchar_to_textmod_visual(wchar_t *in,unsigned int len,FriBidiCharType *base_dir, int need_out)
++{
++    FriBidiChar *out = NULL;
++    static void *handle = NULL;
++    static int skip_out = 0;
++
++    fribidi_boolean (*func_ptr) (FriBidiChar *, FriBidiStrIndex,
++                                 FriBidiCharType *, FriBidiChar *,
++                                 FriBidiStrIndex *, FriBidiStrIndex *,
++                                 FriBidiLevel *);
++
++    if (skip_out)
++    	return NULL;
++    dlerror();  /* clear error state */
++    if (!handle) {
++	handle = dlopen("/usr/lib/libfribidi.so.0", RTLD_LAZY | RTLD_GLOBAL);
++	/* call dlerror() on failure to clear error state in dlopen modules */
++	if (!handle) dlerror();
++    }
++    if (!handle) {
++	handle = dlopen("/lib/libfribidi.so.0", RTLD_LAZY | RTLD_GLOBAL);
++    }
++    if (!handle) {
++    	dlerror();
++	skip_out = 1;
++	return NULL;
++    }
++    func_ptr = dlsym(handle, "fribidi_log2vis");
++    if (!func_ptr) {
++    	skip_out = 1;
++	if (dlclose(handle)) 
++		dlerror();
++	handle = NULL;
++	return NULL;
++    }
++    
++    if (need_out) {
++        out = (FriBidiChar *)calloc(len+1, sizeof(FriBidiChar));
++        if(!out)
++        {
++	    dlclose(handle);
++	    handle = NULL;
++            return (wchar_t *) out;
++        }
++
++        do_shaping(in, len);
++	len = wcsnlen(in, len);
++    }
++    (*func_ptr)(in, len, base_dir, out, NULL, NULL, NULL);
++
++    return (wchar_t *) out;
++}
++
++/*
++ * Converts text given in {str} from logical order to visual order.
++ * Uses {dir} as base direction ('N', 'R', 'L').
++ * Returns malloc'ed converted string. Modifies {dir} to reflect actual
++ * direction.
++ */
++static char *_newt_log2vis(const char *str, char *dir)
++{
++	wchar_t *wcs;
++	char *rstr = NULL;
++	int len = strlen(str);
++	int ret;
++	FriBidiCharType basedir;
++
++	switch (*dir)
++	{
++		case 'R': basedir = FRIBIDI_TYPE_R;
++			  break;
++		case 'L': basedir = FRIBIDI_TYPE_L;
++			  break;
++		default: basedir = FRIBIDI_TYPE_ON;
++			 break;
++	}
++	
++	if (len) {
++		wchar_t *owcs;
++		int newlen;
++		
++		wcs = malloc(sizeof(*wcs) * (len + 1));
++		if (!wcs)
++			return NULL;
++		ret = mbstowcs(wcs, str, len + 1);
++		if (ret < 0) {
++			free(wcs);
++			return NULL;
++		}
++		owcs = wchar_to_textmod_visual(wcs, ret, &basedir, 1);
++		if (FRIBIDI_DIR_TO_LEVEL(basedir))
++			*dir = 'R';
++		else
++			*dir = 'L';
++		
++		free(wcs);
++		if (!owcs)
++			return NULL;
++		
++		newlen = wcstombs(NULL, owcs, 0);
++		if (newlen < 0) {
++			free(owcs);
++			return NULL;
++		}
++		rstr = malloc(newlen + 1);
++		if (!rstr) {
++			free(owcs);
++			return NULL;
++		}
++		ret = wcstombs(rstr, owcs, newlen + 1);
++		free(owcs);
++		if (ret < 0) {
++			free(rstr);
++			return NULL;
++		}
++	}
++	return rstr;
++}
++
++/* Returns base direction of text given in {str}.
++ */
++char get_text_direction(const char *str)
++{
++	int len = strlen(str);
++	char dir = 'N';
++	wchar_t *wcs;
++	int ret;
++	
++	FriBidiCharType basedir = FRIBIDI_TYPE_ON;
++	
++	if (len) {
++		wcs = malloc(sizeof(*wcs) * (len + 1));
++		if (!wcs)
++			return dir;
++		ret = mbstowcs(wcs, str, len + 1);
++		if (ret < 0) {
++			free(wcs);
++			return dir;
++		}
++		wchar_to_textmod_visual(wcs, ret, &basedir, 1);
++		free(wcs);
++		if (FRIBIDI_DIR_TO_LEVEL(basedir))
++			dir = 'R';
++		else
++			dir = 'L';
++	}
++	return dir;
++}
++
++/* If width of string {str} is less then {width} adds
++ * final spaces to make it {width} position wide.
++ * Returns malloc'ed padded string or NULL in case of errors 
++ * or if string does not need padding.
++ */
++static char *pad_line(const char *str, int width)
++{
++	int len = strlen(str);
++	int w = _newt_wstrlen(str, len);
++
++	if (w < width) {
++		char *newstr = malloc(len + 1 + (width - w));
++		if (!newstr)
++			return NULL;
++		memcpy(newstr, str, len);
++		memset(newstr + len, ' ', width - w);
++		newstr[len+width-w] = '\0';
++		return newstr;
++	}
++	return NULL;
++}
++
++/*
++ * Writes string {str}. Uses {dir} as default direction.
++ * Returns direction of the string in {dir}.
++ */
++void write_string_int(const char *str, char *dir)
++{
++	char dummy;
++	char *tmpstr;
++
++	if (!dir) {
++		dummy = 'N';
++		dir = &dummy;
++	}
++	
++	tmpstr = _newt_log2vis(str, dir);
++	if (tmpstr)
++		str = tmpstr;
++	SLsmg_write_string(str);
++	if (tmpstr)
++		free(tmpstr);
++}
++
++/* Writes at most {n} positions of the string {str}.
++ * Adds final (logical) spaces if string width is less than {n}.
++ * Uses {dir} as default direction.
++ * Returns direction of the string in {dir}
++ */
++void write_nstring_int(const char *str, int n, char *dir)
++{
++	char dummy;
++	char *tmpstr, *tmpstr1;
++
++	if (!dir) {
++		dummy = 'N';
++		dir = &dummy;
++	}
++
++	tmpstr1 = pad_line(str, n);
++	if (tmpstr1)
++		str = tmpstr1;
++	tmpstr = _newt_log2vis(str, dir);
++	if (tmpstr) {
++		free(tmpstr1);
++		str = tmpstr;
++	}
++	SLsmg_write_nstring(str, n);
++	if (tmpstr)
++		free(tmpstr);
++	else
++		free(tmpstr1);
++}
++#else
++void write_string_int(const char *str, char *dir)
++{
++	SLsmg_write_string(str);
++}
++
++void write_nstring_int(const char *str, int w, char *dir)
++{
++	SLsmg_write_nstring(str, w);
++}
++
++char get_text_direction(const char *str)
++{
++	return 'L';
++}
++#endif
++
+ struct Window {
+     int height, width, top, left;
+     SLsmg_Char_Type * buffer;
+@@ -704,7 +1176,7 @@
+ 	SLsmg_set_char_set(0);
+ 	SLsmg_write_char(' ');
+ 	SLsmg_set_color(NEWT_COLORSET_TITLE);
+-	SLsmg_write_string((char *)currentWindow->title);
++	write_string_int((char *)currentWindow->title, NULL);
+ 	SLsmg_set_color(NEWT_COLORSET_BORDER);
+ 	SLsmg_write_char(' ');
+ 	SLsmg_set_char_set(1);
+@@ -958,7 +1430,7 @@
+ 	buf[SLtt_Screen_Cols] = '\0';
+     }
+     SLsmg_gotorc(SLtt_Screen_Rows - 1, 0);
+-    SLsmg_write_string(buf);
++    write_string_int(buf, NULL);
+ }
+ 
+ void newtPushHelpLine(const char * text) {
+@@ -1003,7 +1475,7 @@
+     }
+ 
+     SLsmg_gotorc(row, col);
+-    SLsmg_write_string((char *)text);
++    write_string_int((char *)text, NULL);
+ }
+ 
+ int newtSetFlags(int oldFlags, int newFlags, enum newtFlagsSense sense) {
+diff -ruN newt-0.52.11-old/newt.c-old newt-0.52.11/newt.c-old
+--- newt-0.52.11-old/newt.c-old	1970-01-01 01:00:00.000000000 +0100
++++ newt-0.52.11/newt.c-old	2010-06-21 13:12:54.000000000 +0100
+@@ -0,0 +1,1438 @@
++#include "config.h"
++
++#include <slang.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <sys/signal.h>
++#include <sys/time.h>
++#include <sys/types.h>
++#include <termios.h>
++#include <unistd.h>
++#include <wchar.h>
++
++#ifdef HAVE_ALLOCA_H
++#include <alloca.h>
++#endif
++
++#include "newt.h"
++#include "newt_pr.h"
++
++#if defined(HAVE_FRIBIDI_FRIBIDI_H) && defined(HAVE_DLFCN_H)
++#include <fribidi/fribidi.h>
++#include <dlfcn.h>
++
++/* No sense in enabling shaping if we don't have BIDI support. */
++typedef struct
++{
++	int is_shaped;
++	wchar_t isolated;
++	wchar_t initial;
++	wchar_t medial;
++	wchar_t final;
++}
++arabic_char_node;
++
++#define ARABIC_BASE	0x621
++#define ARABIC_END	0x64A
++
++static const arabic_char_node arabic_shaping_table[] = {
++/* 0x621 */  { TRUE , 0xFE80, 0x0000, 0x0000, 0x0000},
++/* 0x622 */  { TRUE , 0xFE81, 0x0000, 0x0000, 0xFE82},
++/* 0x623 */  { TRUE , 0xFE83, 0x0000, 0x0000, 0xFE84},
++/* 0x624 */  { TRUE , 0xFE85, 0x0000, 0x0000, 0xFE86},
++/* 0x625 */  { TRUE , 0xFE87, 0x0000, 0x0000, 0xFE88},
++/* 0x626 */  { TRUE , 0xFE89, 0xFE8B, 0xFE8C, 0xFE8A},
++/* 0x627 */  { TRUE , 0xFE8D, 0x0000, 0x0000, 0xFE8E},
++/* 0x628 */  { TRUE , 0xFE8F, 0xFE91, 0xFE92, 0xFE90},
++/* 0x629 */  { TRUE , 0xFE93, 0x0000, 0x0000, 0xFE94},
++/* 0x62A */  { TRUE , 0xFE95, 0xFE97, 0xFE98, 0xFE96},
++/* 0x62B */  { TRUE , 0xFE99, 0xFE9B, 0xFE9C, 0xFE9A},
++/* 0x62C */  { TRUE , 0xFE9D, 0xFE9F, 0xFEA0, 0xFE9E},
++/* 0x62D */  { TRUE , 0xFEA1, 0xFEA3, 0xFEA4, 0xFEA2},
++/* 0x62E */  { TRUE , 0xFEA5, 0xFEA7, 0xFEA8, 0xFEA6},
++/* 0x62F */  { TRUE , 0xFEA9, 0x0000, 0x0000, 0xFEAA},
++/* 0x630 */  { TRUE , 0xFEAB, 0x0000, 0x0000, 0xFEAC},
++/* 0x631 */  { TRUE , 0xFEAD, 0x0000, 0x0000, 0xFEAE},
++/* 0x632 */  { TRUE , 0xFEAF, 0x0000, 0x0000, 0xFEB0},
++/* 0x633 */  { TRUE , 0xFEB1, 0xFEB3, 0xFEB4, 0xFEB2},
++/* 0x634 */  { TRUE , 0xFEB5, 0xFEB7, 0xFEB8, 0xFEB6},
++/* 0x635 */  { TRUE , 0xFEB9, 0xFEBB, 0xFEBC, 0xFEBA},
++/* 0x636 */  { TRUE , 0xFEBD, 0xFEBF, 0xFEC0, 0xFEBE},
++/* 0x637 */  { TRUE , 0xFEC1, 0xFEC3, 0xFEC4, 0xFEC2},
++/* 0x638 */  { TRUE , 0xFEC5, 0xFEC7, 0xFEC8, 0xFEC6},
++/* 0x639 */  { TRUE , 0xFEC9, 0xFECB, 0xFECC, 0xFECA},
++/* 0x63A */  { TRUE , 0xFECD, 0xFECF, 0xFED0, 0xFECE},
++/* 0x63B */  { FALSE, 0x0000, 0x0000, 0x0000, 0x0000},
++/* 0x63C */  { FALSE, 0x0000, 0x0000, 0x0000, 0x0000},
++/* 0x63D */  { FALSE, 0x0000, 0x0000, 0x0000, 0x0000},
++/* 0x63E */  { FALSE, 0x0000, 0x0000, 0x0000, 0x0000},
++/* 0x63F */  { FALSE, 0x0000, 0x0000, 0x0000, 0x0000},
++/* 0x640 */  { TRUE , 0x0640, 0x0640, 0x0640, 0x0640},
++/* 0x641 */  { TRUE , 0xFED1, 0xFED3, 0xFED4, 0xFED2},
++/* 0x642 */  { TRUE , 0xFED5, 0xFED7, 0xFED8, 0xFED6},
++/* 0x643 */  { TRUE , 0xFED9, 0xFEDB, 0xFEDC, 0xFEDA},
++/* 0x644 */  { TRUE , 0xFEDD, 0xFEDF, 0xFEE0, 0xFEDE},
++/* 0x645 */  { TRUE , 0xFEE1, 0xFEE3, 0xFEE4, 0xFEE2},
++/* 0x646 */  { TRUE , 0xFEE5, 0xFEE7, 0xFEE8, 0xFEE6},
++/* 0x647 */  { TRUE , 0xFEE9, 0xFEEB, 0xFEEC, 0xFEEA},
++/* 0x648 */  { TRUE , 0xFEED, 0x0000, 0x0000, 0xFEEE},
++/* 0x649 */  { TRUE , 0xFEEF, 0x0000, 0x0000, 0xFEF0},
++/* 0x64A */  { TRUE , 0xFEF1, 0xFEF3, 0xFEF4, 0xFEF2}
++};
++
++typedef struct {
++	wchar_t c;
++	arabic_char_node ar_node;
++}
++extra_char_node;
++
++#define EXTRA_BASE 0x67E
++#define EXTRA_END 0x6CC
++static const extra_char_node extra_shaping_table[] = {
++    {0x067E, {TRUE, 0xFB56, 0xFB58, 0xFB59, 0xFB57}},
++    {0x0686, {TRUE, 0xFB7A, 0xFB7C, 0xFB7D, 0xFB7B}},
++    {0x0698, {TRUE, 0xFB8A, 0x0000, 0x0000, 0xFB8B}},
++    {0x06A9, {TRUE, 0xFB8E, 0xFB90, 0xFB91, 0xFB8F}},
++    {0x06AF, {TRUE, 0xFB92, 0xFB94, 0xFB95, 0xFB93}},
++    {0x06CC, {TRUE, 0xFBFC, 0xFBFE, 0xFBFF, 0xFBFD}},
++    {0x0000, {FALSE, 0x0000, 0x0000, 0x0000, 0x0000}},
++};
++
++static const arabic_char_node *get_char_node(wchar_t w)
++{
++	if (w >= ARABIC_BASE && w <= ARABIC_END)
++		return &arabic_shaping_table[w - ARABIC_BASE];
++	else if (w >= EXTRA_BASE && w <= EXTRA_END) {
++		const extra_char_node *node = extra_shaping_table;
++		
++		while (node->c) {
++			if (node->c == w)
++				return &node->ar_node;
++			node++;
++		}
++		return NULL;
++	}
++	return NULL;
++}
++
++static int do_shaping(wchar_t *buf, int len) {
++    int i,j;
++
++    wchar_t *newbuf;
++
++    if (len < 1)
++	return 0;
++
++    newbuf = (wchar_t *)malloc(sizeof(wchar_t)*len);
++
++    for (i = 0, j = 0; i < len; i++, j++) {
++	int have_previous = FALSE, have_next = FALSE;
++	const arabic_char_node *node, *node1;
++	int prev, next;
++	
++	if (buf[i] == L'\0')
++	    break;
++
++	/* If it is non-joiner, ignore it */
++	if (buf[i] == 0x200C) {
++	    j--;
++	    continue;
++	}
++	
++	newbuf[j] = buf[i];
++
++	/* If it's not in our range, skip it. */
++	node = get_char_node(buf[i]);
++	if (!node)
++	{
++	    continue;
++	}
++
++	/* The character wasn't included in the unicode shaping table. */
++	if (!node->is_shaped)
++	{
++	    continue;
++	}
++	
++	for (prev = i - 1; prev >= 0; prev--)
++	    if (wcwidth(buf[prev]) || buf[prev] == 0x200C)
++	       break;
++	
++	if (prev >= 0 && (node1 = get_char_node(buf[prev]))
++		&& ( node1->initial || node1->medial))
++	{
++	    have_previous = TRUE;
++	}
++	
++	for (next = i + 1; next < len; next++)
++ 	    if (wcwidth(buf[next]) || buf[next] == 0x200C)
++	       break;
++	
++	if (next < len && (node1 = get_char_node(buf[next]))
++	    && (node1->medial || node1->final))
++	{
++	    have_next = TRUE;
++	}
++
++	/*
++	 * FIXME: do not make ligature if there are combining 
++	 * characters between two parts.
++	 */
++	if (buf[i] == 0x644 && have_next && next == i + 1)
++	{
++	    switch (buf[next])
++	    {
++		case 0x622:
++		    newbuf[j] = 0xFEF5 + (have_previous ? 1 : 0);
++		    i++;
++		    continue;
++		case 0x623:
++		    newbuf[j] = 0xFEF7 + (have_previous ? 1 : 0);
++		    i++;
++		    continue;
++		case 0x625:
++		    newbuf[j] = 0xFEF9 + (have_previous ? 1 : 0);
++		    i++;
++		    continue;
++		case 0x627:
++		    newbuf[j] = 0xFEFB + (have_previous ? 1 : 0);
++		    i++;
++		    continue;
++		default:
++		    break;
++	    }
++	}
++
++	/** Medial **/
++	if (have_previous && have_next && node->medial)
++	{
++	    newbuf[j] = node->medial;
++	}
++
++	/** Final **/
++	else if (have_previous && node->final)
++	{
++	    newbuf[j] = node->final;
++	}
++
++	/** Initial **/
++	else if (have_next && node->initial)
++	{
++	    newbuf[j] = node->initial;
++	}
++
++	/** Isolated **/
++	else if (node->isolated)
++	{
++	    newbuf[j] = node->isolated;
++	}
++    }
++    for (i = 0; i < len && i < j; i++) {
++	buf[i] = newbuf[i];
++    }
++    while (i < len) {
++	buf[i++] = L'\0';
++    }
++
++    free(newbuf);
++    return 0;
++}
++
++/* Converts bidi wchar text {in} to visual wchar text which is displayable 
++ * in text mode. Uses {base_dir} as default base direction.
++ * Returns malloc'ed converted text or NULL in case of error or if {need_out} is
++ * not set. Modifies {base_dir} to reflect actual direction.
++ */
++static wchar_t* wchar_to_textmod_visual(wchar_t *in,unsigned int len,FriBidiCharType *base_dir, int need_out)
++{
++    FriBidiChar *out = NULL;
++    static void *handle = NULL;
++
++    fribidi_boolean (*func_ptr) (FriBidiChar *, FriBidiStrIndex,
++                                 FriBidiCharType *, FriBidiChar *,
++                                 FriBidiStrIndex *, FriBidiStrIndex *,
++                                 FriBidiLevel *);
++
++    if (!handle)
++	handle = dlopen("/usr/lib/libfribidi.so.0", RTLD_LAZY | RTLD_GLOBAL);
++    if (!handle)
++	handle = dlopen("/lib/libfribidi.so.0", RTLD_LAZY | RTLD_GLOBAL);
++    if (!handle)
++	return NULL;
++
++    func_ptr = dlsym(handle, "fribidi_log2vis");
++    if (!func_ptr) {
++	dlclose(handle);
++	handle = NULL;
++	return NULL;
++    }
++    
++    if (need_out) {
++        out = (FriBidiChar *)malloc(sizeof(FriBidiChar)*(len+1));
++        if(!out)
++        {
++	    dlclose(handle);
++	    handle = NULL;
++            return (wchar_t *) out;
++        }
++
++        do_shaping(in, len);
++	len = wcsnlen(in, len);
++    }
++    (*func_ptr)(in, len, base_dir, out, NULL, NULL, NULL);
++
++    return (wchar_t *) out;
++}
++
++/*
++ * Converts text given in {str} from logical order to visual order.
++ * Uses {dir} as base direction ('N', 'R', 'L').
++ * Returns malloc'ed converted string. Modifies {dir} to reflect actual
++ * direction.
++ */
++static char *_newt_log2vis(const char *str, char *dir)
++{
++	wchar_t *wcs;
++	char *rstr = NULL;
++	int len = strlen(str);
++	int ret;
++	FriBidiCharType basedir;
++
++	switch (*dir)
++	{
++		case 'R': basedir = FRIBIDI_TYPE_R;
++			  break;
++		case 'L': basedir = FRIBIDI_TYPE_L;
++			  break;
++		default: basedir = FRIBIDI_TYPE_ON;
++			 break;
++	}
++	
++	if (len) {
++		wchar_t *owcs;
++		int newlen;
++		
++		wcs = malloc(sizeof(*wcs) * (len + 1));
++		if (!wcs)
++			return NULL;
++		ret = mbstowcs(wcs, str, len + 1);
++		if (ret < 0) {
++			free(wcs);
++			return NULL;
++		}
++		owcs = wchar_to_textmod_visual(wcs, ret, &basedir, 1);
++		if (FRIBIDI_DIR_TO_LEVEL(basedir))
++			*dir = 'R';
++		else
++			*dir = 'L';
++		
++		free(wcs);
++		if (!owcs)
++			return NULL;
++		
++		newlen = wcstombs(NULL, owcs, 0);
++		if (newlen < 0) {
++			free(owcs);
++			return NULL;
++		}
++		rstr = malloc(newlen + 1);
++		if (!rstr) {
++			free(owcs);
++			return NULL;
++		}
++		ret = wcstombs(rstr, owcs, newlen + 1);
++		free(owcs);
++		if (ret < 0) {
++			free(rstr);
++			return NULL;
++		}
++	}
++	return rstr;
++}
++
++/* Returns base direction of text given in {str}.
++ */
++char get_text_direction(const char *str)
++{
++	int len = strlen(str);
++	char dir = 'N';
++	wchar_t *wcs;
++	int ret;
++	
++	FriBidiCharType basedir = FRIBIDI_TYPE_ON;
++	
++	if (len) {
++		wcs = malloc(sizeof(*wcs) * (len + 1));
++		if (!wcs)
++			return dir;
++		ret = mbstowcs(wcs, str, len + 1);
++		if (ret < 0) {
++			free(wcs);
++			return dir;
++		}
++		wchar_to_textmod_visual(wcs, ret, &basedir, 1);
++		free(wcs);
++		if (FRIBIDI_DIR_TO_LEVEL(basedir))
++			dir = 'R';
++		else
++			dir = 'L';
++	}
++	return dir;
++}
++
++/* If width of string {str} is less then {width} adds
++ * final spaces to make it {width} position wide.
++ * Returns malloc'ed padded string or NULL in case of errors 
++ * or if string does not need padding.
++ */
++static char *pad_line(const char *str, int width)
++{
++	int len = strlen(str);
++	int w = _newt_wstrlen(str, len);
++
++	if (w < width) {
++		char *newstr = malloc(len + 1 + (width - w));
++		if (!newstr)
++			return NULL;
++		memcpy(newstr, str, len);
++		memset(newstr + len, ' ', width - w);
++		newstr[len+width-w] = '\0';
++		return newstr;
++	}
++	return NULL;
++}
++
++/*
++ * Writes string {str}. Uses {dir} as default direction.
++ * Returns direction of the string in {dir}.
++ */
++void write_string_int(const char *str, char *dir)
++{
++	char dummy;
++	char *tmpstr;
++
++	if (!dir) {
++		dummy = 'N';
++		dir = &dummy;
++	}
++	
++	tmpstr = _newt_log2vis(str, dir);
++	if (tmpstr)
++		str = tmpstr;
++	SLsmg_write_string(str);
++	if (tmpstr)
++		free(tmpstr);
++}
++
++/* Writes at most {n} positions of the string {str}.
++ * Adds final (logical) spaces if string width is less than {n}.
++ * Uses {dir} as default direction.
++ * Returns direction of the string in {dir}
++ */
++void write_nstring_int(const char *str, int n, char *dir)
++{
++	char dummy;
++	char *tmpstr, *tmpstr1;
++
++	if (!dir) {
++		dummy = 'N';
++		dir = &dummy;
++	}
++
++	tmpstr1 = pad_line(str, n);
++	if (tmpstr1)
++		str = tmpstr1;
++	tmpstr = _newt_log2vis(str, dir);
++	if (tmpstr) {
++		free(tmpstr1);
++		str = tmpstr;
++	}
++	SLsmg_write_nstring(str, n);
++	if (tmpstr)
++		free(tmpstr);
++	else
++		free(tmpstr1);
++}
++#else
++void write_string_int(const char *str, char *dir)
++{
++	SLsmg_write_string(str);
++}
++
++void write_nstring_int(const char *str, int w, char *dir)
++{
++	SLsmg_write_nstring(str, w);
++}
++
++char get_text_direction(const char *str)
++{
++	return 'L';
++}
++#endif
++
++struct Window {
++    int height, width, top, left;
++    SLsmg_Char_Type * buffer;
++    char * title;
++};
++
++struct keymap {
++    char * str;
++    int code;
++    char * tc;
++};
++
++static struct Window windowStack[20];
++static struct Window * currentWindow = NULL;
++
++static char * helplineStack[20];
++static char ** currentHelpline = NULL;
++
++static int cursorRow, cursorCol;
++static int needResize = 0;
++static int cursorOn = 1;
++static int trashScreen = 0;
++
++static const char * defaultHelpLine =
++"  <Tab>/<Alt-Tab> between elements   |  <Space> selects   |  <F12> next screen"
++;
++
++const struct newtColors newtDefaultColorPalette = {
++	"white", "blue", 			/* root fg, bg */
++	"black", "lightgray",			/* border fg, bg */
++	"black", "lightgray",			/* window fg, bg */
++	"white", "black",			/* shadow fg, bg */
++	"red", "lightgray",			/* title fg, bg */
++	"lightgray", "red",			/* button fg, bg */
++	"red", "lightgray",			/* active button fg, bg */
++	"yellow", "blue",			/* checkbox fg, bg */
++	"blue", "brown",			/* active checkbox fg, bg */
++	"yellow", "blue",			/* entry box fg, bg */
++	"blue", "lightgray",			/* label fg, bg */
++	"black", "lightgray",			/* listbox fg, bg */
++	"yellow", "blue",			/* active listbox fg, bg */
++	"black", "lightgray",			/* textbox fg, bg */
++	"lightgray", "black",			/* active textbox fg, bg */
++	"white", "blue",			/* help line */
++	"yellow", "blue",			/* root text */
++	"blue",					/* scale full */
++	"red",					/* scale empty */
++	"blue", "lightgray",			/* disabled entry fg, bg */
++	"black", "lightgray",			/* compact button fg, bg */
++	"yellow", "red",			/* active & sel listbox */
++	"black", "brown"			/* selected listbox */
++};
++
++static const struct keymap keymap[] = {
++	{ "\033OA", 		NEWT_KEY_UP, 		"ku" },
++	{ "\020", 		NEWT_KEY_UP, 		NULL }, /* emacs ^P */
++	{ "\033OB", 		NEWT_KEY_DOWN, 		"kd" },
++	{ "\016", 		NEWT_KEY_DOWN, 		NULL }, /* emacs ^N */
++	{ "\033OC", 		NEWT_KEY_RIGHT, 	"kr" },
++	{ "\006", 		NEWT_KEY_RIGHT, 	NULL }, /* emacs ^F */
++	{ "\033OD", 		NEWT_KEY_LEFT, 		"kl" },
++	{ "\002", 		NEWT_KEY_LEFT, 		NULL }, /* emacs ^B */
++	{ "\033OH",		NEWT_KEY_HOME, 		"kh" },
++	{ "\033[1~",		NEWT_KEY_HOME, 		NULL },
++	{ "\001",		NEWT_KEY_HOME, 		NULL }, /* emacs ^A */
++	{ "\033Ow",		NEWT_KEY_END, 		"kH" },
++        { "\033[4~",		NEWT_KEY_END, 		"@7" },
++        { "\005",		NEWT_KEY_END, 		NULL }, /* emacs ^E */
++
++	{ "\033[3~",		NEWT_KEY_DELETE,	"kD" },
++	{ "\004",		NEWT_KEY_DELETE,	NULL }, /* emacs ^D */
++	{ "\033[2~", 		NEWT_KEY_INSERT,        "kI" },
++
++	{ "\033\t",		NEWT_KEY_UNTAB,		"kB" },
++
++	{ "\033[5~",		NEWT_KEY_PGUP,		"kP" },
++	{ "\033[6~",		NEWT_KEY_PGDN,		"kN" },
++	{ "\033V",		NEWT_KEY_PGUP, 		NULL },
++	{ "\033v",		NEWT_KEY_PGUP, 		NULL },
++        { "\026",		NEWT_KEY_PGDN,		NULL },
++
++	{ "\033[[A",		NEWT_KEY_F1,		NULL },
++	{ "\033[[B",		NEWT_KEY_F2,		NULL },
++	{ "\033[[C",		NEWT_KEY_F3,		NULL },
++	{ "\033[[D",		NEWT_KEY_F4,		NULL },
++	{ "\033[[E",		NEWT_KEY_F5,		NULL },
++
++	{ "\033OP",		NEWT_KEY_F1,		NULL },
++	{ "\033OQ",		NEWT_KEY_F2,		NULL },
++	{ "\033OR",		NEWT_KEY_F3,		NULL },
++	{ "\033OS",		NEWT_KEY_F4,		NULL },
++
++	{ "\033[11~",		NEWT_KEY_F1,		"k1" },
++	{ "\033[12~",		NEWT_KEY_F2,		"k2" },
++	{ "\033[13~",		NEWT_KEY_F3,		"k3" },
++	{ "\033[14~",		NEWT_KEY_F4,		"k4" },
++	{ "\033[15~",		NEWT_KEY_F5,		"k5" },
++	{ "\033[17~",		NEWT_KEY_F6,		"k6" },
++	{ "\033[18~",		NEWT_KEY_F7,		"k7" },
++	{ "\033[19~",		NEWT_KEY_F8,		"k8" },
++	{ "\033[20~",		NEWT_KEY_F9,            "k9" },
++	{ "\033[21~",		NEWT_KEY_F10,		"k;" },
++	{ "\033[23~",		NEWT_KEY_F11,		"F1" },
++	{ "\033[24~",		NEWT_KEY_F12,		"F2" },
++	{ "\033",		NEWT_KEY_ESCAPE,	"@2" },
++        { "\033",		NEWT_KEY_ESCAPE,	"@9" },
++
++        { "\177",		NEWT_KEY_BKSPC,		NULL },
++        { "\010",		NEWT_KEY_BKSPC,		NULL },
++        
++	{ 0 },	/* LEAVE this one */
++};
++static void initKeymap();
++
++static const char ident[] = // ident friendly
++    "$Version: Newt windowing library v" VERSION " $"
++    "$Copyright: (C) 1996-2003 Red Hat, Inc. Written by Erik Troan $"
++    "$License: Lesser GNU Public License. $";
++
++static newtSuspendCallback suspendCallback = NULL;
++static void * suspendCallbackData = NULL;
++
++void newtSetSuspendCallback(newtSuspendCallback cb, void * data) {
++    suspendCallback = cb;
++    suspendCallbackData = data;
++}
++
++static void handleSigwinch(int signum) {
++    needResize = 1;
++}
++
++static int getkeyInterruptHook(void) {
++    return -1;
++}
++
++int _newt_wstrlen(const char *str, int len) {
++	mbstate_t ps;
++	wchar_t tmp;
++	int nchars = 0;
++	
++	if (!str) return 0;
++	if (!len) return 0;
++	if (len < 0) len = strlen(str);
++	memset(&ps,0,sizeof(mbstate_t));
++	while (len > 0) {
++		int x,y;
++		
++		x = mbrtowc(&tmp,str,len,&ps);
++		if (x >0) {
++		    	str += x;
++			len -= x;
++			y = wcwidth(tmp);
++			if (y>0)
++			  nchars+=y;
++		} else break;
++	}
++	return nchars;
++}
++
++/** Trim a string to fit 
++ * @param title - string. NULL will be inserted if necessary
++ * @param chrs  - available space. (character cells)
++ */
++void trim_string(char *title, int chrs)
++{
++	char *p = title;
++	int ln = chrs;
++	int x = 0,y = 0;
++	wchar_t tmp;
++	mbstate_t ps;
++
++	memset(&ps, 0, sizeof(ps));
++
++	while (*p) {
++		x = mbrtowc(&tmp, p, ln, &ps);
++		if (x < 0) { // error
++			*p = '\0';
++			return;
++		}
++		y = wcwidth(tmp);
++		if (y > ln) {
++			*p = '\0';
++			return;
++		} else {
++			p += x;
++			ln -= y;
++		}
++	}	
++}
++
++static int getkey() {
++    int c;
++
++    while ((c = SLang_getkey()) == '\xC') { /* if Ctrl-L redraw whole screen */
++        SLsmg_touch_lines (0, SLtt_Screen_Rows - 1);
++        SLsmg_refresh();
++    }
++    return c;
++
++}
++
++void newtFlushInput(void) {
++    while (SLang_input_pending(0)) {
++	getkey();
++    }
++}
++
++/**
++ * @brief Refresh the screen
++ */
++void newtRefresh(void) {
++    SLsmg_refresh();
++}
++
++void newtSuspend(void) {
++    SLtt_set_cursor_visibility (1);
++    SLsmg_suspend_smg();
++    SLang_reset_tty();
++    SLtt_set_cursor_visibility (cursorOn);
++}
++
++/**
++ *  @brief Return after suspension.
++ *  @return 0 on success.
++ */
++int newtResume(void) {
++    SLsmg_resume_smg ();
++    SLsmg_refresh();
++    return SLang_init_tty(0, 0, 0);
++}
++
++void newtCls(void) {
++    SLsmg_set_color(NEWT_COLORSET_ROOT);
++    SLsmg_gotorc(0, 0);
++    SLsmg_erase_eos();
++
++    newtRefresh();
++}
++
++/**
++ * @brief Resize the screen
++ * @param redraw - boolean - should we redraw the screen?
++ */
++void newtResizeScreen(int redraw) {
++    SLtt_get_screen_size();
++    SLsmg_reinit_smg();
++    if (redraw) {
++        SLsmg_touch_lines (0, SLtt_Screen_Rows - 1);
++        newtRefresh();
++    }
++}
++
++/**
++ * @brief Initialize the newt library
++ * @return int - 0 for success, else < 0
++ */
++int newtInit(void) {
++    char * MonoValue, * MonoEnv = "NEWT_MONO";
++    const char *lang;
++    int ret;
++
++    if ((lang = getenv("LC_ALL")) == NULL)
++        if ((lang = getenv("LC_CTYPE")) == NULL)
++            if ((lang = getenv("LANG")) == NULL)
++                lang = "";
++    if (strstr (lang, ".euc") != NULL)
++	trashScreen = 1;
++
++    (void) strlen(ident);
++
++    SLtt_get_terminfo();
++    SLtt_get_screen_size();
++    SLutf8_enable(-1); /* init. utf8 according to locale */
++
++    MonoValue = getenv(MonoEnv);
++    if ( MonoValue == NULL ) {
++	SLtt_Use_Ansi_Colors = 1;
++    } else {
++	SLtt_Use_Ansi_Colors = 0;
++    }
++
++    if ((ret = SLsmg_init_smg()) < 0)
++	return ret;
++    if ((ret = SLang_init_tty(0, 0, 0)) < 0)
++	return ret;
++
++    newtSetColors(newtDefaultColorPalette);
++    newtCursorOff();
++    initKeymap();
++
++    /*memset(&sa, 0, sizeof(sa));
++    sa.sa_handler = handleSigwinch;
++    sigaction(SIGWINCH, &sa, NULL);*/
++
++    SLsignal_intr(SIGWINCH, handleSigwinch);
++    SLang_getkey_intr_hook = getkeyInterruptHook;
++
++    return 0;
++}
++
++/**
++ * @brief Closedown the newt library, tidying screen.
++ * @returns int , 0. (no errors reported)
++ */
++int newtFinished(void) {
++    SLsmg_gotorc(SLtt_Screen_Rows - 1, 0);
++    newtCursorOn();
++    SLsmg_refresh();
++    SLsmg_reset_smg();
++    SLang_reset_tty();
++
++    return 0;
++}
++
++/**
++ * @brief Set the colors used.
++ * @param colors - newtColor struct used.
++ */
++void newtSetColors(struct newtColors colors) {
++    if (!SLtt_Use_Ansi_Colors) {
++        int i;
++
++        for (i = 2; i < 25; i++)
++            SLtt_set_mono(i, NULL, 0);
++
++        SLtt_set_mono(NEWT_COLORSET_SELLISTBOX, NULL, SLTT_BOLD_MASK);
++
++        SLtt_set_mono(NEWT_COLORSET_ACTBUTTON, NULL, SLTT_REV_MASK);
++        SLtt_set_mono(NEWT_COLORSET_ACTCHECKBOX, NULL, SLTT_REV_MASK);
++        SLtt_set_mono(NEWT_COLORSET_ACTLISTBOX, NULL, SLTT_REV_MASK);
++        SLtt_set_mono(NEWT_COLORSET_ACTTEXTBOX, NULL, SLTT_REV_MASK);
++
++        SLtt_set_mono(NEWT_COLORSET_ACTSELLISTBOX, NULL, SLTT_REV_MASK | SLTT_BOLD_MASK);
++        
++        SLtt_set_mono(NEWT_COLORSET_DISENTRY, NULL, 0); // FIXME
++        SLtt_set_mono(NEWT_COLORSET_FULLSCALE, NULL, SLTT_ULINE_MASK | SLTT_REV_MASK);
++        SLtt_set_mono(NEWT_COLORSET_EMPTYSCALE, NULL, SLTT_ULINE_MASK);
++        return;
++    }
++    SLtt_set_color(NEWT_COLORSET_ROOT, "", colors.rootFg, colors.rootBg);
++    SLtt_set_color(NEWT_COLORSET_BORDER, "", colors.borderFg, colors.borderBg);
++    SLtt_set_color(NEWT_COLORSET_WINDOW, "", colors.windowFg, colors.windowBg);
++    SLtt_set_color(NEWT_COLORSET_SHADOW, "", colors.shadowFg, colors.shadowBg);
++    SLtt_set_color(NEWT_COLORSET_TITLE, "", colors.titleFg, colors.titleBg);
++    SLtt_set_color(NEWT_COLORSET_BUTTON, "", colors.buttonFg, colors.buttonBg);
++    SLtt_set_color(NEWT_COLORSET_ACTBUTTON, "", colors.actButtonFg,
++			colors.actButtonBg);
++    SLtt_set_color(NEWT_COLORSET_CHECKBOX, "", colors.checkboxFg,
++			colors.checkboxBg);
++    SLtt_set_color(NEWT_COLORSET_ACTCHECKBOX, "", colors.actCheckboxFg,
++			colors.actCheckboxBg);
++    SLtt_set_color(NEWT_COLORSET_ENTRY, "", colors.entryFg, colors.entryBg);
++    SLtt_set_color(NEWT_COLORSET_LABEL, "", colors.labelFg, colors.labelBg);
++    SLtt_set_color(NEWT_COLORSET_LISTBOX, "", colors.listboxFg,
++			colors.listboxBg);
++    SLtt_set_color(NEWT_COLORSET_ACTLISTBOX, "", colors.actListboxFg,
++			colors.actListboxBg);
++    SLtt_set_color(NEWT_COLORSET_TEXTBOX, "", colors.textboxFg,
++			colors.textboxBg);
++    SLtt_set_color(NEWT_COLORSET_ACTTEXTBOX, "", colors.actTextboxFg,
++			colors.actTextboxBg);
++    SLtt_set_color(NEWT_COLORSET_HELPLINE, "", colors.helpLineFg,
++			colors.helpLineBg);
++    SLtt_set_color(NEWT_COLORSET_ROOTTEXT, "", colors.rootTextFg,
++			colors.rootTextBg);
++
++    SLtt_set_color(NEWT_COLORSET_EMPTYSCALE, "", "white",
++			colors.emptyScale);
++    SLtt_set_color(NEWT_COLORSET_FULLSCALE, "", "white",
++			colors.fullScale);
++    SLtt_set_color(NEWT_COLORSET_DISENTRY, "", colors.disabledEntryFg,
++			colors.disabledEntryBg);
++
++    SLtt_set_color(NEWT_COLORSET_COMPACTBUTTON, "", colors.compactButtonFg,
++			colors.compactButtonBg);
++
++    SLtt_set_color(NEWT_COLORSET_ACTSELLISTBOX, "", colors.actSelListboxFg,
++		   colors.actSelListboxBg);
++    SLtt_set_color(NEWT_COLORSET_SELLISTBOX, "", colors.selListboxFg,
++		   colors.selListboxBg);
++}
++
++/* Keymap handling - rewritten by Henning Makholm <henning@makholm.net>,
++ * November 2003.
++ */
++
++struct kmap_trie_entry {
++    char c ;   /* character got from terminal */
++    int code;  /* newt key, or 0 if c does not make a complete sequence */
++    struct kmap_trie_entry *contseq; /* sub-trie for character following c */
++    struct kmap_trie_entry *next;    /* try this if char received != c */
++};
++/* Here are some static entries that will help in handling esc O foo and
++   esc [ foo as variants of each other: */
++static struct kmap_trie_entry
++    kmap_trie_escO     = { 'O', 0, 0, 0 },
++    kmap_trie_escBrack = { '[', 0, 0, &kmap_trie_escO },
++    kmap_trie_root     = { '\033', 0, &kmap_trie_escBrack, 0 };
++static int keyreader_buf_len = 10 ;
++static unsigned char default_keyreader_buf[10];
++static unsigned char *keyreader_buf = default_keyreader_buf;
++
++#if 0 /* for testing of the keymap manipulation code */
++static void dumpkeys_recursive(struct kmap_trie_entry *curr, int i, FILE *f) {
++    int j, ps ;
++    char seen[256]={0};
++    if( curr && i >= keyreader_buf_len ) {
++        fprintf(f,"ARGH! Too long sequence!\n") ;
++        return ;
++    }
++    for(;curr;curr=curr->next) {
++        keyreader_buf[i] = curr->c ;
++        ps = seen[(unsigned char)curr->c]++ ;
++        if( ps || curr->code || (!curr->code && !curr->contseq) ) {
++            for(j=0;j<=i;j++) {
++                if( keyreader_buf[j] > 32 && keyreader_buf[j]<127 &&
++                    keyreader_buf[j] != '^' && keyreader_buf[j] != '\\' )
++                    fprintf(f,"%c",keyreader_buf[j]);
++                else if( keyreader_buf[j] > 0 && keyreader_buf[j]<=32 )
++                    fprintf(f,"^%c",keyreader_buf[j] + 0x40);
++                else
++                    fprintf(f,"\\%03o",
++                            (unsigned)(unsigned char)keyreader_buf[j]);
++            }
++            if( curr->code )
++                fprintf(f,": 0x%X\n",curr->code);
++            else
++                fprintf(f,": (just keymap)\n");
++        }
++        dumpkeys_recursive(curr->contseq,i+1,f);
++    }
++}
++static void dump_keymap(void) {
++    FILE *f = fopen("newt.keydump","wt");
++    if (f) {
++        dumpkeys_recursive(&kmap_trie_root,0,f);
++        fclose(f);
++    }
++}
++#endif
++
++/* newtBindKey may overwrite a binding that is there already */
++static void newtBindKey(char *keyseq, int meaning) {
++    struct kmap_trie_entry *root = &kmap_trie_root ;
++    struct kmap_trie_entry **curptr = &root ;
++
++    /* Try to make sure the common matching buffer is long enough. */
++    if( strlen(keyseq) > keyreader_buf_len ) {
++        int i = strlen(keyseq)+10;
++        unsigned char *newbuf = malloc(i);
++        if (newbuf) {
++            if (keyreader_buf != default_keyreader_buf)
++                free(keyreader_buf);
++            keyreader_buf = newbuf;
++            keyreader_buf_len = i;
++        }
++    }
++    
++    if (*keyseq == 0) return; /* binding the empty sequence is meaningless */
++    
++    while(1) {
++        while ((*curptr) && (*curptr)->c != *keyseq)
++            curptr = &(*curptr)->next;
++        if ((*curptr)==0) {
++            struct kmap_trie_entry* fresh
++                =  calloc(strlen(keyseq),sizeof(struct kmap_trie_entry));
++            if (fresh == 0) return; /* despair! */
++            *curptr = fresh;
++            while (keyseq[1]) {
++                fresh->contseq = fresh+1;
++                (fresh++)->c = *(keyseq++);
++            }
++            fresh->c = *keyseq;
++            fresh->code = meaning;
++            return;
++        }
++        if (keyseq[1]==0) {
++            (*curptr)->code = meaning;
++            return;
++        } else {
++            curptr = &(*curptr)->contseq;
++            keyseq++;
++        }
++    }      
++}
++
++/* This function recursively inserts all entries in the "to" trie into
++   corresponding positions in the "from" trie, except positions that
++   are already defined in the "from" trie. */
++static void kmap_trie_fallback(struct kmap_trie_entry *to,
++                               struct kmap_trie_entry **from) {
++    if (*from == NULL)
++        *from = to ;
++    if (*from == to)
++        return ;
++    for (;to!=NULL;to=to->next) {
++        struct kmap_trie_entry **fromcopy = from ;
++        while ((*fromcopy) && (*fromcopy)->c != to->c)
++            fromcopy = &(*fromcopy)->next ;
++        if (*fromcopy) {
++            if ((*fromcopy)->code == 0)
++                (*fromcopy)->code = to->code;
++            kmap_trie_fallback(to->contseq, &(*fromcopy)->contseq);
++        } else {
++            *fromcopy = malloc(sizeof(struct kmap_trie_entry));
++            if (*fromcopy) {
++                **fromcopy = *to ;
++                (*fromcopy)->next = 0 ;
++            }
++        }
++    }
++}
++
++int newtGetKey(void) {
++    int key;
++    unsigned char *chptr = keyreader_buf, *lastmatch;
++    int lastcode;
++    struct kmap_trie_entry *curr = &kmap_trie_root;
++
++    do {
++	key = getkey();
++	if (key == SLANG_GETKEY_ERROR) {
++	    /* Either garbage was read, or stdin disappeared
++	     * (the parent terminal was proably closed)
++	     * if the latter, die.
++	     */
++	    if (feof(stdin))
++		    exit(1);
++	    if (needResize) {
++                needResize = 0;
++		return NEWT_KEY_RESIZE;
++            }
++
++	    /* ignore other signals */
++	    continue;
++	}
++
++	if (key == NEWT_KEY_SUSPEND && suspendCallback)
++	    suspendCallback(suspendCallbackData);
++    } while (key == NEWT_KEY_SUSPEND);
++
++    /* Read more characters, matching against the trie as we go */
++    lastcode = *chptr = key;
++    lastmatch = chptr ;
++    while(1) {
++         while (curr->c != key) {
++             curr = curr->next ;
++             if (curr==NULL) goto break2levels;
++         }
++         if (curr->code) {
++             lastcode = curr->code;
++             lastmatch = chptr;
++         }
++         curr = curr->contseq;
++         if (curr==NULL) break;
++
++         if (SLang_input_pending(5) <= 0)
++             break;
++
++         if (chptr==keyreader_buf+keyreader_buf_len-1) break;
++         *++chptr = key = getkey();
++    }
++   break2levels:
++
++      /* The last time the trie matched was at position lastmatch. Back
++       * up if we have read too many characters. */
++      while (chptr > lastmatch)
++          SLang_ungetkey(*chptr--);
++    
++      return lastcode;
++}
++
++/**
++ * @brief Wait for a keystroke
++ */
++void newtWaitForKey(void) {
++    newtRefresh();
++
++    getkey();
++    newtClearKeyBuffer();
++}
++
++/**
++ * @brief Clear the keybuffer
++ */
++void newtClearKeyBuffer(void) {
++    while (SLang_input_pending(1)) {
++	getkey();
++    }
++}
++
++/**
++ * Open a new window.
++ * @param left. unsigned int Size; _not_ including border
++ * @param top: unsigned int size, _not_ including border
++ * @param width unsigned int
++ * @param height unsigned int
++ * @param title - title string
++ * @return zero on success (currently no errors reported)
++ */
++int newtOpenWindow(unsigned int left, unsigned int top, 
++                   unsigned int width, unsigned int height,
++			  const char * title) {
++    int j, row, col;
++    int n;
++    int i;
++
++    newtFlushInput();
++
++    if (!currentWindow) {
++	currentWindow = windowStack;
++    } else {
++	currentWindow++;
++    }
++
++    currentWindow->left = left;
++    currentWindow->top = top;
++    currentWindow->width = width;
++    currentWindow->height = height;
++    currentWindow->title = title ? strdup(title) : NULL;
++
++    currentWindow->buffer = malloc(sizeof(SLsmg_Char_Type) * (width + 3) * (height + 3));
++
++    row = top - 1;
++    col = left - 1;
++    /* clip to the current screen bounds - msw */
++    if (row < 0)
++	row = 0;
++    if (col < 0)
++	col = 0;
++    if (left + width > SLtt_Screen_Cols)
++	width = SLtt_Screen_Cols - left;
++    if (top + height > SLtt_Screen_Rows)
++	height = SLtt_Screen_Rows - top;
++    n = 0;
++    for (j = 0; j < height + 3; j++, row++) {
++	SLsmg_gotorc(row, col);
++	SLsmg_read_raw(currentWindow->buffer + n,
++		       currentWindow->width + 3);
++	n += currentWindow->width + 3;
++    }
++
++    newtTrashScreen();
++
++    SLsmg_set_color(NEWT_COLORSET_BORDER);
++    SLsmg_set_char_set(1);
++    SLsmg_draw_box(top - 1, left - 1, height + 2, width + 2);
++    SLsmg_set_char_set(0);
++
++    if (currentWindow->title) {
++	trim_string (currentWindow->title, width-4);
++	i = wstrlen(currentWindow->title,-1) + 4;
++	i = ((width - i) / 2) + left;
++	SLsmg_gotorc(top - 1, i);
++	SLsmg_set_char_set(1);
++	SLsmg_write_char(SLSMG_RTEE_CHAR);
++	SLsmg_set_char_set(0);
++	SLsmg_write_char(' ');
++	SLsmg_set_color(NEWT_COLORSET_TITLE);
++	write_string_int((char *)currentWindow->title, NULL);
++	SLsmg_set_color(NEWT_COLORSET_BORDER);
++	SLsmg_write_char(' ');
++	SLsmg_set_char_set(1);
++	SLsmg_write_char(SLSMG_LTEE_CHAR);
++	SLsmg_set_char_set(0);
++    }
++
++    SLsmg_set_color(NEWT_COLORSET_WINDOW);
++    SLsmg_fill_region(top, left, height, width, ' ');
++
++    SLsmg_set_color(NEWT_COLORSET_SHADOW);
++    SLsmg_fill_region(top + height + 1, left, 1, width + 2, ' ');
++    SLsmg_fill_region(top, left + width + 1, height + 1, 1, ' ');
++
++    for (i = top; i < (top + height + 1); i++) {
++	SLsmg_gotorc(i, left + width + 1);
++	SLsmg_write_string(" ");
++    }
++
++    return 0;
++}
++
++/**
++ * @brief Draw a centered window.
++ * @param width - width in char cells
++ * @param height - no. of char cells.
++ * @param title - fixed title
++ * @returns 0. No errors reported
++ */
++int newtCenteredWindow(unsigned int width,unsigned int height, 
++                       const char * title) {
++    unsigned int top, left;
++
++    top = (SLtt_Screen_Rows - height) / 2;
++
++    /* I don't know why, but this seems to look better */
++    if ((SLtt_Screen_Rows % 2) && (top % 2)) top--;
++
++    left = (SLtt_Screen_Cols - width) / 2;
++
++    newtOpenWindow(left, top, width, height, title);
++
++    return 0;
++}
++
++/**
++ * @brief Remove the top window
++ */
++void newtPopWindow(void) {
++    int j, row, col;
++    int n = 0;
++
++    row = col = 0;
++
++    row = currentWindow->top - 1;
++    col = currentWindow->left - 1;
++    if (row < 0)
++	row = 0;
++    if (col < 0)
++	col = 0;
++    for (j = 0; j < currentWindow->height + 3; j++, row++) {
++	SLsmg_gotorc(row, col);
++	SLsmg_write_raw(currentWindow->buffer + n,
++			currentWindow->width + 3);
++	n += currentWindow->width + 3;
++    }
++
++    free(currentWindow->buffer);
++    free(currentWindow->title);
++
++    if (currentWindow == windowStack)
++	currentWindow = NULL;
++    else
++	currentWindow--;
++
++    SLsmg_set_char_set(0);
++
++    newtTrashScreen();
++
++    newtRefresh();
++}
++
++void newtGetWindowPos(int * x, int * y) {
++    if (currentWindow) {
++	*x = currentWindow->left;
++	*y = currentWindow->top;
++    } else
++	*x = *y = 0;
++}
++
++void newtGetrc(int * row, int * col) {
++   *row = cursorRow;
++   *col = cursorCol;
++}
++
++void newtGotorc(int newRow, int newCol) {
++    if (currentWindow) {
++	newRow += currentWindow->top;
++	newCol += currentWindow->left;
++    }
++
++    cursorRow = newRow;
++    cursorCol = newCol;
++    SLsmg_gotorc(cursorRow, cursorCol);
++}
++
++void newtDrawBox(int left, int top, int width, int height, int shadow) {
++    if (currentWindow) {
++	top += currentWindow->top;
++	left += currentWindow->left;
++    }
++
++    SLsmg_draw_box(top, left, height, width);
++
++    if (shadow) {
++	SLsmg_set_color(NEWT_COLORSET_SHADOW);
++	SLsmg_fill_region(top + height, left + 1, 1, width - 1, ' ');
++	SLsmg_fill_region(top + 1, left + width, height, 1, ' ');
++    }
++}
++
++void newtClearBox(int left, int top, int width, int height) {
++    if (currentWindow) {
++	top += currentWindow->top;
++	left += currentWindow->left;
++    }
++
++    SLsmg_fill_region(top, left, height, width, ' ');
++}
++
++static void initKeymap(void) {
++    const struct keymap * curr;
++
++    /* First bind built-in default bindings. They may be shadowed by
++       the termcap entries that get bound later. */
++    for (curr = keymap; curr->code; curr++) {
++        if (curr->str)
++            newtBindKey(curr->str,curr->code);
++    }
++
++    /* Then bind strings from termcap entries */
++    for (curr = keymap; curr->code; curr++) {
++	if (curr->tc) {
++            char *pc = SLtt_tgetstr(curr->tc);
++            if (pc) {
++                newtBindKey(pc,curr->code);
++            }
++        }
++    }
++
++    /* Finally, invent lowest-priority keybindings that correspond to
++       searching for esc-O-foo if esc-[-foo was not found and vice
++       versa.  That is needed because of strong confusion among
++       different emulators of VTxxx terminals; some terminfo/termcap
++       descriptions are apparently written by people who were not
++       aware of the differences between "applicataion" and "terminal"
++       keypad modes. Or perhaps they were, but tried to make their
++       description work with a program that puts the keyboard in the
++       wrong emulation mode. In short, one needs this: */
++    kmap_trie_fallback(kmap_trie_escO.contseq, &kmap_trie_escBrack.contseq);
++    kmap_trie_fallback(kmap_trie_escBrack.contseq, &kmap_trie_escO.contseq);
++}
++
++/**
++ * @brief Delay for a specified number of usecs
++ * @param int - number of usecs to wait for.
++ */
++void newtDelay(unsigned int usecs) {
++    fd_set set;
++    struct timeval tv;
++
++    FD_ZERO(&set);
++
++    tv.tv_sec = usecs / 1000000;
++    tv.tv_usec = usecs % 1000000;
++
++    select(0, &set, &set, &set, &tv);
++}
++
++struct eventResult newtDefaultEventHandler(newtComponent c,
++					   struct event ev) {
++    struct eventResult er;
++
++    er.result = ER_IGNORED;
++    return er;
++}
++
++void newtRedrawHelpLine(void) {
++    char * buf;
++
++    SLsmg_set_color(NEWT_COLORSET_HELPLINE);
++
++    if (currentHelpline) {
++	/* buffer size needs to be wide enough to hold all the multibyte
++	   currentHelpline + all the single byte ' ' to fill the line */
++	int wlen = wstrlen(*currentHelpline, -1);
++	int len;
++
++	if (wlen > SLtt_Screen_Cols)
++	    wlen = SLtt_Screen_Cols;
++	len = strlen(*currentHelpline) + (SLtt_Screen_Cols - wlen);
++	buf = alloca(len + 1);
++	memset(buf, ' ', len);
++	memcpy(buf, *currentHelpline, strlen(*currentHelpline));
++	buf[len] = '\0';
++    } else {
++	buf = alloca(SLtt_Screen_Cols + 1);
++	memset(buf, ' ', SLtt_Screen_Cols);
++	buf[SLtt_Screen_Cols] = '\0';
++    }
++    SLsmg_gotorc(SLtt_Screen_Rows - 1, 0);
++    write_string_int(buf, NULL);
++}
++
++void newtPushHelpLine(const char * text) {
++    if (!text)
++	text = defaultHelpLine;
++
++    if (currentHelpline)
++	(*(++currentHelpline)) = strdup(text);
++    else {
++	currentHelpline = helplineStack;
++	*currentHelpline = strdup(text);
++    }
++
++    newtRedrawHelpLine();
++}
++
++void newtPopHelpLine(void) {
++    if (!currentHelpline) return;
++
++    free(*currentHelpline);
++    if (currentHelpline == helplineStack)
++	currentHelpline = NULL;
++    else
++	currentHelpline--;
++
++    newtRedrawHelpLine();
++}
++
++void newtDrawRootText(int col, int row, const char * text) {
++    SLsmg_set_color(NEWT_COLORSET_ROOTTEXT);
++
++    if (col < 0) {
++	col = SLtt_Screen_Cols + col;
++    }
++
++    if (row < 0) {
++	row = SLtt_Screen_Rows + row;
++    }
++
++    SLsmg_gotorc(row, col);
++    write_string_int((char *)text, NULL);
++}
++
++int newtSetFlags(int oldFlags, int newFlags, enum newtFlagsSense sense) {
++    switch (sense) {
++      case NEWT_FLAGS_SET:
++	return oldFlags | newFlags;
++
++      case NEWT_FLAGS_RESET:
++	return oldFlags & (~newFlags);
++
++      case NEWT_FLAGS_TOGGLE:
++	return oldFlags ^ newFlags;
++
++      default:
++	return oldFlags;
++    }
++}
++
++void newtBell(void)
++{
++    SLtt_beep();
++}
++
++void newtGetScreenSize(int * cols, int * rows) {
++    if (rows) *rows = SLtt_Screen_Rows;
++    if (cols) *cols = SLtt_Screen_Cols;
++}
++
++void newtDefaultPlaceHandler(newtComponent c, int newLeft, int newTop) {
++    c->left = newLeft;
++    c->top = newTop;
++}
++
++void newtDefaultMappedHandler(newtComponent c, int isMapped) {
++    c->isMapped = isMapped;
++}
++
++void newtCursorOff(void) {
++    cursorOn = 0;
++    SLtt_set_cursor_visibility (cursorOn);
++}
++
++void newtCursorOn(void) {
++    cursorOn = 1;
++    SLtt_set_cursor_visibility (cursorOn);
++}
++
++void newtTrashScreen(void) {
++    if (trashScreen)
++	SLsmg_touch_lines (0, SLtt_Screen_Rows - 1);
++}
++     
+diff -ruN newt-0.52.11-old/newt_pr.h newt-0.52.11/newt_pr.h
+--- newt-0.52.11-old/newt_pr.h	2009-09-24 16:03:09.000000000 +0100
++++ newt-0.52.11/newt_pr.h	2010-06-21 13:13:02.000000000 +0100
+@@ -84,6 +84,10 @@
+ 					   struct event ev);
+ 
+ int _newt_wstrlen(const char *str, int len);
++void write_string_int(const char *, char *);
++void write_nstring_int(const char *, int, char *);
++char get_text_direction(const char *);
++
+ #define wstrlen(str,len) _newt_wstrlen((str),(len))
+ void trim_string(char *title, int chrs);
+ 
+diff -ruN newt-0.52.11-old/textbox.c newt-0.52.11/textbox.c
+--- newt-0.52.11-old/textbox.c	2009-09-24 16:03:09.000000000 +0100
++++ newt-0.52.11/textbox.c	2010-06-21 13:57:04.000000000 +0100
+@@ -13,6 +13,7 @@
+     char ** lines;
+     int numLines;
+     int linesAlloced;
++    char *blankline;
+     int doWrap;
+     newtComponent sb_act, sb;
+     int topLine;
+@@ -115,6 +116,10 @@
+     tb->topLine = 0;
+     tb->textWidth = width;
+     tb->isActive = 0;
++    tb->blankline = malloc(width+1);
++    memset(tb->blankline,' ',width);
++    tb->blankline[width] = '\0';
++
+ 
+     if (flags & NEWT_FLAG_SCROLL) {
+ 	co->width += 2;
+@@ -363,6 +368,9 @@
+     int i;
+     struct textbox * tb = c->data;
+     int size;
++    char dir = 'N';
++    int newdir = 1;
++    int dw = 0;
+ 
+     if (!c->isMapped)
+ 	    return;
+@@ -380,10 +388,32 @@
+ 
+     SLsmg_set_color(NEWT_COLORSET_TEXTBOX);
+ 
+-    for (i = 0; (i + tb->topLine) < tb->numLines && i < c->height; i++) {
+-	newtGotorc(c->top + i, c->left);
+-	SLsmg_write_nstring(tb->lines[i + tb->topLine], tb->textWidth);
++ 
++    /* find direction of first visible paragraph */
++    for (i = 0; i < tb->topLine; i++) {
++       if (!*tb->lines[i]) {
++           /* new line: new paragraph starts at the next line */
++          newdir = 1;
++          dir = 'N';
++      }
++      else if (newdir) {
++          /* get current paragraph direction, if possible */
++          dir = get_text_direction(tb->lines[i]);
++            newdir = (dir == 'N') ? 1 : 0;
++      }
++    }
++    
++     for (i = 0; (i + tb->topLine) < tb->numLines && i < c->height; i++) {
++        newtGotorc(c->top + i, c->left);
++        SLsmg_write_string(tb->blankline);
++        newtGotorc(c->top + i, c->left);
++        /* BIDI: we need *nstring* here to properly align lines */
++        write_nstring_int(tb->lines[i + tb->topLine], c->width - dw, &dir);
++        /* Does new paragraph follow? */
++        if (!*tb->lines[i + tb->topLine])
++              dir = 'N';
+     }
++
+     /* put cursor at beginning of text for better accessibility */
+     newtGotorc(c->top, c->left);
+ }
+@@ -474,6 +504,7 @@
+     for (i = 0; i < tb->numLines; i++) 
+ 	free(tb->lines[i]);
+     free(tb->lines);
++    free(tb->blankline);
+     free(tb);
+     free(co);
+ }
--- newt-0.52.11.orig/debian/patches/001_python.patch
+++ newt-0.52.11/debian/patches/001_python.patch
@@ -0,0 +1,12 @@
+diff -ruN newt-0.52.11-old/Makefile.in newt-0.52.11/Makefile.in
+--- newt-0.52.11-old/Makefile.in	2008-07-30 13:42:55.000000000 +0100
++++ newt-0.52.11/Makefile.in	2009-04-17 12:30:52.000000000 +0100
+@@ -11,7 +11,7 @@
+ TAG = r$(subst .,-,$(VERSION))
+ SONAME = @SONAME@
+ 
+-PYTHONVERS = @PYTHONVERS@
++PYTHONVERS =  $(shell pyversions --supported)
+ WHIPTCLSO = @WHIPTCLSO@
+ 
+ PROGS = test whiptail $(WHIPTCLSO) testgrid testtree showchars showkey
--- newt-0.52.11.orig/debian/patches/400_python_memory_allocation.patch
+++ newt-0.52.11/debian/patches/400_python_memory_allocation.patch
@@ -0,0 +1,30 @@
+diff -ruN newt-0.52.11-old/snackmodule.c newt-0.52.11/snackmodule.c
+--- newt-0.52.11-old/snackmodule.c	2008-07-30 13:42:55.000000000 +0100
++++ newt-0.52.11/snackmodule.c	2009-04-20 21:31:38.000000000 +0100
+@@ -273,7 +273,7 @@
+ static snackWidget * snackWidgetNew (void) {
+     snackWidget * widget;
+      
+-    widget = PyObject_NEW(snackWidget, &snackWidgetType);
++    widget = PyObject_New(snackWidget, &snackWidgetType);
+ 
+     widget->scs.cb = NULL;
+     widget->scs.data = NULL;
+@@ -790,7 +790,7 @@
+     if (help == Py_None)
+ 	help = NULL;
+ 
+-    form = PyObject_NEW(snackForm, &snackFormType);
++    form = PyObject_New(snackForm, &snackFormType);
+     form->fo = newtForm(NULL, help, 0);
+ 
+     return form;
+@@ -802,7 +802,7 @@
+ 
+     if (!PyArg_ParseTuple(args, "ii", &cols, &rows)) return NULL;
+ 
+-    grid = PyObject_NEW(snackGrid, &snackGridType);
++    grid = PyObject_New(snackGrid, &snackGridType);
+     grid->grid = newtCreateGrid(cols, rows);
+ 
+     return grid;
--- newt-0.52.11.orig/debian/patches/700_escape-key.patch
+++ newt-0.52.11/debian/patches/700_escape-key.patch
@@ -0,0 +1,11 @@
+diff -ruN newt-0.52.11-old/form.c newt-0.52.11/form.c
+--- newt-0.52.11-old/form.c	2009-09-24 16:03:09.000000000 +0100
++++ newt-0.52.11/form.c	2010-06-21 13:09:31.000000000 +0100
+@@ -474,6 +474,7 @@
+     if (!(form->flags & NEWT_FLAG_NOF12)) {
+ 	newtFormAddHotKey(co, NEWT_KEY_F12);
+     }
++    newtFormAddHotKey (co, NEWT_KEY_ESCAPE);
+ 
+     if (vertBar)
+ 	form->vertBar = vertBar;
--- newt-0.52.11.orig/debian/tests/bug557960.py
+++ newt-0.52.11/debian/tests/bug557960.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+
+# bug557960: segfault on second call to SnackScreen.
+
+from snack import *
+
+s = SnackScreen()
+g = Grid(1, 1)
+ok = Button("Ok")
+g.setField(ok, 0, 0)
+s.gridWrappedWindow(g, "Ok")
+F = Form()
+F.add(ok)
+res = F.run()
+s.popWindow()
+s.finish()
+
+print "New screen"
+s = SnackScreen()
+# print "We do not get here if run in screen."
+g = Grid(1, 1)
+ok = Button("Ok")
+g.setField(ok, 0, 0)
+s.gridWrappedWindow(g, "segfaults in screen")
+F = Form()
+F.add(ok)
+res = F.run()
+s.popWindow()
+s.finish()
+