From: peter@zeus.DIALix.oz.au (Peter Wemm)
Newsgroups: news.software.nn,comp.sources.bugs
Subject: nn 6.4 - Official patch #18
Date: 13 Sep 1992 11:58:11 +0800
Organization: Karam Pty. Ltd., Perth, Western Australia.
NNTP-Posting-Host: zeus.dialix.oz.au
Summary: Fixes bugs in patch #16 (I hope)
Keywords: nn patch


	     This is an official patch to nn release 6.4
	     -------------------------------------------

			      PATCH #18

			   Priority: MEDUIM

NOTE: This patch has been posted before, you may have already installed it...
If not, please be aware that future patches (official at least..) will assume
that this has been installed.

NN 6.4.16 left a few annoying bugs in the menu selection code.  Many have been
been suffering because of this, and many are missing out on the news features
introduced in Patch #15 - in particular, "consolidated-menus". For those who
are not familiar with these patches, it is a simplistic thread-like extension
to the article viewer to allow collapsing of multiple articles on the same
subject. It is not true threading, however (yet.. :-)

This patch, and the previous patch #17 were posted last year as unofficial
patches which solve some of the more serious bugs.

After some discussions with interested parties, it was decided to re-post
these as as "Official", and clean up a few of the remaining rough edges
in a "Real Soon Now" patch #19.  As quite a few sites have already installed
these patches, (and also many have not...) they were re-posted to help ease
the transition.

The contents of this patch are exactly the same as the previous postings.
Do not apply it again...  You do not need to remove the old one and
re-apply.

It is reccomended that you install the PAIR of these (17,18) together.
Please also verify that the new version (PL18) is stable on your machine
before commiting to it.

cd to your source directory and type "patch < this_article".  Refuse any
reversals...

This is the "go-ahead" mail I recieved from Kim:
--------BEGIN--------
Date: Fri, 4 Sep 92 08:39:21 GMT
From: storm@olicom.dk (Kim F. Storm)
Message-Id: <9209040839.AA05197@olicom.olicom.dk>
To: Peter_Wemm@zeus.dialix.oz.au
Cc: storm@olicom.dk
Subject: Kim (that's me)

Peter,

I would appreciate if you took over the maintenance of nn 6.4.
I have something for the group menu "almost ready" - but it has
been in that state for the last year, and I have to dig into some
old archive tapes to dig out the sources.  Let me see what I can do
about it.

In the meantime, I would really appreciate if you would take
on the task of collecting whatever unofficial fixes etc. there have
been for nn 6.4.16 since its release, and put together a set of
OFFICIAL patches ( I hereby grant you the right to stamp patches as
official patches, provided you follow the current style ).

++Kim
---------END---------

>Path: zeus!DIALix!uniwa!munnari.oz.au!samsung!zaphod.mps.ohio-state.edu!qt.cs.utexas.edu!cs.utexas.edu!utgpu!jupiter!morgan.ucs.mun.ca!garfield!larry
>From: larry@garfield.cs.mun.ca (Larry Bouzane)
>Newsgroups: news.software.nn
>Subject: nn 6.4 - Unofficial patch 18
>Message-ID: <1991Dec2.030450.8644@garfield.cs.mun.ca>
>Date: 2 Dec 91 03:04:50 GMT
>Organization: CS Dept., Memorial University of Newfoundland
>Lines: 278

Here are a few more touch ups that I have installed in the version of
NN that we run here.  These changes are all related to consolidated-menu
mode within NN.  The following changes have been made:

	- possible core dump/strange behavior when using '=' command to
	  return to the menu from article reading mode.
	  (Reported by Olaf Schlueter [olaf@oski.toppoint.de])

	- articles marked as A_LEAVE_NEXT ('=') are not given any special
	  attention in consolidated menu mode.  I considered this incorrect
	  (I leave stuff around all the time :) and modified nn's behavior
	  to notice them.

	- unable to de-select an auto-selected subject when using
	  consolidated-menu mode.

I have decided to start updating the patchlevel.h file with this patch
to keep things from getting too confusing.  If you want to add these
changes, please apply the patch that I posted Nov 19, 1991 to an
unmodified patchlevel 16 version before you apply this one.  If you
missed that patch, you can get it via anonymous ftp from
garfield.cs.mun.ca (134.153.1.1) in "/pub/news/nn6.4".  If you are
unable to retrieve it via anonymous ftp, send me a note and I will mail
it to you.

This patch includes the changes to patchlevel.h and ChangeLog that were not
sent out with the previous patch.

Larry

*** /tmp/,RCSt1023579	Sun Dec  1 22:23:32 1991
--- patchlevel.h	Sun Dec  1 22:23:35 1991
***************
*** 27,33 ****
   *	1991-03-22: Patch #14 (6.4.14) - MEDIUM
   *	1991-04-02: Patch #15 (6.4.15) - LOW
   *	1991-04-18: Patch #16 (6.4.16) - HIGH
   */
  
! #define PATCHLEVEL 16
  
--- 27,38 ----
   *	1991-03-22: Patch #14 (6.4.14) - MEDIUM
   *	1991-04-02: Patch #15 (6.4.15) - LOW
   *	1991-04-18: Patch #16 (6.4.16) - HIGH
+  *
+  *	(Kim lost interest/dissapeared)
+  *
+  *	1991-11-19: Patch #17 (6.4.17) - MEDIUM
+  *	1991-12-01: Patch #18 (6.4.18) - MEDIUM
   */
  
! #define PATCHLEVEL 18
  
*** /dev/null	Sun Dec  1 18:42:12 1991
--- ChangeLog	Sun Dec  1 22:49:48 1991
***************
*** 0 ****
--- 1,26 ----
+ Unoffical Patch #17	(larry@garfield.cs.mun.ca Nov 19, 1991)
+ 
+ 	- core dump due to selecting last_article+1 on screen
+ 
+ 	- core dump due to consolidating (closing) last subject in a group
+   	  under certain circumstances.
+ 
+ 	- selecting consolidated articles with = command did not highlight
+   	  the selected consolidated articles correctly.
+ 
+ 	- fixed unconditional CLEAR TO END OF LINE that erased the next line on
+   	  some terminals.
+ 
+ Unofficial Patch #18	(larry@garfield.cs.mun.ca;  Dec  1, 1991)
+ 
+ 	- possible core dump/strange behavior when using '=' command to
+ 	  return to the menu from article reading mode.
+ 	  (Reported by Olaf Schlueter [olaf@oski.toppoint.de])
+ 
+ 	- articles marked as A_LEAVE_NEXT ('=') are not given any special
+ 	  attention in consolidated menu mode.  I considered this incorrect
+ 	  (I leave stuff around all the time :) and modified nn's behavior
+ 	  to notice them.
+ 
+ 	- unable to de-select an auto-selected subject when using
+ 	  consolidated-menu mode.
*** /tmp/,RCSt1023579	Sun Dec  1 22:23:33 1991
--- menu.c	Sun Dec  1 16:42:23 1991
***************
*** 82,87 ****
--- 82,88 ----
      int mi_total;	/* total number of articles with this subject */
      int mi_unread;	/* no of unread articles with this subject */
      int mi_selected;	/* no of selected articles with this subject */
+     int mi_left;	/* no of articles marked for later viewing */
      int mi_art_id;	/* article id (for mark()) */
  } menu_info[INTERVAL1+INTERVAL2];
  
***************
*** 138,146 ****
      if (ah->flag & A_ROOT_ART)
  	return root;
  
-     if (ah->flag & A_CLOSED)	/* only root article is shown on menu */
- 	return firsta + menu_info[ah->menu_line].mi_cura;
- 
      while (root > 0) {
  	if (articles[root]->flag & A_ROOT_ART) break;
  	root--;
--- 139,144 ----
***************
*** 172,187 ****
  {
      register struct menu_info *mi;
      register article_number n;
!     int total, unread, selected, invisible;
      
      if (!(articles[art]->flag & A_CLOSED)) return art + 1;
      
!     total = unread = selected = 0;
      n = art = root_article(art);
  
      while (n < n_articles) {
  	if (articles[n]->attr == 0) unread++;
  	else if (articles[n]->attr & A_SELECT) selected++; 
  	total++;
  	if (++n == n_articles) break;
  	if (articles[n]->flag & A_ROOT_ART) break;
--- 170,186 ----
  {
      register struct menu_info *mi;
      register article_number n;
!     int total, unread, selected, left, invisible;
      
      if (!(articles[art]->flag & A_CLOSED)) return art + 1;
      
!     total = unread = selected = left = 0;
      n = art = root_article(art);
  
      while (n < n_articles) {
  	if (articles[n]->attr == 0) unread++;
  	else if (articles[n]->attr & A_SELECT) selected++; 
+ 	else if (articles[n]->attr == A_LEAVE_NEXT) left++;
  	total++;
  	if (++n == n_articles) break;
  	if (articles[n]->flag & A_ROOT_ART) break;
***************
*** 192,197 ****
--- 191,197 ----
      mi->mi_total = total;
      mi->mi_unread = unread;
      mi->mi_selected = selected;
+     mi->mi_left = left;
      return n;
  }
  
***************
*** 206,215 ****
  register struct menu_info *mi;
  char *cbuf;
  {
!     char sel[10], unr[10];
      attr_type cattr;
      
!     if (mi->mi_unread == 0)
  	cattr = A_READ;
      else if (mi->mi_total == mi->mi_selected)
  	cattr = A_SELECT;
--- 206,217 ----
  register struct menu_info *mi;
  char *cbuf;
  {
!     char lft[10], sel[10], unr[10];
      attr_type cattr;
      
!     if (mi->mi_total == mi->mi_left)
! 	cattr = A_LEAVE_NEXT;
!     else if (mi->mi_unread == 0)
  	cattr = A_READ;
      else if (mi->mi_total == mi->mi_selected)
  	cattr = A_SELECT;
***************
*** 220,231 ****
      else
  	cattr = 0;
  
!     sel[0] = unr[0] = NUL;
      if (mi->mi_selected && mi->mi_selected < mi->mi_unread)
  	sprintf(sel, "%d/", mi->mi_selected);
      if (mi->mi_unread && mi->mi_unread < mi->mi_total)
  	sprintf(unr, "%d:", mi->mi_unread);
!     sprintf(cbuf, "%s%s%d", sel, unr, mi->mi_total);
  
      return cattr;
  }
--- 222,235 ----
      else
  	cattr = 0;
  
!     lft[0] = sel[0] = unr[0] = NUL;
!     if (mi->mi_left && mi->mi_left < mi->mi_unread)
! 	sprintf(lft, "%d,", mi->mi_left);
      if (mi->mi_selected && mi->mi_selected < mi->mi_unread)
  	sprintf(sel, "%d/", mi->mi_selected);
      if (mi->mi_unread && mi->mi_unread < mi->mi_total)
  	sprintf(unr, "%d:", mi->mi_unread);
!     sprintf(cbuf, "%s%s%s%d", lft, sel, unr, mi->mi_total);
  
      return cattr;
  }
***************
*** 268,273 ****
--- 272,278 ----
  	thread_counters(firsta + cura);
  	if (old.mi_total == mi->mi_total &&
  	    old.mi_selected == mi->mi_selected &&
+ 	    old.mi_left == mi->mi_left &&
  	    old.mi_unread == mi->mi_unread) return;
  
  	cattr = closed_attr(mi, cbuf);
***************
*** 619,626 ****
  
  	     case MC_MENU:
  		ah->attr = o_attr;
! 		if (nexta - firsta < n_articles)
! 		    if ((firsta = cur - 5) < 0) firsta = 0;
  		next_cura = cur - firsta;
  
  		return MC_MENU;
--- 624,642 ----
  
  	     case MC_MENU:
  		ah->attr = o_attr;
! 		if (nexta - firsta < n_articles) {
! 			/* Keep a little article context by making the */
! 			/* current article go on menu line 6 if possible */
! 			if (IS_VISIBLE(articles[cur]))
! 				firsta = cur;
! 			else
! 				firsta = root_article(cur);
! 			for (next = 0; firsta > 0 && next < 5; next++) {
! 				firsta--;
! 				if (!IS_VISIBLE(articles[firsta]))
! 					firsta = root_article(firsta);
! 			}
! 		}
  		next_cura = cur - firsta;
  
  		return MC_MENU;
***************
*** 819,826 ****
  attr_type old, new;
  int update;
  {
!     return repl_attr(root_article(firsta+cura), next_root_article(firsta+cura),
! 		     old, new, update);
  }
  
  static repl_attr_all(old, new, update)
--- 835,847 ----
  attr_type old, new;
  int update;
  {
!     int	f, l;
! 
!     f = root_article(firsta+cura);
!     l = next_root_article(firsta+cura);
!     if (old == A_SELECT)
! 	(void) repl_attr(f, l, A_AUTO_SELECT, A_SELECT, update);
!     return repl_attr(f, l, old, new, update);
  }
  
  static repl_attr_all(old, new, update)

>--
Larry Bouzane
Department of Computer Science, Memorial University of Newfoundland, Canada
larry@garfield.cs.mun.ca; uunet!garfield!larry

-- 
Peter Wemm : peter@zeus.dialix.oz.au   If it's broke, fix it (The MS-DOS way)
Work phone: +61-9-479-1855    If it aint broke, don't touch it (The Unix way)
Fax: +61-9-479-1134   If we can't fix it, it ain't broke (Maintainer's Motto)