and Qt, so bitfield can't be used here. */
Lisp_Object dedicated;
- /* Line number and position of a line somewhere above the top of the
- screen. If this field is nil, it means we don't have a base
- line. */
- Lisp_Object base_line_number;
- /* If this field is nil, it means we don't have a base line.
- If it is a buffer, it means don't display the line number
- as long as the window shows that buffer. */
- Lisp_Object base_line_pos;
-
- /* If we have highlighted the region (or any part of it),
- this is the mark position that we used, as an integer. */
- Lisp_Object region_showing;
-
- /* The column number currently displayed in this window's mode line,
- or nil if column numbers are not being displayed. */
- Lisp_Object column_number_displayed;
-
/* If redisplay in this window goes beyond this buffer position,
must run the redisplay-end-trigger-hook. */
Lisp_Object redisplay_end_trigger;
/* Number saying how recently window was selected. */
int use_time;
- /* Unique number of window assigned when it was created. */
- int sequence_number;
-
/* Number of columns display within the window is scrolled to the left. */
ptrdiff_t hscroll;
it should be positive. */
ptrdiff_t last_point;
+ /* Line number and position of a line somewhere above the top of the
+ screen. If this field is zero, it means we don't have a base line. */
+ ptrdiff_t base_line_number;
+
+ /* If this field is zero, it means we don't have a base line.
+ If it is -1, it means don't display the line number as long
+ as the window shows its buffer. */
+ ptrdiff_t base_line_pos;
+
+ /* The column number currently displayed in this window's mode
+ line, or -1 if column numbers are not being displayed. */
+ ptrdiff_t column_number_displayed;
+
/* Scaling factor for the glyph_matrix size calculation in this window.
Used if window contains many small images or uses proportional fonts,
as the normal may yield a matrix which is too small. */
the frame image that window_end_pos did not get onto the frame. */
unsigned window_end_valid : 1;
+ /* Nonzero if we have highlighted the region (or any part of it). */
+ unsigned region_showing : 1;
+
/* Amount by which lines of this window are scrolled in
y-direction (smooth scrolling). */
int vscroll;
static Lisp_Object Qmargin, Qpointer;
static Lisp_Object Qline_height;
-/* These setters are used only in this file, so they can be private. */
-static void
-wset_base_line_number (struct window *w, Lisp_Object val)
-{
- w->base_line_number = val;
-}
-static void
-wset_base_line_pos (struct window *w, Lisp_Object val)
-{
- w->base_line_pos = val;
-}
-static void
-wset_column_number_displayed (struct window *w, Lisp_Object val)
-{
- w->column_number_displayed = val;
-}
-static void
-wset_region_showing (struct window *w, Lisp_Object val)
-{
- w->region_showing = val;
-}
-
#ifdef HAVE_WINDOW_SYSTEM
/* Test if overflow newline into fringe. Called with iterator IT
return (((BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)) != w->last_had_star)
|| ((!NILP (Vtransient_mark_mode) && !NILP (BVAR (b, mark_active)))
- != !NILP (w->region_showing)));
+ != w->region_showing));
}
/* Nonzero if W has %c in its mode line and mode line should be updated. */
static int
mode_line_update_needed (struct window *w)
{
- return (!NILP (w->column_number_displayed)
+ return (w->column_number_displayed != -1
&& !(PT == w->last_point && !window_outdated (w))
- && (XFASTINT (w->column_number_displayed) != current_column ()));
+ && (w->column_number_displayed != current_column ()));
}
/***********************************************************************
clear_garbaged_frames ();
}
-
- /* If showing the region, and mark has changed, we must redisplay
- the whole window. The assignment to this_line_start_pos prevents
- the optimization directly below this if-statement. */
- if (((!NILP (Vtransient_mark_mode)
- && !NILP (BVAR (XBUFFER (w->buffer), mark_active)))
- != !NILP (w->region_showing))
- || (!NILP (w->region_showing)
- && !EQ (w->region_showing,
- Fmarker_position (BVAR (XBUFFER (w->buffer), mark)))))
- CHARPOS (this_line_start_pos) = 0;
-
/* Optimize the case that only the line containing the cursor in the
selected window has changed. Variables starting with this_ are
set in display_line and record information about the line
&& (EQ (selected_window,
BVAR (current_buffer, last_selected_window))
|| highlight_nonselected_windows)
- && NILP (w->region_showing)
+ && !w->region_showing
&& NILP (Vshow_trailing_whitespace)
&& !cursor_in_echo_area)
{
if (!just_this_one_p
|| current_buffer->clip_changed
|| BEG_UNCHANGED < CHARPOS (startp))
- wset_base_line_number (w, Qnil);
+ w->base_line_number = 0;
/* If cursor ends up on a partially visible line,
treat that as being off the bottom of the screen. */
region exists, cursor movement has to do more than just
set the cursor. */
&& markpos_of_region () < 0
- && NILP (w->region_showing)
+ && !w->region_showing
&& NILP (Vshow_trailing_whitespace)
/* This code is not used for mini-buffer for the sake of the case
of redisplaying to replace an echo area message; since in
/* Forget any recorded base line for line number display. */
if (!buffer_unchanged_p)
- wset_base_line_number (w, Qnil);
+ w->base_line_number = 0;
/* Redisplay the mode line. Select the buffer properly for that.
Also, run the hook window-scroll-functions
|| current_buffer->clip_changed
|| BEG_UNCHANGED < CHARPOS (startp))
/* Forget any recorded base line for line number display. */
- wset_base_line_number (w, Qnil);
+ w->base_line_number = 0;
if (!cursor_row_fully_visible_p (w, 1, 0))
{
debug_method_add (w, "recenter");
#endif
- /* w->vscroll = 0; */
-
/* Forget any previously recorded base line for line number display. */
if (!buffer_unchanged_p)
- wset_base_line_number (w, Qnil);
+ w->base_line_number = 0;
/* Determine the window start relative to point. */
init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID);
&& !FRAME_WINDOW_P (f)
&& !WINDOW_FULL_WIDTH_P (w))
/* Line number to display. */
- || INTEGERP (w->base_line_pos)
+ || w->base_line_pos > 0
/* Column number is displayed and different from the one displayed. */
- || (!NILP (w->column_number_displayed)
- && (XFASTINT (w->column_number_displayed) != current_column ())))
+ || (w->column_number_displayed != -1
+ && (w->column_number_displayed != current_column ())))
/* This means that the window has a mode line. */
&& (WINDOW_WANTS_MODELINE_P (w)
|| WINDOW_WANTS_HEADER_LINE_P (w)))
goto need_larger_matrices;
}
- if (!line_number_displayed
- && !BUFFERP (w->base_line_pos))
+ if (!line_number_displayed && w->base_line_pos != -1)
{
- wset_base_line_pos (w, Qnil);
- wset_base_line_number (w, Qnil);
+ w->base_line_pos = 0;
+ w->base_line_number = 0;
}
finish_menu_bars:
/* Can't do this if region may have changed. */
if (0 <= markpos_of_region ()
- || !NILP (w->region_showing)
+ || w->region_showing
|| !NILP (Vshow_trailing_whitespace))
return 0;
GIVE_UP (11);
/* Likewise if showing a region. */
- if (!NILP (w->region_showing))
+ if (w->region_showing)
GIVE_UP (10);
/* Can't use this if overlay arrow position and/or string have
}
/* Is IT->w showing the region? */
- wset_region_showing (it->w, it->region_beg_charpos > 0 ? Qt : Qnil);
+ it->w->region_showing = it->region_beg_charpos > 0;
/* Clear the result glyph row and enable it. */
prepare_desired_row (row);
/* These will be set while the mode line specs are processed. */
line_number_displayed = 0;
- wset_column_number_displayed (w, Qnil);
+ w->column_number_displayed = -1;
if (WINDOW_WANTS_MODELINE_P (w))
{
returned with spaces to that value. Return a Lisp string in
*STRING if the resulting string is taken from that Lisp string.
- Note we operate on the current buffer for most purposes,
- the exception being w->base_line_pos. */
+ Note we operate on the current buffer for most purposes. */
static char lots_of_dashes[] = "--------------------------------------------------------------------------------------------------------------------------------------------";
else
{
ptrdiff_t col = current_column ();
- wset_column_number_displayed (w, make_number (col));
+ w->column_number_displayed = col;
pint2str (decode_mode_spec_buf, width, col);
return decode_mode_spec_buf;
}
/* If we decided that this buffer isn't suitable for line numbers,
don't forget that too fast. */
- if (EQ (w->base_line_pos, w->buffer))
+ if (w->base_line_pos == -1)
goto no_value;
- /* But do forget it, if the window shows a different buffer now. */
- else if (BUFFERP (w->base_line_pos))
- wset_base_line_pos (w, Qnil);
/* If the buffer is very big, don't waste time. */
if (INTEGERP (Vline_number_display_limit)
&& BUF_ZV (b) - BUF_BEGV (b) > XINT (Vline_number_display_limit))
{
- wset_base_line_pos (w, Qnil);
- wset_base_line_number (w, Qnil);
+ w->base_line_pos = 0;
+ w->base_line_number = 0;
goto no_value;
}
- if (INTEGERP (w->base_line_number)
- && INTEGERP (w->base_line_pos)
- && XFASTINT (w->base_line_pos) <= startpos)
+ if (w->base_line_number > 0
+ && w->base_line_pos > 0
+ && w->base_line_pos <= startpos)
{
- line = XFASTINT (w->base_line_number);
- linepos = XFASTINT (w->base_line_pos);
+ line = w->base_line_number;
+ linepos = w->base_line_pos;
linepos_byte = buf_charpos_to_bytepos (b, linepos);
}
else
go back past it. */
if (startpos == BUF_BEGV (b))
{
- wset_base_line_number (w, make_number (topline));
- wset_base_line_pos (w, make_number (BUF_BEGV (b)));
+ w->base_line_number = topline;
+ w->base_line_pos = BUF_BEGV (b);
}
else if (nlines < height + 25 || nlines > height * 3 + 50
|| linepos == BUF_BEGV (b))
give up on line numbers for this window. */
if (position == limit_byte && limit == startpos - distance)
{
- wset_base_line_pos (w, w->buffer);
- wset_base_line_number (w, Qnil);
+ w->base_line_pos = -1;
+ w->base_line_number = 0;
goto no_value;
}
- wset_base_line_number (w, make_number (topline - nlines));
- wset_base_line_pos (w, make_number (BYTE_TO_CHAR (position)));
+ w->base_line_number = topline - nlines;
+ w->base_line_pos = BYTE_TO_CHAR (position);
}
/* Now count lines from the start pos to point. */