  TK Soh's synchronised scrolling patch lets you scroll multiple split-panes
  and/or windows synchronously.

  The original is available as a patch here:

  http://sourceforge.net/tracker/index.php?func=detail&aid=774820&group_id=11005&atid=311005
	    [ 774820 ] Synchronous Scrolling
	    syncscroll-v1.diff.gz 2003-07-20 22:54

  Synchronous scrolling occurs to split-panes and/or windows when the
  "Synchronous Scrolling" preference is enabled, when you scroll a
  sync-scrolling enabled window, by scrolling its vertical scrollbar, or
  through the wheelmouse.

  2006-08-18

  Updated to use a new action routine set_sync_scrolling([0|1]) and the
  corresponding macro variable $sync_scrolling. This patch is now also
  compatible with the tabbed interface.

  2006-08-21

  Made a small change to avoid crashes when scrolling help windows.

diff -ur nedit_official nedit_mod
diff -ur nedit_official/doc/help.etx nedit_mod/doc/help.etx
--- nedit_official/doc/help.etx	2007-10-04 17:01:31.000000000 +0200
+++ nedit_mod/doc/help.etx	2007-10-04 18:15:42.668035200 +0200
@@ -2464,6 +2464,9 @@
 **$show_line_numbers**
   Whether line numbers are shown next to the text.
 
+**$sync_scrolling**
+  Whether the window's scrolling is to be synchronized with others.
+
 **$show_matching**
   Contains the current preference for showing matching pairs,
   such as "[]" and "{}" pairs. Can be "off", "delimiter", or "range".
@@ -3254,6 +3257,15 @@
   A value of 0 turns it off and a value of 1 turns it on.
   If no parameters are supplied the option is toggled.
 
+**set_sync_scrolling( [0 | 1] )**
+  Turn on or off synchronized scrolling for this window.
+  All windows that have this setting turned on will respond to vertical
+  scrolling events together, whether from the use of the vertical scroll
+  bar, the whell mouse, or macro invocations of the scroll_down() and
+  scroll_up() action routines).
+  A value of 0 turns synchronized scrolling off and a value of 1 turns it on.
+  If no parameters are supplied the option is toggled.
+
 **set_show_line_numbers( [0 | 1] )**
   Show or hide line numbers for the current window.
   A value of 0 turns it off and a value of 1 turns it on.
@@ -3740,6 +3752,13 @@
   In overtype mode, new characters entered replace the characters in front of
   the insertion cursor, rather than being inserted before them.
 
+**Synchronized Scrolling**
+  Turns on or off synchronized scrolling for this window.
+  All windows that have this setting turned on will respond to vertical
+  scrolling events together, whether from the use of the vertical scroll
+  bar, the whell mouse, or macro invocations of the scroll_down() and
+  scroll_up() action routines).
+
 **Read Only**
   Lock the file against accidental modification.  This temporarily prevents the
   file from being modified in this NEdit session. Note that this is different
diff -ur nedit_official/source/highlightData.c nedit_mod/source/highlightData.c
--- nedit_official/source/highlightData.c	2006-12-02 11:27:06.000000000 +0100
+++ nedit_mod/source/highlightData.c	2007-10-04 18:15:42.758164800 +0200
@@ -550,10 +550,10 @@
         README:\"NEdit Macro syntax highlighting patterns, version 2.6, maintainer Thorsten Haude, nedit at thorstenhau.de\":::Flag::D\n\
         Comment:\"#\":\"$\"::Comment::\n\
         Built-in Misc Vars:\"(?<!\\Y)\\$(?:active_pane|args|calltip_ID|column|cursor|display_width|empty_array|file_name|file_path|language_mode|line|locked|max_font_width|min_font_width|modified|n_display_lines|n_panes|rangeset_list|read_only|selection_(?:start|end|left|right)|server_name|text_length|top_line)>\":::Identifier::\n\
-        Built-in Pref Vars:\"(?<!\\Y)\\$(?:auto_indent|em_tab_dist|file_format|font_name|font_name_bold|font_name_bold_italic|font_name_italic|highlight_syntax|incremental_backup|incremental_search_line|make_backup_copy|match_syntax_based|overtype_mode|show_line_numbers|show_matching|statistics_line|tab_dist|use_tabs|wrap_margin|wrap_text)>\":::Identifier2::\n\
+        Built-in Pref Vars:\"(?<!\\Y)\\$(?:auto_indent|em_tab_dist|file_format|font_name|font_name_bold|font_name_bold_italic|font_name_italic|highlight_syntax|incremental_backup|incremental_search_line|make_backup_copy|match_syntax_based|overtype_mode|show_line_numbers|show_matching|statistics_line|sync_scrolling|tab_dist|use_tabs|wrap_margin|wrap_text)>\":::Identifier2::\n\
         Built-in Special Vars:\"(?<!\\Y)\\$(?:[1-9]|list_dialog_button|n_args|read_status|search_end|shell_cmd_status|string_dialog_button|sub_sep)>\":::String1::\n\
         Built-in Subrs:\"<(?:append_file|beep|calltip|clipboard_to_string|dialog|focus_window|get_character|get_pattern_(by_name|at_pos)|get_range|get_selection|get_style_(by_name|at_pos)|getenv|kill_calltip|length|list_dialog|max|min|rangeset_(?:add|create|destroy|get_by_name|includes|info|invert|range|set_color|set_mode|set_name|subtract)|read_file|replace_in_string|replace_range|replace_selection|replace_substring|search|search_string|select|select_rectangle|set_cursor_pos|set_language_mode|set_locked|shell_command|split|string_compare|string_dialog|string_to_clipboard|substring|t_print|tolower|toupper|valid_number|write_file)>\":::Subroutine::\n\
-        Menu Actions:\"<(?:new|open|open-dialog|open_dialog|open-selected|open_selected|close|save|save-as|save_as|save-as-dialog|save_as_dialog|revert-to-saved|revert_to_saved|revert_to_saved_dialog|include-file|include_file|include-file-dialog|include_file_dialog|load-macro-file|load_macro_file|load-macro-file-dialog|load_macro_file_dialog|load-tags-file|load_tags_file|load-tags-file-dialog|load_tags_file_dialog|unload_tags_file|load_tips_file|load_tips_file_dialog|unload_tips_file|print|print-selection|print_selection|exit|undo|redo|delete|select-all|select_all|shift-left|shift_left|shift-left-by-tab|shift_left_by_tab|shift-right|shift_right|shift-right-by-tab|shift_right_by_tab|find|find-dialog|find_dialog|find-again|find_again|find-selection|find_selection|find_incremental|start_incremental_find|replace|replace-dialog|replace_dialog|replace-all|replace_all|replace-in-selection|replace_in_selection|replace-again|replace_again|replace_find|replace_find_same|replace_find_again|goto-line-number|goto_line_number|goto-line-number-dialog|goto_line_number_dialog|goto-selected|goto_selected|mark|mark-dialog|mark_dialog|goto-mark|goto_mark|goto-mark-dialog|goto_mark_dialog|match|select_to_matching|goto_matching|find-definition|find_definition|show_tip|split-window|split_window|close-pane|close_pane|uppercase|lowercase|fill-paragraph|fill_paragraph|control-code-dialog|control_code_dialog|filter-selection-dialog|filter_selection_dialog|filter-selection|filter_selection|execute-command|execute_command|execute-command-dialog|execute_command_dialog|execute-command-line|execute_command_line|shell-menu-command|shell_menu_command|macro-menu-command|macro_menu_command|bg_menu_command|post_window_bg_menu|beginning-of-selection|beginning_of_selection|end-of-selection|end_of_selection|repeat_macro|repeat_dialog|raise_window|focus_pane|set_statistics_line|set_incremental_search_line|set_show_line_numbers|set_auto_indent|set_wrap_text|set_wrap_margin|set_highlight_syntax|set_make_backup_copy|set_incremental_backup|set_show_matching|set_match_syntax_based|set_overtype_mode|set_locked|set_tab_dist|set_em_tab_dist|set_use_tabs|set_fonts|set_language_mode)(?=\\s*\\()\":::Subroutine::\n\
+        Menu Actions:\"<(?:new|open|open-dialog|open_dialog|open-selected|open_selected|close|save|save-as|save_as|save-as-dialog|save_as_dialog|revert-to-saved|revert_to_saved|revert_to_saved_dialog|include-file|include_file|include-file-dialog|include_file_dialog|load-macro-file|load_macro_file|load-macro-file-dialog|load_macro_file_dialog|load-tags-file|load_tags_file|load-tags-file-dialog|load_tags_file_dialog|unload_tags_file|load_tips_file|load_tips_file_dialog|unload_tips_file|print|print-selection|print_selection|exit|undo|redo|delete|select-all|select_all|shift-left|shift_left|shift-left-by-tab|shift_left_by_tab|shift-right|shift_right|shift-right-by-tab|shift_right_by_tab|find|find-dialog|find_dialog|find-again|find_again|find-selection|find_selection|find_incremental|start_incremental_find|replace|replace-dialog|replace_dialog|replace-all|replace_all|replace-in-selection|replace_in_selection|replace-again|replace_again|replace_find|replace_find_same|replace_find_again|goto-line-number|goto_line_number|goto-line-number-dialog|goto_line_number_dialog|goto-selected|goto_selected|mark|mark-dialog|mark_dialog|goto-mark|goto_mark|goto-mark-dialog|goto_mark_dialog|match|select_to_matching|goto_matching|find-definition|find_definition|show_tip|split-window|split_window|close-pane|close_pane|uppercase|lowercase|fill-paragraph|fill_paragraph|control-code-dialog|control_code_dialog|filter-selection-dialog|filter_selection_dialog|filter-selection|filter_selection|execute-command|execute_command|execute-command-dialog|execute_command_dialog|execute-command-line|execute_command_line|shell-menu-command|shell_menu_command|macro-menu-command|macro_menu_command|bg_menu_command|post_window_bg_menu|beginning-of-selection|beginning_of_selection|end-of-selection|end_of_selection|repeat_macro|repeat_dialog|raise_window|focus_pane|set_statistics_line|set_incremental_search_line|set_show_line_numbers|set_auto_indent|set_wrap_text|set_wrap_margin|set_highlight_syntax|set_make_backup_copy|set_incremental_backup|set_show_matching|set_match_syntax_based|set_overtype_mode|set_sync_scrolling|set_locked|set_tab_dist|set_em_tab_dist|set_use_tabs|set_fonts|set_language_mode)(?=\\s*\\()\":::Subroutine::\n\
         Text Actions:\"<(?:self-insert|self_insert|grab-focus|grab_focus|extend-adjust|extend_adjust|extend-start|extend_start|extend-end|extend_end|secondary-adjust|secondary_adjust|secondary-or-drag-adjust|secondary_or_drag_adjust|secondary-start|secondary_start|secondary-or-drag-start|secondary_or_drag_start|process-bdrag|process_bdrag|move-destination|move_destination|move-to|move_to|move-to-or-end-drag|move_to_or_end_drag|end_drag|copy-to|copy_to|copy-to-or-end-drag|copy_to_or_end_drag|exchange|process-cancel|process_cancel|paste-clipboard|paste_clipboard|copy-clipboard|copy_clipboard|cut-clipboard|cut_clipboard|copy-primary|copy_primary|cut-primary|cut_primary|newline|newline-and-indent|newline_and_indent|newline-no-indent|newline_no_indent|delete-selection|delete_selection|delete-previous-character|delete_previous_character|delete-next-character|delete_next_character|delete-previous-word|delete_previous_word|delete-next-word|delete_next_word|delete-to-start-of-line|delete_to_start_of_line|delete-to-end-of-line|delete_to_end_of_line|forward-character|forward_character|backward-character|backward_character|key-select|key_select|process-up|process_up|process-down|process_down|process-shift-up|process_shift_up|process-shift-down|process_shift_down|process-home|process_home|forward-word|forward_word|backward-word|backward_word|forward-paragraph|forward_paragraph|backward-paragraph|backward_paragraph|beginning-of-line|beginning_of_line|end-of-line|end_of_line|beginning-of-file|beginning_of_file|end-of-file|end_of_file|next-page|next_page|previous-page|previous_page|page-left|page_left|page-right|page_right|toggle-overstrike|toggle_overstrike|scroll-up|scroll_up|scroll-down|scroll_down|scroll_left|scroll_right|scroll-to-line|scroll_to_line|select-all|select_all|deselect-all|deselect_all|focusIn|focusOut|process-return|process_return|process-tab|process_tab|insert-string|insert_string|mouse_pan)>\":::Subroutine::\n\
         Keyword:\"<(?:break|continue|define|delete|else|for|if|in|return|while)>\":::Keyword::\n\
         Braces:\"[{}\\[\\]]\":::Keyword::\n\
diff -ur nedit_official/source/macro.c nedit_mod/source/macro.c
--- nedit_official/source/macro.c	2007-10-04 16:48:06.000000000 +0200
+++ nedit_mod/source/macro.c	2007-10-04 18:15:42.798222400 +0200
@@ -299,6 +299,8 @@
     DataValue *result, char **errMsg);
 static int overTypeModeMV(WindowInfo *window, DataValue *argList, int nArgs,
     DataValue *result, char **errMsg);
+static int syncScrollingMV(WindowInfo *window, DataValue *argList, int nArgs,
+    DataValue *result, char **errMsg);
 static int readOnlyMV(WindowInfo *window, DataValue *argList, int nArgs,
     DataValue *result, char **errMsg);
 static int lockedMV(WindowInfo *window, DataValue *argList, int nArgs,
@@ -451,7 +453,7 @@
         statisticsLineMV, incSearchLineMV, showLineNumbersMV,
         autoIndentMV, wrapTextMV, highlightSyntaxMV,
         makeBackupCopyMV, incBackupMV, showMatchingMV, matchSyntaxBasedMV,
-        overTypeModeMV, readOnlyMV, lockedMV, fileFormatMV,
+        overTypeModeMV, syncScrollingMV, readOnlyMV, lockedMV, fileFormatMV,
         fontNameMV, fontNameItalicMV,
         fontNameBoldMV, fontNameBoldItalicMV, subscriptSepMV,
         minFontWidthMV, maxFontWidthMV, topLineMV, numDisplayLinesMV,
@@ -469,7 +471,7 @@
         "$statistics_line", "$incremental_search_line", "$show_line_numbers",
         "$auto_indent", "$wrap_text", "$highlight_syntax",
         "$make_backup_copy", "$incremental_backup", "$show_matching", "$match_syntax_based",
-        "$overtype_mode", "$read_only", "$locked", "$file_format",
+        "$overtype_mode", "$sync_scrolling", "$read_only", "$locked", "$file_format",
         "$font_name", "$font_name_italic",
         "$font_name_bold", "$font_name_bold_italic", "$sub_sep",
         "$min_font_width", "$max_font_width", "$top_line", "$n_display_lines",
@@ -4310,6 +4312,14 @@
     return True;
 }
 
+static int syncScrollingMV(WindowInfo *window, DataValue *argList, int nArgs,
+    DataValue *result, char **errMsg)
+{
+    result->tag = INT_TAG;
+    result->val.n = window->syncScroll ? 1 : 0;
+    return True;
+}
+
 static int readOnlyMV(WindowInfo *window, DataValue *argList, int nArgs,
     DataValue *result, char **errMsg)
 {
diff -ur nedit_official/source/menu.c nedit_mod/source/menu.c
--- nedit_official/source/menu.c	2007-10-02 17:47:08.000000000 +0200
+++ nedit_mod/source/menu.c	2007-10-04 18:15:42.848294400 +0200
@@ -407,6 +407,8 @@
     Cardinal *nArgs);
 static void setOvertypeModeAP(Widget w, XEvent *event, String *args,
     Cardinal *nArgs);
+static void setSyncScrollingAP(Widget w, XEvent *event, String *args,
+    Cardinal *nArgs);
 static void setLockedAP(Widget w, XEvent *event, String *args,
     Cardinal *nArgs);
 static void setUseTabsAP(Widget w, XEvent *event, String *args,
@@ -577,6 +579,7 @@
     {"set_show_matching", setShowMatchingAP},
     {"set_match_syntax_based", setMatchSyntaxBasedAP},
     {"set_overtype_mode", setOvertypeModeAP},
+    {"set_sync_scrolling", setSyncScrollingAP},
     {"set_locked", setLockedAP},
     {"set_tab_dist", setTabDistAP},
     {"set_em_tab_dist", setEmTabDistAP},
@@ -761,6 +764,8 @@
     createMenuSeparator(menuPane, "sep4", SHORT);
     window->overtypeModeItem = createMenuToggle(menuPane, "overtype", "Overtype", 'O',
     	    doActionCB, "set_overtype_mode", False, SHORT);
+    window->syncScrollItem = createMenuToggle(menuPane, "syncScroll", "Synchronized Scrolling", 'Y',
+            doActionCB, "set_sync_scrolling", False, SHORT);
     window->readOnlyItem = createMenuToggle(menuPane, "readOnly", "Read Only",
     	    'y', doActionCB, "set_locked", IS_USER_LOCKED(window->lockReasons), FULL);
 #endif
@@ -1142,6 +1147,8 @@
     createMenuSeparator(menuPane, "sep2", SHORT);
     window->overtypeModeItem = createMenuToggle(menuPane, "overtype", "Overtype", 'O',
     	    doActionCB, "set_overtype_mode", False, SHORT);
+    window->syncScrollItem = createMenuToggle(menuPane, "syncScroll", "Synchronized Scrolling", 'Y',
+            doActionCB, "set_sync_scrolling", False, SHORT);
     window->readOnlyItem = createMenuToggle(menuPane, "readOnly", "Read Only",
     	    'y', doActionCB, "set_locked", IS_USER_LOCKED(window->lockReasons), FULL);
 #endif
@@ -4187,6 +4194,20 @@
     SetOverstrike(window, newState);
 }
 
+static void setSyncScrollingAP(Widget w, XEvent *event, String *args,
+    Cardinal *nArgs)
+{
+    WindowInfo *window = WidgetToWindow(w);
+    Boolean newState;
+
+    ACTION_BOOL_PARAM_OR_TOGGLE(newState, *nArgs, args,
+            window->syncScroll, "set_sync_scrolling");
+
+    if (IsTopDocument(window))
+        XmToggleButtonSetState(window->syncScrollItem, newState, False);
+    window->syncScroll = newState;
+}
+
 static void setLockedAP(Widget w, XEvent *event, String *args,
     Cardinal *nArgs)
 {
diff -ur nedit_official/source/nedit.h nedit_mod/source/nedit.h
--- nedit_official/source/nedit.h	2006-11-22 14:45:52.000000000 +0100
+++ nedit_mod/source/nedit.h	2007-10-04 18:15:42.878337600 +0200
@@ -358,6 +358,7 @@
     Widget	statsLineItem;
     Widget	iSearchLineItem;
     Widget	lineNumsItem;
+    Widget	syncScrollItem;
     Widget	showMatchingOffItem;
     Widget	showMatchingDelimitItem;
     Widget	showMatchingRangeItem;
@@ -547,6 +548,7 @@
     Bool	iSearchLastLiteralCase; /* idem, for literal mode */
     Bool	findLastRegexCase; 	/* idem, for regex mode in find dialog */
     Bool	findLastLiteralCase;    /* idem, for literal mode */
+    Bool	syncScroll;		/* do synchronous scrolling? */
     
 #ifdef REPLACE_SCOPE
     int		replaceScope;		/* Current scope for replace dialog */
diff -ur nedit_official/source/text.c nedit_mod/source/text.c
--- nedit_official/source/text.c	2007-10-02 17:47:08.000000000 +0200
+++ nedit_mod/source/text.c	2007-10-04 18:15:42.888352000 +0200
@@ -81,6 +81,10 @@
 /* Length of delay in milliseconds for vertical autoscrolling */
 #define VERTICAL_SCROLL_DELAY 50
 
+typedef void (textActionProcCall)(Widget, XEvent*, String*, Cardinal*);
+
+static void syncScrollAP(textActionProcCall actionProc, Widget w,
+    	XEvent *event, String *args, Cardinal *nArgs);
 static void initialize(TextWidget request, TextWidget new);
 static void handleHidePointer(Widget w, XtPointer unused, 
         XEvent *event, Boolean *continue_to_dispatch);
@@ -2911,7 +2915,7 @@
     }
 }
 
-static void nextPageAP(Widget w, XEvent *event, String *args, Cardinal *nArgs)
+static void _nextPageAP(Widget w, XEvent *event, String *args, Cardinal *nArgs)
 {
     textDisp *textD = ((TextWidget)w)->text.textD;
     textBuffer *buf = textD->buffer;
@@ -3008,7 +3012,12 @@
     }
 }
 
-static void previousPageAP(Widget w, XEvent *event, String *args,
+static void nextPageAP(Widget w, XEvent *event, String *args, Cardinal *nArgs)
+{
+    _nextPageAP(w, event, args, nArgs);
+}
+
+static void _previousPageAP(Widget w, XEvent *event, String *args,
 	Cardinal *nArgs)
 {
     textDisp *textD = ((TextWidget)w)->text.textD;
@@ -3093,6 +3102,12 @@
     }
 }
 
+static void previousPageAP(Widget w, XEvent *event, String *args, Cardinal *nArgs)
+{
+    _previousPageAP(w, event, args, nArgs);
+    
+}
+
 static void pageLeftAP(Widget w, XEvent *event, String *args, Cardinal *nArgs)
 {
     textDisp *textD = ((TextWidget)w)->text.textD;
@@ -3184,7 +3199,36 @@
     }
 }
 
-static void scrollUpAP(Widget w, XEvent *event, String *args,
+/*
+** do synchronous scroll for this action.
+*/
+static void syncScrollAP(textActionProcCall actionProc, Widget w,
+    	XEvent *event, String *args, Cardinal *nArgs)
+{
+    WindowInfo *win;
+    WindowInfo *window = WidgetToWindow(w);
+
+    actionProc(w, event, args, nArgs);
+
+    if (!window->syncScroll)
+    	return;
+	
+    for (win=WindowList; win; win=win->next) {
+	if (win->syncScroll) {
+    	    Widget text;
+	    int i;
+
+            for (i=0; i<= win->nPanes; i++) {
+        	text = i==0 ? win->textArea : win->textPanes[i-1];
+		if (text == w)
+	    	    continue;
+    	        actionProc(text, event, args, nArgs);
+	    }
+	}
+    }
+}
+
+static void _scrollUpAP(Widget w, XEvent *event, String *args,
     	Cardinal *nArgs)
 {
     textDisp *textD = ((TextWidget)w)->text.textD;
@@ -3205,7 +3249,13 @@
     TextDSetScroll(textD, topLineNum-nLines, horizOffset);
 }
 
-static void scrollDownAP(Widget w, XEvent *event, String *args,
+static void scrollUpAP(Widget w, XEvent *event, String *args,
+    	Cardinal *nArgs)
+{
+    syncScrollAP(_scrollUpAP, w, event, args, nArgs);
+}
+
+static void _scrollDownAP(Widget w, XEvent *event, String *args,
     	Cardinal *nArgs)
 {
     textDisp *textD = ((TextWidget)w)->text.textD;
@@ -3226,6 +3276,12 @@
     TextDSetScroll(textD, topLineNum+nLines, horizOffset);
 }
 
+static void scrollDownAP(Widget w, XEvent *event, String *args,
+    	Cardinal *nArgs)
+{
+    syncScrollAP(_scrollDownAP, w, event, args, nArgs);
+}
+
 static void scrollLeftAP(Widget w, XEvent *event, String *args,
     	Cardinal *nArgs)
 {
diff -ur nedit_official/source/textDisp.c nedit_mod/source/textDisp.c
--- nedit_official/source/textDisp.c	2007-03-05 00:44:00.000000000 +0100
+++ nedit_mod/source/textDisp.c	2007-10-04 18:15:42.948438400 +0200
@@ -39,6 +39,7 @@
 #include "calltips.h"
 #include "highlight.h"
 #include "rangeset.h"
+#include "window.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -2902,11 +2903,46 @@
     textDisp *textD = (textDisp *)clientData;
     int newValue = ((XmScrollBarCallbackStruct *)callData)->value;
     int lineDelta = newValue - textD->topLineNum;
+    WindowInfo *win, *window = WidgetToWindow(w);
     
     if (lineDelta == 0)
         return;
     setScroll(textD, newValue, textD->horizOffset, False, True);
+
+    /* there isn't always a WindowInfo for a document:
+       this could be a help window */
+    if (!window || !window->syncScroll)
+        return;
+
+    /* do synchronous scroll */
+    for (win=WindowList; win; win=win->next) {
+        if (win->syncScroll) {
+            Widget text;
+            int i, newLine;
+            textDisp *tD;
+
+            for (i=0; i<= win->nPanes; i++) {
+                text = i==0 ? win->textArea : win->textPanes[i-1];
+                tD = ((TextWidget)text)->text.textD;
+                if (tD == textD)
+                    continue; /* already scrolled */
+
+                if (lineDelta > 0) {
+                    newLine = tD->topLineNum +
+                              min(lineDelta, tD->nBufferLines -
+                                                    tD->topLineNum -
+                                                    tD->nVisibleLines + 2);
+                }
+                else {
+                    newLine = tD->topLineNum + lineDelta;
+                }
+
+                setScroll(tD, newLine< 1? 1 : newLine, 0, True, True);
+            }
+        }
+    }
 }
+
 static void hScrollCB(Widget w, XtPointer clientData, XtPointer callData)
 {
     textDisp *textD = (textDisp *)clientData;
diff -ur nedit_official/source/window.c nedit_mod/source/window.c
--- nedit_official/source/window.c	2007-10-02 17:47:10.000000000 +0200
+++ nedit_mod/source/window.c	2007-10-04 18:15:42.958452800 +0200
@@ -322,6 +322,7 @@
     window->tab = NULL;
     window->device = 0;
     window->inode = 0;
+    window->syncScroll = FALSE;
 
     /* If window geometry was specified, split it apart into a window position
        component and a window size component.  Create a new geometry string
@@ -3751,6 +3752,7 @@
 #endif
     XmToggleButtonSetState(window->autoSaveItem, window->autoSave, False);
     XmToggleButtonSetState(window->overtypeModeItem, window->overstrike, False);
+    XmToggleButtonSetState(window->syncScrollItem, window->syncScroll, False);
     XmToggleButtonSetState(window->matchSyntaxBasedItem, window->matchSyntaxBased, False);
     XmToggleButtonSetState(window->readOnlyItem, IS_USER_LOCKED(window->lockReasons), False);
 
@@ -4363,7 +4365,8 @@
     window->inode = orgWin->inode;
     window->fileClosedAtom = orgWin->fileClosedAtom;
     orgWin->fileClosedAtom = None;
-    
+    window->syncScroll = orgWin->syncScroll;
+
     /* copy the text/split panes settings, cursor pos & selection */
     cloneTextPanes(window, orgWin);
     
