diff -r -u slang-1.4.4/src/slang.h slang-1.4.4.new/src/slang.h
--- slang-1.4.4/src/slang.h	Wed Feb 21 02:17:36 2001
+++ slang-1.4.4.new/src/slang.h	Thu May 10 10:16:43 2001
@@ -1573,6 +1573,8 @@
    unsigned int window_row;	       /* row of current_line in window */
    unsigned int border;		       /* number of rows that form scroll border */
    int cannot_scroll;		       /* should window scroll or recenter */
+   SLscroll_Type *(*next)(SLscroll_Type *);
+   SLscroll_Type *(*prev)(SLscroll_Type *);
 }
 SLscroll_Window_Type;
 
diff -r -u slang-1.4.4/src/slscroll.c slang-1.4.4.new/src/slscroll.c
--- slang-1.4.4/src/slscroll.c	Wed Feb 21 02:17:39 2001
+++ slang-1.4.4.new/src/slscroll.c	Thu May 10 10:31:49 2001
@@ -11,12 +11,25 @@
 #include "slang.h"
 #include "_slang.h"
 
+SLscroll_Type *defaultnext(SLscroll_Type *in)
+{
+	return in->next;
+}
+
+SLscroll_Type *defaultprev(SLscroll_Type *in)
+{
+	return in->prev;
+}
+
 static void find_window_bottom (SLscroll_Window_Type *win)
 {
    unsigned int nrows;
    unsigned int hidden_mask;
    SLscroll_Type *bot, *cline, *last_bot;
    unsigned int row;
+   SLscroll_Type *(*next)(SLscroll_Type *) = win->next;
+   if (!next)
+	   next = defaultnext;
 
    nrows = win->nrows;
    hidden_mask = win->hidden_mask;
@@ -35,12 +48,12 @@
 	if (bot == NULL)
 	  break;
 
-	bot = bot->next;
+	bot = next(bot);
 
 	if (hidden_mask)
 	  {
 	     while ((bot != NULL) && (bot->flags & hidden_mask))
-	       bot = bot->next;
+	       bot = next(bot);
 	  }
 
 	row++;
@@ -54,6 +67,9 @@
    unsigned int nrows;
    unsigned int hidden_mask;
    SLscroll_Type *prev, *last_prev, *cline;
+   SLscroll_Type *(*previous)(SLscroll_Type *) = win->prev;
+   if (!previous)
+	   previous = defaultprev;
 
    nrows = win->nrows;
    cline = win->current_line;
@@ -69,14 +85,15 @@
 	last_prev = prev;
 	do
 	  {
-	     prev = prev->prev;
+	     prev = previous(prev);
 	  }
 	while (hidden_mask
 	       && (prev != NULL)
 	       && (prev->flags & hidden_mask));
      }
 
-   if (prev == NULL) prev = last_prev;
+   if (prev == NULL) 
+	   prev = last_prev;
 
    win->top_window_line = prev;
    find_window_bottom (win);
@@ -94,6 +111,8 @@
    unsigned int hidden_mask;
    int scroll_mode;
    unsigned int border;
+   SLscroll_Type *(*nextone)(SLscroll_Type *) = win->next;
+   SLscroll_Type *(*previous)(SLscroll_Type *) = win->prev;
 
    cline = win->current_line;
    nrows = win->nrows;
@@ -126,6 +145,11 @@
 
    i = 0;
 
+   if (!previous)
+	   previous = defaultprev;
+   if (!nextone)
+	   nextone = defaultnext;
+
    while ((i < nrows) && (prev != NULL))
      {
 	if (prev == top_window_line)
@@ -137,8 +161,8 @@
 
 	     if (dir) while (border)
 	       {
-		  if (dir < 0) twl = twl->prev;
-		  else twl = twl->next;
+		  if (dir < 0) twl = previous(twl);
+		  else twl = nextone(twl);
 
 		  if (twl == NULL)
 		    {
@@ -157,7 +181,7 @@
 
 	do
 	  {
-	     prev = prev->prev;
+	     prev = previous(prev);
 	  }
 	while (hidden_mask
 	       && (prev != NULL)
@@ -174,11 +198,11 @@
    else if (scroll_mode == -1)
      scroll_mode = 0;
 
-   next = cline->next;
+   next = nextone(cline);
    while (hidden_mask
 	  && (next != NULL)
 	  && (next->flags & hidden_mask))
-     next = next->next;
+     next = nextone(next);
 
    if ((next != NULL)
        && (next == top_window_line))
@@ -196,12 +220,12 @@
 	return 0;
      }
 
-   prev = cline->prev;
+   prev = previous(cline);
 
    while (hidden_mask
 	  && (prev != NULL)
 	  && (prev->flags & hidden_mask))
-     prev = prev->prev;
+     prev = previous(prev);
 
    if ((prev == NULL)
        || (prev != win->bot_window_line))
@@ -223,7 +247,7 @@
      {
 	do
 	  {
-	     prev = prev->prev;
+	     prev = previous(prev);
 	  }
 	while (hidden_mask
 	       && (prev != NULL)
@@ -246,9 +270,15 @@
    SLscroll_Type *cline, *l;
    unsigned int n;
    unsigned int hidden_mask;
+   SLscroll_Type *(*next)(SLscroll_Type *);
 
    if (win == NULL) return -1;
 
+   next = win->next;
+   if (!next)
+	   next = defaultnext;
+
+
    hidden_mask = win->hidden_mask;
    cline = win->current_line;
 
@@ -261,7 +291,7 @@
 	    || (0 == (l->flags & hidden_mask)))
 	  n++;
 
-	l = l->next;
+	l = next(l);
      }
 
    win->line_num = n;
@@ -272,7 +302,7 @@
 	if ((hidden_mask == 0)
 	    || (0 == (l->flags & hidden_mask)))
 	  n++;
-	l = l->next;
+	l = next(l);
      }
    win->num_lines = n;
 
@@ -284,20 +314,26 @@
    unsigned int i;
    unsigned int hidden_mask;
    SLscroll_Type *l, *cline;
+   SLscroll_Type *(*next)(SLscroll_Type *);
+
 
    if ((win == NULL)
        || (NULL == (cline = win->current_line)))
      return 0;
 
+   next = win->next;
+   if (!next)
+	   next = defaultnext;
+
    hidden_mask = win->hidden_mask;
    l = cline;
    i = 0;
    while (i < n)
      {
-	l = l->next;
+	l = next(l);
 	while (hidden_mask
 	       && (l != NULL) && (l->flags & hidden_mask))
-	  l = l->next;
+	  l = next(l);
 
 	if (l == NULL)
 	  break;
@@ -316,20 +352,24 @@
    unsigned int i;
    unsigned int hidden_mask;
    SLscroll_Type *l, *cline;
+   SLscroll_Type *(*previous)(SLscroll_Type *) = win->prev;
 
    if ((win == NULL)
        || (NULL == (cline = win->current_line)))
      return 0;
 
+   if (!previous)
+	   previous = defaultprev;
+
    hidden_mask = win->hidden_mask;
    l = cline;
    i = 0;
    while (i < n)
      {
-	l = l->prev;
+	l = previous(l);
 	while (hidden_mask
 	       && (l != NULL) && (l->flags & hidden_mask))
-	  l = l->prev;
+	  l = previous(l);
 
 	if (l == NULL)
 	  break;
@@ -348,10 +388,14 @@
    SLscroll_Type *l, *top;
    unsigned int nrows, hidden_mask;
    unsigned int n;
+   SLscroll_Type *(*previous)(SLscroll_Type *) = win->prev;
 
    if (win == NULL)
      return -1;
 
+   if (!previous)
+     previous = defaultprev;
+
    (void) SLscroll_find_top (win);
 
    nrows = win->nrows;
@@ -364,7 +408,7 @@
 	l = win->current_line;
 	while ((l != NULL) && (l != top))
 	  {
-	     l = l->prev;
+	     l = previous(l);
 	     if ((hidden_mask == 0)
 		 || ((l != NULL) && (0 == (l->flags & hidden_mask))))
 	       n++;
@@ -405,10 +449,15 @@
    SLscroll_Type *l, *bot;
    unsigned int nrows, hidden_mask;
    unsigned int n;
+   SLscroll_Type *(*next)(SLscroll_Type *);
 
    if (win == NULL)
      return -1;
 
+   next = win->next;
+   if (!next)
+	   next = defaultnext;
+
    (void) SLscroll_find_top (win);
 
    nrows = win->nrows;
@@ -421,7 +470,7 @@
 	l = win->current_line;
 	while ((l != NULL) && (l != bot))
 	  {
-	     l = l->next;
+	     l = next(l);
 	     if ((hidden_mask == 0)
 		 || ((l != NULL) && (0 == (l->flags & hidden_mask))))
 	       n++;

