--- less-445/main.c.orig 2012-03-19 01:56:09.417067454 +0000 +++ less-445/main.c 2012-03-19 02:00:46.811680487 +0000 @@ -278,6 +278,8 @@ { if (edit_stdin()) /* Edit standard input */ quit(QUIT_ERROR); + if (quit_if_one_screen) + line_count = get_line_count(); } else { if (edit_first()) /* Edit first valid file in cmd line */ @@ -288,10 +290,13 @@ * the content of the file is printed out and then less quits. Otherwise * -F can not be used */ - if (nifile() == 1 && quit_if_one_screen) - line_count = get_line_count(); - else if (nifile() > 1) /* In case more than one file, -F can not be used */ - quit_if_one_screen = FALSE; + if (quit_if_one_screen) + { + if (nifile() == 1) + line_count = get_line_count(); + else /* In case more than one file, -F can not be used */ + quit_if_one_screen = FALSE; + } } init(); --- less-445/forwback.c.orig 2012-03-19 02:30:29.717737382 +0000 +++ less-445/forwback.c 2012-03-19 02:33:06.119406322 +0000 @@ -424,7 +424,7 @@ } /* - * Get line count of file + * Get line count of file up to the screen height + 1 char */ public int get_line_count() @@ -432,7 +432,7 @@ int nlines = 0; POSITION pos; - pos = position(TOP); + pos = ch_zero(); while (pos != NULL_POSITION && nlines <= sc_height) {