(@pxref{Resizing Windows}) to make a window exactly as large as the text
it contains.
-@defun window-text-pixel-size &optional window from to x-limit y-limit mode-and-header-line
+@defun window-text-pixel-size &optional window from to x-limit y-limit mode-lines
This function returns the size of the text of @var{window}'s buffer in
pixels. @var{window} must be a live window and defaults to the
selected one. The return value is a cons of the maximum pixel-width
makes sense to specify this argument; in particular, if the caller
does not know the size of the buffer.
-The optional argument @var{mode-and-header-line} @code{nil} or omitted
-means to not include the height of the mode- or header-line of
-@var{window} in the return value. If it is either the symbol
-@code{mode-line} or @code{header-line}, include only the height of that
+The optional argument @var{mode-lines} @code{nil} or omitted means to
+not include the height of the mode-, tab- or header-line of @var{window}
+in the return value. If it is either the symbol @code{mode-line},
+@code{tab-line} or @code{header-line}, include only the height of that
line, if present, in the return value. If it is @code{t}, include the
-height of both, if present, in the return value.
+height of all of these lines, if present, in the return value.
@end defun
@code{window-text-pixel-size} treats the text displayed in a window as a
(cadr fringes)
(window-scroll-bar-width window)
(window-right-divider-width window))
- (format "height header-line: %s mode-line: %s divider: %s\n"
+ (format "height tab-line: %s header-line: %s mode-line: %s\n"
+ (window-tab-line-height window)
(window-header-line-height window)
- (window-mode-line-height window)
+ (window-mode-line-height window))
+ (format "height scroll-bar: %s divider: %s"
+ (window-scroll-bar-height window)
(window-bottom-divider-width window)))))
(insert "\n")))
((let ((char-size (frame-char-size window))
(pixel-height
(+ (window-safe-min-size window nil t)
+ (window-tab-line-height window)
(window-header-line-height window)
(window-scroll-bar-height window)
(window-mode-line-height window)
large buffer can take some time, it makes sense to specify this
argument if the size of the buffer is large or unknown.
-Optional argument MODE-AND-HEADER-LINE nil or omitted means do not
-include the height of the mode- or header-line of WINDOW in the return
-value. If it is either the symbol `mode-line' or `header-line', include
+Optional argument MODE-LINES nil or omitted means do not include the
+height of the mode-, tab- or header-line of WINDOW in the return value.
+If it is the symbol `mode-line', 'tab-line' or `header-line', include
only the height of that line, if present, in the return value. If t,
-include the height of both, if present, in the return value. */)
+include the height of any of these, if present, in the return value. */)
(Lisp_Object window, Lisp_Object from, Lisp_Object to, Lisp_Object x_limit,
- Lisp_Object y_limit, Lisp_Object mode_and_header_line)
+ Lisp_Object y_limit, Lisp_Object mode_lines)
{
struct window *w = decode_live_window (window);
Lisp_Object buffer = w->contents;
if (y > max_y)
y = max_y;
- if (EQ (mode_and_header_line, Qtab_line)
- || EQ (mode_and_header_line, Qt))
+ if (EQ (mode_lines, Qtab_line) || EQ (mode_lines, Qt))
/* Re-add height of tab-line as requested. */
y = y + WINDOW_TAB_LINE_HEIGHT (w);
- if (EQ (mode_and_header_line, Qheader_line)
- || EQ (mode_and_header_line, Qt))
+ if (EQ (mode_lines, Qheader_line) || EQ (mode_lines, Qt))
/* Re-add height of header-line as requested. */
y = y + WINDOW_HEADER_LINE_HEIGHT (w);
- if (EQ (mode_and_header_line, Qmode_line)
- || EQ (mode_and_header_line, Qt))
+ if (EQ (mode_lines, Qmode_line) || EQ (mode_lines, Qt))
/* Add height of mode-line as requested. */
y = y + WINDOW_MODE_LINE_HEIGHT (w);