summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/dired.el5
1 files changed, 4 insertions, 1 deletions
diff --git a/lisp/dired.el b/lisp/dired.el
index 818261f1894..b44f8dd2bfd 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1422,7 +1422,10 @@ Optional argument means return a file name relative to `default-directory'."
(set-buffer buf)
(goto-char (point-max))
(skip-chars-backward "\n\r\t ")
- (setq target-lines (count-lines (point-min) (point))))
+ (setq target-lines (count-lines (point-min) (point)))
+ ;; Don't forget to count the last line.
+ (if (not (bolp))
+ (setq target-lines (1+ target-lines))))
(if (<= (window-height window) (* 2 window-min-height))
;; At this point, every window on the frame is too small to split.
(setq w2 (display-buffer buf))