Hello community,

here is the log from the commit of package libyui-ncurses for openSUSE:Factory 
checked in at 2020-09-03 01:09:44
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libyui-ncurses (Old)
 and      /work/SRC/openSUSE:Factory/.libyui-ncurses.new.3399 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libyui-ncurses"

Thu Sep  3 01:09:44 2020 rev:58 rq:829931 version:2.56.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/libyui-ncurses/libyui-ncurses.changes    
2020-08-20 22:26:18.439910562 +0200
+++ /work/SRC/openSUSE:Factory/.libyui-ncurses.new.3399/libyui-ncurses.changes  
2020-09-03 01:10:09.472387060 +0200
@@ -1,0 +2,6 @@
+Thu Aug 27 08:27:14 UTC 2020 - Martin Vidner <[email protected]>
+
+- Fix changing a single cell in a sorted table (bsc#1165388, bsc#1174615)
+- 2.56.2
+
+-------------------------------------------------------------------

Old:
----
  libyui-ncurses-2.56.1.tar.bz2

New:
----
  libyui-ncurses-2.56.2.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libyui-ncurses-doc.spec ++++++
--- /var/tmp/diff_new_pack.q2saVP/_old  2020-09-03 01:10:10.964387557 +0200
+++ /var/tmp/diff_new_pack.q2saVP/_new  2020-09-03 01:10:10.968387559 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package libyui-ncurses-doc
 #
-# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,7 +12,7 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
@@ -20,7 +20,7 @@
 %define so_version 13
 
 Name:           %{parent}-doc
-Version:        2.56.1
+Version:        2.56.2
 Release:        0
 Source:         %{parent}-%{version}.tar.bz2
 
@@ -35,7 +35,7 @@
 # YLabel::setAutoWrap()
 BuildRequires:  libyui-devel >= 3.10.0
 
-Url:            http://github.com/libyui/
+URL:            http://github.com/libyui/
 Summary:        Libyui-ncurses documentation
 License:        LGPL-2.1-only OR LGPL-3.0-only
 Group:          Documentation/HTML

++++++ libyui-ncurses.spec ++++++
--- /var/tmp/diff_new_pack.q2saVP/_old  2020-09-03 01:10:10.992387566 +0200
+++ /var/tmp/diff_new_pack.q2saVP/_new  2020-09-03 01:10:10.992387566 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package libyui-ncurses
 #
-# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,12 +12,12 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
 Name:           libyui-ncurses
-Version:        2.56.1
+Version:        2.56.2
 Release:        0
 Source:         %{name}-%{version}.tar.bz2
 
@@ -38,7 +38,7 @@
 BuildRequires:  %{libyui_devel_version}
 BuildRequires:  ncurses-devel
 
-Url:            http://github.com/libyui/
+URL:            http://github.com/libyui/
 Summary:        Libyui - Character Based User Interface
 License:        LGPL-2.1-only OR LGPL-3.0-only
 Group:          System/Libraries
@@ -57,7 +57,7 @@
 Obsoletes:      yast2-ncurses < 2.42.0
 Provides:       yui_backend = %{so_version}
 
-Url:            http://github.com/libyui/
+URL:            http://github.com/libyui/
 Summary:        Libyui - Character Based User Interface
 Group:          System/Libraries
 
@@ -80,7 +80,7 @@
 Requires:       libstdc++-devel
 Requires:       ncurses-devel
 
-Url:            http://github.com/libyui/
+URL:            http://github.com/libyui/
 Summary:        Libyui-ncurses header files
 Group:          Development/Languages/C and C++
 
@@ -94,7 +94,7 @@
 
 %package tools
 
-Url:            http://github.com/libyui/
+URL:            http://github.com/libyui/
 Summary:        Libyui-ncurses tools
 # conflict with libyui-ncurses8, /usr/bin/libyui-terminal was originally there
 Group:          System/Libraries

++++++ libyui-ncurses-2.56.1.tar.bz2 -> libyui-ncurses-2.56.2.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-ncurses-2.56.1/VERSION.cmake 
new/libyui-ncurses-2.56.2/VERSION.cmake
--- old/libyui-ncurses-2.56.1/VERSION.cmake     2020-08-17 12:29:15.000000000 
+0200
+++ new/libyui-ncurses-2.56.2/VERSION.cmake     2020-08-27 10:52:58.000000000 
+0200
@@ -1,6 +1,6 @@
 SET( VERSION_MAJOR "2" )
 SET( VERSION_MINOR "56" )
-SET( VERSION_PATCH "1" )
+SET( VERSION_PATCH "2" )
 SET( VERSION 
"${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${GIT_SHA1_VERSION}" )
 
 ##### This is needed for the libyui core ONLY.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libyui-ncurses-2.56.1/package/libyui-ncurses-doc.spec 
new/libyui-ncurses-2.56.2/package/libyui-ncurses-doc.spec
--- old/libyui-ncurses-2.56.1/package/libyui-ncurses-doc.spec   2020-08-17 
12:29:15.000000000 +0200
+++ new/libyui-ncurses-2.56.2/package/libyui-ncurses-doc.spec   2020-08-27 
10:52:58.000000000 +0200
@@ -19,7 +19,7 @@
 %define so_version 13
 
 Name:           %{parent}-doc
-Version:        2.56.1
+Version:        2.56.2
 Release:        0
 Source:         %{parent}-%{version}.tar.bz2
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-ncurses-2.56.1/package/libyui-ncurses.changes 
new/libyui-ncurses-2.56.2/package/libyui-ncurses.changes
--- old/libyui-ncurses-2.56.1/package/libyui-ncurses.changes    2020-08-17 
12:29:15.000000000 +0200
+++ new/libyui-ncurses-2.56.2/package/libyui-ncurses.changes    2020-08-27 
10:52:58.000000000 +0200
@@ -1,4 +1,10 @@
 -------------------------------------------------------------------
+Thu Aug 27 08:27:14 UTC 2020 - Martin Vidner <[email protected]>
+
+- Fix changing a single cell in a sorted table (bsc#1165388, bsc#1174615)
+- 2.56.2
+
+-------------------------------------------------------------------
 Wed Aug 12 15:46:18 UTC 2020 - José Iván López González <[email protected]>
 
 - Handle hot-keys for top level menu options.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-ncurses-2.56.1/package/libyui-ncurses.spec 
new/libyui-ncurses-2.56.2/package/libyui-ncurses.spec
--- old/libyui-ncurses-2.56.1/package/libyui-ncurses.spec       2020-08-17 
12:29:15.000000000 +0200
+++ new/libyui-ncurses-2.56.2/package/libyui-ncurses.spec       2020-08-27 
10:52:58.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           libyui-ncurses
-Version:        2.56.1
+Version:        2.56.2
 Release:        0
 Source:         %{name}-%{version}.tar.bz2
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-ncurses-2.56.1/src/NCPad.cc 
new/libyui-ncurses-2.56.2/src/NCPad.cc
--- old/libyui-ncurses-2.56.1/src/NCPad.cc      2020-08-17 12:29:15.000000000 
+0200
+++ new/libyui-ncurses-2.56.2/src/NCPad.cc      2020-08-27 10:52:58.000000000 
+0200
@@ -131,12 +131,12 @@
 
         if ( ! pageing() )
         {
-       return copywin( *destwin,
-                       srect.Pos.L, srect.Pos.C,
-                       drect.Pos.L, drect.Pos.C,
-                       maxdpos.L,   maxdpos.C,
-                       false );
-    }
+           return copywin( *destwin,
+                           srect.Pos.L, srect.Pos.C,
+                           drect.Pos.L, drect.Pos.C,
+                           maxdpos.L,   maxdpos.C,
+                           false /* are blanks transparent */);
+       }
 
         // Here: Table is pageing, so we must prepare the visible lines
         // on the Pad before we're copying them to the destwin:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-ncurses-2.56.1/src/NCPad.h 
new/libyui-ncurses-2.56.2/src/NCPad.h
--- old/libyui-ncurses-2.56.1/src/NCPad.h       2020-08-17 12:29:15.000000000 
+0200
+++ new/libyui-ncurses-2.56.2/src/NCPad.h       2020-08-27 10:52:58.000000000 
+0200
@@ -31,14 +31,21 @@
 #include "NCWidget.h"
 
 
+//! Interface for scroll callbacks
 class NCSchrollCB
 {
 public:
 
     virtual ~NCSchrollCB() {}
 
+    /// @param total    virtual size
+    /// @param visible  size of the visible part
+    /// @param start    position of the visible part
     virtual void HScroll( unsigned total, unsigned visible, unsigned start ) {}
 
+    /// @param total    virtual size
+    /// @param visible  size of the visible part
+    /// @param start    position of the visible part
     virtual void VScroll( unsigned total, unsigned visible, unsigned start ) {}
 
     virtual void ScrollHead( NCursesWindow & w, unsigned ccol ) {}
@@ -46,7 +53,10 @@
     virtual void AdjustPadSize( wsze & minsze ) {}
 };
 
-
+/**
+ * Forward the scroll callbacks to another object.
+ * By default it forwards to itself
+ */
 class NCScrollHint : protected NCSchrollCB
 {
 private:
@@ -83,13 +93,22 @@
 
 public:
 
-    // set redirect
-    void SendSchrollCB( NCSchrollCB * to ) { redirect = ( to ? to : this ); }
+    //! Set the receiver of callbacks to *dest*
+    void SendSchrollCB( NCSchrollCB * dest ) { redirect = ( dest ? dest : this 
); }
 
     virtual void SendHead() {}
 };
 
 
+/// A virtual window with a real viewport (which is NCursesWindow)
+/// and a scrolling mechanism.
+///
+/// In the underlying C ncurses library, a *pad* is a virtual window without a
+/// position.  Of course that is not very useful without any way to display it
+/// so there's a `prefresh` function to draw a portion of that pad into a
+/// visible "viewport" window. Our NCursesPad fork just directly forwards to
+/// `prefresh` without remembering the window. Upstream NCursesPad does know a
+/// viewport window and so does NCPad (*destwin*).
 class NCPad : public NCursesPad, public NCScrollHint
 {
 private:
@@ -113,13 +132,14 @@
 
     const NCWidget & parw;
 
-    NCursesWindow * destwin;
+    NCursesWindow * destwin; ///< Where to draw us (may be nullptr, not owned)
+    ///< Destination rectangle: (Pos is always 0, 0)
     wrect drect;
-    wrect srect;
+    wrect srect;           ///< Source rectangle: the visible part of this pad
     wpos  maxdpos;
     wpos  maxspos;
 
-    bool  dclear;
+    bool  dclear; ///< should destwin be cleared before contents is copied 
there
     bool  dirty;
 
     /** The (virtual) height of the Pad (even if truncated). */
@@ -130,8 +150,10 @@
 
     virtual int dirtyPad() { dirty = false; return setpos( CurPos() ); }
 
+    /// Set the visible position to *newpos* (but clamp by *maxspos*), then 
\ref update.
     virtual int setpos( const wpos & newpos );
 
+    /// Adjust CurPos relatively by *offset*
     int adjpos( const wpos & offset )
     {
        return setpos( CurPos() + offset );
@@ -152,6 +174,7 @@
 
 public:
 
+    /// @param p (used just for styling info, NOT sizing)
     NCPad( int lines, int cols, const NCWidget & p );
     virtual ~NCPad() {}
 
@@ -159,9 +182,12 @@
 
     NCursesWindow * Destwin() { return destwin; }
 
+    /// @param dwin (not owned)
     virtual void Destwin( NCursesWindow * dwin );
 
     virtual void resize( wsze nsze );
+    // OMFG this little overload does something completely different than
+    // the one above
     virtual int resize( int lines, int columns ) { return 
NCursesWindow::resize(lines, columns );}
     virtual void wRecoded();
     virtual void setDirty() { dirty = true; }
@@ -176,11 +202,13 @@
        return setpos( newpos );
     }
 
+    /// Scroll to a line, keeping the column
     int ScrlLine( int line )
     {
        return setpos( wpos( line, srect.Pos.C ) );
     }
 
+    /// Scroll to a column, keeping the line
     int ScrlCol( int col )
     {
        return setpos( wpos( srect.Pos.L, col ) );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-ncurses-2.56.1/src/NCPadWidget.cc 
new/libyui-ncurses-2.56.2/src/NCPadWidget.cc
--- old/libyui-ncurses-2.56.1/src/NCPadWidget.cc        2020-08-17 
12:29:15.000000000 +0200
+++ new/libyui-ncurses-2.56.2/src/NCPadWidget.cc        2020-08-27 
10:52:58.000000000 +0200
@@ -26,7 +26,25 @@
 #include <yui/YUILog.h>
 #include "NCPadWidget.h"
 
-
+/**
+ * Scrollbar indicator.
+ *
+ * It's a dumb indicator: it does not react to keyboard events (class FIXME
+ * does it instead)
+ *
+ * Appearance details:
+ *
+ * Suppose we have a horizontal scrollbar 10 cells wide: ~~===~~~~~
+ * The visible part of the scrolled contents is indicated by the BAR,
+ * here 3 cells wide. (The bar is also known as "slider", "puck", "elevator")
+ *
+ * Unlike in GUIs we have no arrows at the ends of the scrollbar because we
+ * can't read the mouse clicks anyway.
+ *
+ * If the scrollbar gets shrunk to size 1 or 2, it is drawn with arrows
+ * meaning there is something in the pointed direction.
+ *
+ */
 class NCScrollbar
 {
 public:
@@ -35,23 +53,24 @@
 
 private:
 
-    chtype ch_forward;
-    chtype ch_backward;
-    chtype ch_barbeg;
-    chtype ch_barend;
-    chtype ch_barone;
-
-    const NCWidget & parw;
-    NCursesWindow *  win;
-    orientation      type;
-    unsigned        len;
-
-    unsigned total;
-    unsigned visible;
-    unsigned at;
+    chtype ch_forward;    //!< draw an arrow pointing down/right
+    chtype ch_backward;   //!< draw an arrow pointing up/left
+    chtype ch_barbeg;     //!< draw the top/left end of the bar (elevator)
+    chtype ch_barend;     //!< draw the bottom/right end of the bar (elavator)
+    chtype ch_barone; //!< draw a bar (elevator) that has the smallest visible 
length of 1
+
+    const NCWidget & parw;      //!< parent widget
+    NCursesWindow *  win;       //!< where this indicator draws itself
+    orientation      type;      //!< horizontal or vertical
+    unsigned        len;       //!< the length of this indicator in cells
+
+    unsigned total;             //!< 0 to total is the virtual size
+    unsigned visible;           //!< size of the visible part
+    unsigned at;                //!< position of the visible part
 
 private:
 
+    // Clamp *visible* and *at* so that visible <= visible + at <= total
     void adjust()
     {
        if ( visible > total )
@@ -67,6 +86,7 @@
        }
     }
 
+    // line starting at *p*, length *l*
     void draw_line( unsigned p, unsigned l, chtype ch = 0 )
     {
        if ( !l )
@@ -205,6 +225,11 @@
 
 public:
 
+    /// @param parwid parent widget
+    /// @param par window of parent widget
+    /// @param p position relative to parent window
+    /// @param l length of self (width if horizontal, height if vertical)
+    /// @param orient horizontal or vertical
     NCScrollbar( const NCWidget & parwid, NCursesWindow & par, wpos p, 
unsigned l, orientation orient )
            : ch_forward( orient == HORZ ? ACS_RARROW : ACS_DARROW )
            , ch_backward( orient == HORZ ? ACS_LARROW : ACS_UARROW )
@@ -242,6 +267,12 @@
 
 public:
 
+    /// Set the indicator. The arguments use the same units,
+    /// independent of the indicator's screen size.
+    ///
+    /// @param tot   total virtual size
+    /// @param vis   size of the visible part
+    /// @param start position of the visible part
     void set( unsigned tot, unsigned vis, unsigned start )
     {
        total   = tot;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-ncurses-2.56.1/src/NCPadWidget.h 
new/libyui-ncurses-2.56.2/src/NCPadWidget.h
--- old/libyui-ncurses-2.56.1/src/NCPadWidget.h 2020-08-17 12:29:15.000000000 
+0200
+++ new/libyui-ncurses-2.56.2/src/NCPadWidget.h 2020-08-27 10:52:58.000000000 
+0200
@@ -33,7 +33,9 @@
 class NCPadWidget;
 class NCScrollbar;
 
-
+/**
+ * Base class for widgets with scrollable contents
+ */
 class NCPadWidget : public NCWidget, protected NCSchrollCB
 {
 private:
@@ -45,13 +47,13 @@
 
 
     NClabel        label;
-    NCursesWindow * padwin;
-    NCScrollbar *   hsb;
-    NCScrollbar *   vsb;
+    NCursesWindow * padwin;    ///< (owned IFF different from NCWidget::*win*)
+    NCScrollbar *   hsb;               ///< (owned)
+    NCScrollbar *   vsb;               ///< (owned)
 
     wsze  minPadSze;
     bool  multidraw;
-    NCPad * pad;
+    NCPad * pad;                ///< (owned)
 
 protected:
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-ncurses-2.56.1/src/NCTable.cc 
new/libyui-ncurses-2.56.2/src/NCTable.cc
--- old/libyui-ncurses-2.56.1/src/NCTable.cc    2020-08-17 12:29:15.000000000 
+0200
+++ new/libyui-ncurses-2.56.2/src/NCTable.cc    2020-08-27 10:52:58.000000000 
+0200
@@ -133,9 +133,13 @@
 
 void NCTable::cellChanged( const YTableCell *cell )
 {
-
-    cellChanged( cell->itemIndex(), cell->column(), cell->label() );
-
+    int id = cell->itemIndex(); // index at insertion time, before sorting
+    int index = myPad()->findIndexById(id); // convert to index after sorting
+    if (index == -1) {
+       // should not happen
+       return;
+    }
+    cellChanged( index, cell->column(), cell->label() );
 }
 
 
@@ -328,6 +332,11 @@
     if ( !myPad()->Lines() )
        return -1;
 
+    // The intent of this condition is to return the original index, before
+    // sorting. But the condition was accidentally inverted in 2007 and now it
+    // always returns the index after sorting.
+    // Should we fix it? Depends on whether the current users rely on the
+    // current behavior.
     return keepSorting() ? myPad()->GetLine( myPad()->CurPos().L )->getIndex()
           : myPad()->CurPos().L;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-ncurses-2.56.1/src/NCTable.h 
new/libyui-ncurses-2.56.2/src/NCTable.h
--- old/libyui-ncurses-2.56.1/src/NCTable.h     2020-08-17 12:29:15.000000000 
+0200
+++ new/libyui-ncurses-2.56.2/src/NCTable.h     2020-08-27 10:52:58.000000000 
+0200
@@ -31,7 +31,9 @@
 #include "NCPadWidget.h"
 #include "NCTablePad.h"
 
-
+/**
+ * A table with rows and columns.
+ */
 class NCTable : public YTable, public NCPadWidget
 {
 public:
@@ -60,6 +62,7 @@
     virtual void addItems( const YItemCollection & itemCollection );
     virtual void deleteAllItems();
 
+    /// -1 for an empty table
     virtual int getCurrentItem() const;
     YItem * getCurrentItemPointer();
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-ncurses-2.56.1/src/NCTableItem.cc 
new/libyui-ncurses-2.56.2/src/NCTableItem.cc
--- old/libyui-ncurses-2.56.1/src/NCTableItem.cc        2020-08-17 
12:29:15.000000000 +0200
+++ new/libyui-ncurses-2.56.2/src/NCTableItem.cc        2020-08-27 
10:52:58.000000000 +0200
@@ -303,11 +303,6 @@
     return str;
 }
 
-
-
-
-
-
 void NCTableHead::DrawAt( NCursesWindow & w, const wrect at,
                          NCTableStyle & tableStyle,
                          bool active ) const
@@ -326,10 +321,6 @@
 }
 
 
-
-
-
-
 NCTableStyle::NCTableStyle( const NCWidget & p )
        : headline( 0 )
        , colWidth( 0 )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-ncurses-2.56.1/src/NCTableItem.h 
new/libyui-ncurses-2.56.2/src/NCTableItem.h
--- old/libyui-ncurses-2.56.1/src/NCTableItem.h 2020-08-17 12:29:15.000000000 
+0200
+++ new/libyui-ncurses-2.56.2/src/NCTableItem.h 2020-08-27 10:52:58.000000000 
+0200
@@ -35,7 +35,9 @@
 class NCTableStyle;
 class NCTableCol;
 
-
+/// One line in a NCTable.
+///
+/// NOTE: "col", "column", here mean one cell only, not the entire table 
column.
 class NCTableLine
 {
 
@@ -58,19 +60,22 @@
 
 private:
 
-    std::vector<NCTableCol*> Items;
+    std::vector<NCTableCol*> Items; ///< cells (owned)
+
 
     void assertCol( unsigned idx );
 
     unsigned state;
 
+    /// Index in a collection of other lines ?.
+    /// This class does not care, just holds the data for others.
     int index;
 
-    YTableItem *yitem;
+    YTableItem *yitem;          ///< not owned
 
     
 protected:
-    
+    // this should have been an argument for DrawItems
     mutable STATE vstate;
 
 
@@ -132,8 +137,10 @@
 
     virtual unsigned Hotspot( unsigned & at ) const { at = 0; return 0; }
 
+    /// update *TableStyle* so that this line fits in
     virtual void UpdateFormat( NCTableStyle & TableStyle );
 
+    /// @param active is the table cursor here
     virtual void DrawAt( NCursesWindow & w, const wrect at,
                         NCTableStyle & tableStyle,
                         bool active ) const;
@@ -142,7 +149,13 @@
 };
 
 
-
+/// One cell in a NCTable: (label, style).
+///
+/// NOTE that the name of this class suggests "column" but it is not the
+/// entire column, just one cell (a column for one line).
+///
+/// The style (NCTableCol::STYLE) is just color information,
+/// don't confuse with table sizing+alignment info, NCTableStyle.
 class NCTableCol
 {
 
@@ -198,7 +211,7 @@
 };
 
 
-
+/// The header/heading line of a NCTable.
 class NCTableHead : public NCTableLine
 {
 
@@ -218,7 +231,7 @@
 };
 
 
-
+/// Styling for a NCTable: column widths, alignment and colors.
 class NCTableStyle
 {
 
@@ -227,14 +240,15 @@
 private:
 
     NCTableHead                headline;
-    std::vector<unsigned>      colWidth;
-    std::vector<NC::ADJUST>    colAdjust;
+    std::vector<unsigned>      colWidth;  ///< column widths
+    std::vector<NC::ADJUST>    colAdjust; ///< column alignment
 
     const NCWidget & parw;
 
+    /// total width of space between adjacent columns, including the separator 
character
     unsigned colSepwidth;
-    chtype   colSepchar;
-    unsigned hotCol;
+    chtype   colSepchar;       ///< column separator character
+    unsigned hotCol;           ///< which column is "hot"
 
 public:
 
@@ -243,9 +257,15 @@
     NCTableStyle( const NCWidget & p );
     ~NCTableStyle() {}
 
+    /// Reset columns, setting their alignment and optionally titles.
+    /// Column widths are zeroed.
+    /// @param head List of strings where their first character
+    ///   is the alignment (L, R, C) and the optional rest is the column 
heading
+    /// @return do we have a column heading
     bool SetStyleFrom( const std::vector<NCstring> & head );
     void SetSepChar( const chtype sepchar )    { colSepchar = sepchar; }
 
+    /// total width of space between adjacent columns, including the separator 
character
     void SetSepWidth( const unsigned sepwidth ) { colSepwidth = sepwidth; }
 
     void SetHotCol( int hcol )
@@ -253,6 +273,7 @@
        hotCol = ( hcol < 0 || Cols() <= ( unsigned )hcol ) ? -1 : hcol;
     }
 
+    /// Forget sizing based on table content, resize according to headline only
     void ResetToMinCols()
     {
        colWidth.clear();
@@ -260,6 +281,7 @@
        headline.UpdateFormat( *this );
     }
 
+    /// Ensure we know width and alignment for at least *num* columns.
     void AssertMinCols( unsigned num )
     {
        if ( colWidth.size() < num )
@@ -269,6 +291,9 @@
        }
     }
 
+    /// Update colWidth[num] to be at least *val*.
+    /// @param num column number (may be bigger than previously)
+    /// @param val width of that column for some line
     void MinColWidth( unsigned num, unsigned val )
     {
        AssertMinCols( num );
@@ -307,6 +332,7 @@
 
     const NCTableLine & Headline() const { return headline; }
 
+    /// Add up the widths of columns with the separators
     unsigned TableWidth() const
     {
        unsigned twidth = 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-ncurses-2.56.1/src/NCTablePad.cc 
new/libyui-ncurses-2.56.2/src/NCTablePad.cc
--- old/libyui-ncurses-2.56.1/src/NCTablePad.cc 2020-08-17 12:29:15.000000000 
+0200
+++ new/libyui-ncurses-2.56.2/src/NCTablePad.cc 2020-08-27 10:52:58.000000000 
+0200
@@ -220,7 +220,18 @@
     return 0;
 }
 
-
+int NCTablePad::findIndexById(int id) const
+{
+    auto begin = Items.begin();
+    auto end = Items.end();
+    auto found = find_if(begin, end, [id](NCTableLine * line) {
+        return line->getIndex() == id;
+    });
+    if (found == end)
+       return -1;
+    else
+       return found - begin;
+}
 
 bool NCTablePad::SetHeadline( const std::vector<NCstring> & head )
 {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-ncurses-2.56.1/src/NCTablePad.h 
new/libyui-ncurses-2.56.2/src/NCTablePad.h
--- old/libyui-ncurses-2.56.1/src/NCTablePad.h  2020-08-17 12:29:15.000000000 
+0200
+++ new/libyui-ncurses-2.56.2/src/NCTablePad.h  2020-08-27 10:52:58.000000000 
+0200
@@ -36,7 +36,7 @@
 class NCTableLine;
 class NCTableCol;
 
-
+/// Just a pair: column number, reverse flag.
 class NCTableSortStrategyBase
 {
 public:
@@ -65,10 +65,10 @@
 };
 
 
-
 class NCTableSortDefault : public NCTableSortStrategyBase
 {
 public:
+    /// sort in place
     virtual void sort ( std::vector<NCTableLine *>::iterator itemsBegin,
                        std::vector<NCTableLine *>::iterator itemsEnd ) 
override;
 
@@ -96,18 +96,21 @@
 
 };
 
-
-
+/// A column (1 cell) used as a selection marker: `[ ]`/`[x]` or `( )`/`(x)`.
 class NCTableTag : public NCTableCol
 {
 private:
 
-    YItem *yitem;
+    YItem *yitem; ///< (not owned, never nullptr, should have been a reference)
     bool selected;
     bool single_selection;
 
 public:
 
+    /// @param item (must not be nullptr, not owned)
+    /// @param sel currently selected, draw an `x` inside
+    /// @param single_sel if true  draw this in a radio-button style `(x)`;
+    ///                   if false draw this in a checkbox style     `[x]`
     NCTableTag( YItem *item, bool sel = false, bool single_sel = false )
         : NCTableCol( NCstring( single_sel ? "( )" : "[ ]" ), SEPARATOR )
         , yitem( item )
@@ -146,7 +149,7 @@
 };
 
 
-
+/// A NCPad for a NCTable
 class NCTablePad : public NCPad
 {
 
@@ -159,16 +162,17 @@
 
     NCursesPad Headpad;
     bool       dirtyHead;
-    bool       dirtyFormat;
+    bool       dirtyFormat;    ///< does table format (size) need recalculating
 
     NCTableStyle        ItemStyle;
     NCTableLine                 Headline;
-    std::vector<NCTableLine*> Items;
-    wpos                citem;
+    std::vector<NCTableLine*> Items; ///< (owned)
+    wpos                citem;      ///< current/cursor position
 
     std::unique_ptr<NCTableSortStrategyBase> sortStrategy;
 
-    void assertLine( unsigned idx );
+    /// ensure a line with *index* exists
+    void assertLine( unsigned index );
 
 protected:
 
@@ -193,6 +197,7 @@
 
     virtual void wRecoded();
 
+    /// CurPos().L is the index of the selected item
     virtual wpos CurPos() const;
     virtual bool handleInput( wint_t key );
 
@@ -204,6 +209,9 @@
               : wsze( Lines(), ItemStyle.TableWidth() );
     }
 
+    /// Sort by *column*; if that is the sorting column already, sort in
+    /// reverse order if *do_reverse*.
+    /// Do nothing if column < 0.
     void setOrder( int column, bool do_reverse = false );
 
     void sort();
@@ -233,13 +241,16 @@
        ItemStyle.SetHotCol( hcol );
     }
 
+    /// Table columns (logical, not screen)
     unsigned Cols()  const { return ItemStyle.Cols(); }
 
+    /// Table lines (logical, not screen)
     unsigned Lines() const { return Items.size(); }
 
     unsigned HotCol()const { return ItemStyle.HotCol(); }
 
-    void     SetLines( unsigned idx );
+    /// Expand or shrink to have exactly *count* logical lines
+    void     SetLines( unsigned count );
     void     SetLines( std::vector<NCTableLine*> & nItems );
     void     ClearTable()  { SetLines( 0 ); }
 
@@ -250,14 +261,28 @@
        AddLine( Lines(), new NCTableLine( nItems, index ) );
     }
 
+    /// Add *item* at position *idx*, expanding if needed
+    /// @param item we take ownership
+    /// @deprecated Used only by Append; meaning after sorting is undefined
     void AddLine( unsigned idx, NCTableLine * item );
+
+    /// blanks out the line at *idx*
+    /// @deprecated Unused
     void DelLine( unsigned idx );
 
     const NCTableLine * GetLine( unsigned idx ) const;
+    /// Return line at *idx* and mark it as modified
     NCTableLine *      ModifyLine( unsigned idx );
 
+    /// Find the item index in a sorted table.
+    /// Return -1 if not found.
+    /// An item/line remembers its insertion index...
+    /// @param id the index before sorting
+    int findIndexById(int id) const;
+
     void stripHotkeys();
 
+    /// @param newSortStrategy (we take ownership)
     void setSortStrategy ( NCTableSortStrategyBase * newSortStrategy ) // dyn. 
allocated
     {
         if ( newSortStrategy != 0 )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-ncurses-2.56.1/src/NCWidget.h 
new/libyui-ncurses-2.56.2/src/NCWidget.h
--- old/libyui-ncurses-2.56.1/src/NCWidget.h    2020-08-17 12:29:15.000000000 
+0200
+++ new/libyui-ncurses-2.56.2/src/NCWidget.h    2020-08-27 10:52:58.000000000 
+0200
@@ -100,7 +100,7 @@
 
 protected:
 
-    NCursesWindow * win;
+    NCursesWindow * win;        ///< (owned)
     wsze           defsze;
     wrect          framedim;
     wrect          inparent;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-ncurses-2.56.1/src/NCstring.cc 
new/libyui-ncurses-2.56.2/src/NCstring.cc
--- old/libyui-ncurses-2.56.1/src/NCstring.cc   2020-08-17 12:29:15.000000000 
+0200
+++ new/libyui-ncurses-2.56.2/src/NCstring.cc   2020-08-27 10:52:58.000000000 
+0200
@@ -37,10 +37,6 @@
 std::string    NCstring::termEncoding( "UTF-8" );
 
 
-
-
-
-
 NCstring:: NCstring()
        : hotk( 0 )
        , hotp( std::wstring::npos )
@@ -50,7 +46,6 @@
 }
 
 
-
 NCstring::NCstring( const NCstring & nstr )
        : hotk( nstr.hotk )
        , hotp( nstr.hotp )
@@ -59,7 +54,6 @@
 }
 
 
-
 NCstring::NCstring( const std::wstring & widestr )
        : hotk( 0 )
        , hotp( std::wstring::npos )
@@ -68,7 +62,6 @@
 }
 
 
-
 NCstring::NCstring( const std::string & str )
        : hotk( 0 )
        , hotp( std::wstring::npos )
@@ -82,7 +75,6 @@
 }
 
 
-
 NCstring::NCstring( const char * cstr )
        : hotk( 0 )
        , hotp( std::wstring::npos )
@@ -96,14 +88,12 @@
 }
 
 
-
 std::ostream & operator<<( std::ostream & str, const NCstring & obj )
 {
     return str <<  obj.Str() ;
 }
 
 
-
 NCstring & NCstring::operator=( const NCstring & nstr )
 {
     if ( &nstr != this )
@@ -117,7 +107,6 @@
 }
 
 
-
 NCstring & NCstring::operator+=( const NCstring & nstr )
 {
     wstr.append( nstr.wstr );
@@ -309,7 +298,6 @@
 }
 
 
-
 std::string NCstring::Str() const
 {
     std::string utf8str;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-ncurses-2.56.1/src/NCstring.h 
new/libyui-ncurses-2.56.2/src/NCstring.h
--- old/libyui-ncurses-2.56.1/src/NCstring.h    2020-08-17 12:29:15.000000000 
+0200
+++ new/libyui-ncurses-2.56.2/src/NCstring.h    2020-08-27 10:52:58.000000000 
+0200
@@ -29,18 +29,28 @@
 #include <string>
 
 
+/// A string with an optional hot key.
+///
+/// The current implementation stores a std::wstring.
 class NCstring
 {
 private:
 
     friend std::ostream & operator<<( std::ostream & str, const NCstring & obj 
);
 
-
-    mutable wchar_t hotk;              // hotkey
-    mutable std::wstring::size_type hotp;      // position of hotkey
-    mutable std::wstring   wstr;
-
-    static std::string termEncoding;   // the encoding of the terminal
+    mutable wchar_t hotk;                 ///< hotkey
+    /// Position of hotkey in columns(!). *npos* means unset.
+    ///
+    /// CJK characters take 2 columns. So in the Chinese "Yes" button,
+    /// L"是(Y)", *hotp* for L'Y' is 3 even though
+    ///its wchar_t offset is 2 (and its UTF-8 offset is 4).
+    mutable std::wstring::size_type hotp;
+    mutable std::wstring   wstr;         ///< the actual string
+
+    /// The encoding of the terminal; the value is ignored by this class.
+    /// WTF, really: other classes care
+    /// but this class just uses UTF-8 for non-wide characters.
+    static std::string termEncoding;
 
 public:
 
@@ -50,12 +60,15 @@
 
     NCstring( const std::wstring & wstr );
 
+    /// Init from a UTF-8 string.
     NCstring( const std::string & str );
 
+    /// Init from a UTF-8 string.
     NCstring( const char * cstr );
 
     ~NCstring() {}
 
+    /// Get a UTF-8 string.
     std::string Str() const;
 
 public:
@@ -85,6 +98,7 @@
 
     static bool setTerminalEncoding( const std::string & encoding = "" );
 
+    /// (mutates the const object)
     void getHotkey() const;
 };
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-ncurses-2.56.1/src/NCtext.h 
new/libyui-ncurses-2.56.2/src/NCtext.h
--- old/libyui-ncurses-2.56.1/src/NCtext.h      2020-08-17 12:29:15.000000000 
+0200
+++ new/libyui-ncurses-2.56.2/src/NCtext.h      2020-08-27 10:52:58.000000000 
+0200
@@ -33,7 +33,7 @@
 
 class NCursesWindow;
 
-
+/// Multi-line string
 class NCtext
 {
 
@@ -77,7 +77,7 @@
 };
 
 
-
+/// Multi-line string, with optional hotkey, drawable
 class NClabel : protected NCtext
 {
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-ncurses-2.56.1/src/NCtypes.h 
new/libyui-ncurses-2.56.2/src/NCtypes.h
--- old/libyui-ncurses-2.56.1/src/NCtypes.h     2020-08-17 12:29:15.000000000 
+0200
+++ new/libyui-ncurses-2.56.2/src/NCtypes.h     2020-08-27 10:52:58.000000000 
+0200
@@ -27,8 +27,10 @@
 
 #include <iosfwd>
 
+/// A sad little namespace
 namespace NC
 {
+    /// Alignment aka justification: top/bottom, left/right, center.
     enum ADJUST
     {
        CENTER = 0x00,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-ncurses-2.56.1/src/position.h 
new/libyui-ncurses-2.56.2/src/position.h
--- old/libyui-ncurses-2.56.1/src/position.h    2020-08-17 12:29:15.000000000 
+0200
+++ new/libyui-ncurses-2.56.2/src/position.h    2020-08-27 10:52:58.000000000 
+0200
@@ -27,7 +27,7 @@
 
 #include <iosfwd>
 
-
+//! A pair of 2 numbers, the base class for wpos and wsze.
 class wpair
 {
 
@@ -40,6 +40,7 @@
 
 public:
 
+    /// Set BOTH members to *v*
     wpair( int v = 0 )       { A = B = v; }
 
     wpair( int a, int b ) { A = a; B = b; }
@@ -82,7 +83,7 @@
 
     bool operator<=( const wpair & Rhs ) const { return A <= Rhs.A && B <= 
Rhs.B; }
 
-
+    /// a copy of *this* clamped between *Min* and *Max*
     wpair between( const wpair & Min, const wpair & Max ) const
        {
            return min( max( *this, Min ), Max );
@@ -104,8 +105,7 @@
 
 
 
-// screen position in (line,col)
-
+//! Screen position pair in the order line, column: (L, C)
 class wpos : public wpair
 {
 
@@ -149,8 +149,7 @@
 
 
 
-// screen dimension in (height,width)
-
+//! Screen dimension (screen size) in the order height, width: (H, W)
 class wsze : public wpair
 {
 
@@ -190,10 +189,7 @@
 
 extern std::ostream & operator<<( std::ostream & str, const wsze & obj );
 
-
-
-// rectangle {wpos,wsze}
-
+//! A rectangle is defined by its position and size: wpos Pos, wsze Sze.
 class wrect
 {
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-ncurses-2.56.1/src/tnode.h 
new/libyui-ncurses-2.56.2/src/tnode.h
--- old/libyui-ncurses-2.56.1/src/tnode.h       2020-08-17 12:29:15.000000000 
+0200
+++ new/libyui-ncurses-2.56.2/src/tnode.h       2020-08-27 10:52:58.000000000 
+0200
@@ -27,7 +27,19 @@
 
 #include <iosfwd>
 
-
+/**
+ * Tree node.
+ *
+ * Traversing the tree with \ref Next and \ref Prev is done
+ * pre-order (self before children)
+ * and depth-first (children before siblings)
+ *
+ * See also
+ * - https://en.wikipedia.org/wiki/Depth-first_search
+ * - https://en.wikipedia.org/wiki/Tree_traversal#Pre-order_(NLR)
+ *
+ * In practice all instances of this template use NCWidget * for n_value.
+ */
 template <class n_value> class tnode
 {
 
@@ -48,7 +60,23 @@
     self * fchild;
     self * lchild;
 
-
+    // Disconnect from old parent, connect to new parent *p*.
+    //
+    // If *s* is specified (not nilptr), insert this
+    // as its previous sibling (if *behind* is false)
+    // or as its next sibling (if *behind* is true).
+    //
+    // If *s* is omitted (nilptr), become the first (behind==false) or last
+    // (behind=true) child
+    //
+    // In case *s* is specified but is not in fact a child of *p* then it is
+    // treated as omitted.
+    //
+    // @param p new parent
+    // @param s reference sibling
+    // @param behind true: insert after *s*; false: insert before *s*
+    // @return true on success;
+    //   false on failure (*p* is myself or a descendant of mine)
     bool DoReparentTo( self & p, self * s, bool behind )
     {
 
@@ -112,6 +140,8 @@
 
 public:
 
+    /// New node, added as the last child by default (which is natural).
+    /// @param p parent
     tnode( n_value v, self * p = 0, bool behind = true )
            : val( v )
            , parent( 0 )
@@ -124,6 +154,8 @@
            DoReparentTo( *p, 0, behind );
     }
 
+    /// New node, added as the last child by default (which is natural).
+    /// @param p parent
     tnode( n_value v, self & p, bool behind = true )
            : val( v )
            , parent( 0 )
@@ -135,6 +167,9 @@
        DoReparentTo( p, 0, behind );
     }
 
+    /// New node under *p*, just after *s* (or before *s* if behind==false)
+    /// @param p parent
+    /// @param s reference sibling
     tnode( n_value v, self & p, self & s, bool behind = true )
            : val( v )
            , parent( 0 )
@@ -155,7 +190,7 @@
        Disconnect();
     }
 
-
+    /// Disconnect from the parent and siblings, but keep children.
     void Disconnect()
     {
        if ( !parent )
@@ -178,11 +213,29 @@
        PostDisconnect();
     }
 
+    /// Disconnect from old parent, connect to new parent *p*.
+    /// Become the last child (or the first, if behind==false).
+    ///
+    /// @param p new parent
+    /// @return true on success;
+    ///   false on failure (*p* is myself or a descendant of mine)
     bool ReparentTo( self & p, bool behind = true )
     {
        return DoReparentTo( p, 0, behind );
     }
 
+    /// Disconnect from old parent, connect to new parent *p* and sibling *s*.
+    ///
+    /// Insert this as just after *s* (or just before, if behind==false).
+    ///
+    /// In case *s* is not in fact a child of *p* then we become *p*'s last
+    /// (first) child.
+    ///
+    /// @param p new parent
+    /// @param s reference sibling
+    /// @param behind true: insert after *s*; false: insert before *s*
+    /// @return true on success;
+    ///   false on failure (*p* is myself or a descendant of mine)
     bool ReparentTo( self & p, self & s, bool behind = true )
     {
        return DoReparentTo( p, &s, behind );
@@ -191,26 +244,35 @@
 
     n_value & Value()     const { return val; }
 
+    /// Alias for \ref Value
     n_value & operator()() const { return Value(); }
 
     self *      Parent()         { return parent; }
 
     const self * Parent()   const { return parent; }
 
+    /// Previous sibling
     self *      Psibling()       { return psibling; }
 
+    /// Previous sibling
     const self * Psibling() const { return psibling; }
 
+    /// Next sibling
     self *      Nsibling()       { return nsibling; }
 
+    /// Next sibling
     const self * Nsibling() const { return nsibling; }
 
+    /// First child
     self *      Fchild()         { return fchild; }
 
+    /// First child
     const self * Fchild()   const { return fchild; }
 
+    /// Last child
     self *      Lchild()         { return lchild; }
 
+    /// Last child
     const self * Lchild()   const { return lchild; }
 
     bool HasParent()   const { return parent; }
@@ -225,6 +287,7 @@
 
     bool IsChildOf( const self & p ) const { return parent == &p; }
 
+    /// Depth: zero if no parent, otherwise 1 + parent's depth.
     unsigned Depth() const
     {
        self * l = const_cast<self *>( this );
@@ -257,6 +320,7 @@
        return( n && IsDescendantOf( *n ) );
     }
 
+    /// Root of the tree
     self & Top()
     {
        self * l = this;
@@ -267,6 +331,9 @@
        return *l;
     }
 
+    /// Next node: depth first, pre-order.
+    /// @param restart if true, the last node's Next is the first (\ref Top);
+    ///   otherwise nilptr.
     self * Next( bool restart = false )
     {
        if ( fchild ) // down first
@@ -302,11 +369,13 @@
        return l;
     }
 
+    /// Return \ref Next and assign it to *c*.
     self * Next( self *& c, bool restart = false )
     {
        return c = Next( restart );
     }
 
+    /// Return \ref Prev and assign it to *c*.
     self * Prev( self *& c, bool restart = false )
     {
        return c = Prev( restart );
@@ -341,5 +410,4 @@
 
 };
 
-
 #endif // tnode_h


Reply via email to