#include <config.h>
#include <stdio.h>
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
#include "lisp.h"
#include "frame.h"
#include "window.h"
static void insert_left_trunc_glyphs P_ ((struct it *));
static struct glyph_row *get_overlay_arrow_glyph_row P_ ((struct window *));
static void extend_face_to_end_of_line P_ ((struct it *));
-static void append_space P_ ((struct it *, int));
+static int append_space P_ ((struct it *, int));
static void make_cursor_line_fully_visible P_ ((struct window *));
static int try_scrolling P_ ((Lisp_Object, int, int, int, int));
static int trailing_whitespace_p P_ ((int));
static void display_mode_line P_ ((struct window *, enum face_id,
Lisp_Object));
static int display_mode_element P_ ((struct it *, int, int, int, Lisp_Object));
-static char *decode_mode_spec P_ ((struct window *, char, int, int));
+static char *decode_mode_spec P_ ((struct window *, int, int, int));
static void display_menu_bar P_ ((struct window *));
static int display_count_lines P_ ((int, int, int, int, int *));
static int display_string P_ ((unsigned char *, Lisp_Object, Lisp_Object,
{
Lisp_Object prop, pos;
enum prop_handled handled = HANDLED_NORMALLY;
+ struct gcpro gcpro1;
/* Get the value of the `fontified' property at IT's current buffer
position. (The `fontified' property doesn't have a special
{
Lisp_Object args[2];
+ GCPRO1 (pos);
/* Run the hook functions. */
args[0] = Qfontification_functions;
args[1] = pos;
fontify the text for which reason ever. */
if (!NILP (Fget_char_property (pos, Qfontified, Qnil)))
handled = HANDLED_RECOMPUTE_PROPS;
+ UNGCPRO;
}
return handled;
&& indented_beyond_p (IT_CHARPOS (*it), IT_BYTEPOS (*it),
it->selective))
visible_p = 0;
-#ifdef USE_TEXT_PROPERTIES
else
{
Lisp_Object prop;
if (TEXT_PROP_MEANS_INVISIBLE (prop))
visible_p = 0;
}
-#endif /* USE_TEXT_PROPERTIES */
/* Back one more newline if the current one is invisible. */
if (!visible_p)
struct it *it;
int start_charpos, end_charpos;
{
-#ifdef USE_TEXT_PROPERTIES
Lisp_Object prop, limit;
int invisible_found_p;
}
return invisible_found_p;
-
-#else /* not USE_TEXT_PROPERTIES */
- return 0;
-#endif /* not USE_TEXT_PROPERTIES */
}
xassert (MINI_WINDOW_P (w));
/* Nil means don't try to resize. */
- if (NILP (Vmax_mini_window_height))
+ if (NILP (Vmax_mini_window_height)
+ || (FRAME_X_P (f) && f->output_data.x == NULL))
return 0;
if (!FRAME_MINIBUF_ONLY_P (f))
max_height = min (total_height, max_height);
/* Find out the height of the text in the window. */
+ last_height = 0;
move_it_to (&it, ZV, -1, -1, -1, MOVE_TO_POS);
- height = (unit - 1 + it.current_y + last_height) / unit;
- height = max (1, height);
+ if (it.max_ascent == 0 && it.max_descent == 0)
+ height = it.current_y + last_height;
+ else
+ height = it.current_y + it.max_ascent + it.max_descent;
+ height = (height + unit - 1) / unit;
/* Compute a suitable window start. */
if (height > max_height)
if (!FRAME_VISIBLE_P (f) || !f->glyphs_initialized_p)
return 0;
-#if 0 /* inhibit_window_system is not a valid way of testing
- whether a window system is in use.
- This code prevents all echo area display
- when you run plain `emacs' on a tty. */
+#ifdef HAVE_X_WINDOWS
/* When Emacs starts, selected_frame may be a visible terminal
frame, even if we run under a window system. If we let this
through, a message would be displayed on the terminal. */
-#ifdef HAVE_WINDOW_SYSTEM
- if (!inhibit_window_system && !FRAME_WINDOW_P (sf))
+ if (EQ (selected_frame, Vterminal_frame)
+ && !NILP (Vwindow_system))
return 0;
-#endif /* HAVE_WINDOW_SYSTEM */
-#endif
+#endif /* HAVE_X_WINDOWS */
/* Redraw garbaged frames. */
if (frame_garbaged)
/* Append one space to the glyph row of iterator IT if doing a
window-based redisplay. DEFAULT_FACE_P non-zero means let the
space have the default face, otherwise let it have the same face as
- IT->face_id.
+ IT->face_id. Value is non-zero if a space was added.
This function is called to make sure that there is always one glyph
at the end of a glyph row that the cursor can be set on under
At the same time this space let's a nicely handle clearing to the
end of the line if the row ends in italic text. */
-static void
+static int
append_space (it, default_face_p)
struct it *it;
int default_face_p;
it->what = saved_what;
it->face_id = saved_face_id;
it->charset = saved_charset;
+ return 1;
}
}
+
+ return 0;
}
if (!get_next_display_element (it))
{
/* Maybe add a space at the end of this line that is used to
- display the cursor there under X. */
- append_space (it, 1);
-
- /* The position -1 below indicates a blank line not
- corresponding to any text, as opposed to an empty line
- corresponding to a line end. */
- if (row->used[TEXT_AREA] <= 1)
+ display the cursor there under X. Set the charpos of the
+ first glyph of blank lines not corresponding to any text
+ to -1. */
+ if ((append_space (it, 1) && row->used[TEXT_AREA] == 1)
+ || row->used[TEXT_AREA] == 0)
{
row->glyphs[TEXT_AREA]->charpos = -1;
row->displays_text_p = 0;
#ifdef USE_X_TOOLKIT
xassert (!FRAME_WINDOW_P (f));
- init_iterator (&it, w, -1, -1, f->desired_matrix->rows, MODE_LINE_FACE_ID);
+ init_iterator (&it, w, -1, -1, f->desired_matrix->rows, MENU_FACE_ID);
it.first_visible_x = 0;
it.last_visible_x = FRAME_WINDOW_WIDTH (f) * CANON_X_UNIT (f);
#else /* not USE_X_TOOLKIT */
xassert (WINDOWP (f->menu_bar_window));
menu_w = XWINDOW (f->menu_bar_window);
init_iterator (&it, menu_w, -1, -1, menu_w->desired_matrix->rows,
- MODE_LINE_FACE_ID);
+ MENU_FACE_ID);
it.first_visible_x = 0;
it.last_visible_x = FRAME_WINDOW_WIDTH (f) * CANON_X_UNIT (f);
}
/* This is a TTY frame, i.e. character hpos/vpos are used as
pixel x/y. */
init_iterator (&it, w, -1, -1, f->desired_matrix->rows,
- MODE_LINE_FACE_ID);
+ MENU_FACE_ID);
it.first_visible_x = 0;
it.last_visible_x = FRAME_WIDTH (f);
}
static char *
decode_mode_spec (w, c, field_width, precision)
struct window *w;
- register char c;
+ register int c;
int field_width, precision;
{
Lisp_Object obj;
start, it, field_width, precision, max_x, multibyte)
unsigned char *string;
Lisp_Object lisp_string;
+ Lisp_Object face_string;
+ int face_string_pos;
int start;
struct it *it;
int field_width, precision, max_x;