forwback.c.diff   [plain text]


--- forwback.c.orig	2005-12-03 12:20:32.000000000 -0800
+++ forwback.c	2006-01-25 20:53:11.000000000 -0800
@@ -21,6 +21,7 @@ public int hit_eof;	/* Keeps track of ho
 public int screen_trashed;
 public int squished;
 public int no_back_scroll = 0;
+public int display_next_file_or_exit = 0;
 
 extern int sigs;
 extern int top_scroll;
@@ -33,6 +34,7 @@ extern int back_scroll;
 extern int ignore_eoi;
 extern int clear_bg;
 extern int final_attr;
+extern int unix2003_compat;
 #if TAGS
 extern char *tagoption;
 #endif
@@ -135,9 +137,11 @@ forw(n, pos, force, only_last, nblank)
 			pos_clear();
 			add_forw_pos(pos);
 			force = 1;
+			if (!unix2003_compat) {
 			if (top_scroll == OPT_ONPLUS || (first_time && top_scroll != OPT_ON))
 				clear();
 			home();
+			}
 		} else
 		{
 			clear_bot();
@@ -323,8 +327,14 @@ forward(n, force, only_last)
 	int only_last;
 {
 	POSITION pos;
+	int edit_next_file;
 
-	if (quit_at_eof && hit_eof && !(ch_getflags() & CH_HELPFILE))
+	if (unix2003_compat) {
+		edit_next_file = hit_eof && display_next_file_or_exit;
+	} else {
+		edit_next_file = quit_at_eof && hit_eof && !(ch_getflags() & CH_HELPFILE);
+	}
+	if (edit_next_file)
 	{
 		/*
 		 * If the -e flag is set and we're trying to go