Commit cf91889a authored by Dmitry Antipov's avatar Dmitry Antipov
Browse files

* dispextern.h (SET_TEXT_POS_FROM_MARKER): Indent.

(CLIP_TEXT_POS_FROM_MARKER): New macro.
* dispnew.c (buffer_posn_from_coords):
* window.c (Fwindow_end, displayed_window_lines):
* xdisp.c (redisplay_mode_lines): Use it.
parent a30edef8
2013-09-01 Dmitry Antipov <dmantipov@yandex.ru>
* dispextern.h (SET_TEXT_POS_FROM_MARKER): Indent.
(CLIP_TEXT_POS_FROM_MARKER): New macro.
* dispnew.c (buffer_posn_from_coords):
* window.c (Fwindow_end, displayed_window_lines):
* xdisp.c (redisplay_mode_lines): Use it.
2013-09-01 Jan Djärv <jan.h.d@swipnet.se>
* fontset.c (face_for_char): Check char in the current face font first
......
......@@ -223,8 +223,16 @@ struct text_pos
/* Set text position POS from marker MARKER. */
#define SET_TEXT_POS_FROM_MARKER(POS, MARKER) \
(CHARPOS (POS) = marker_position ((MARKER)), \
BYTEPOS (POS) = marker_byte_position ((MARKER)))
(CHARPOS (POS) = marker_position (MARKER), \
BYTEPOS (POS) = marker_byte_position (MARKER))
/* Like above, but clip POS within accessible range. */
#define CLIP_TEXT_POS_FROM_MARKER(POS, MARKER) \
(CHARPOS (POS) = clip_to_bounds \
(BEGV, marker_position (MARKER), ZV), \
BYTEPOS (POS) = clip_to_bounds \
(BEGV_BYTE, marker_byte_position (MARKER), ZV_BYTE))
/* Set marker MARKER from text position POS. */
......
......@@ -5066,9 +5066,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p
wrong thing with `face-remapping-alist' (bug#2044). */
Fset_buffer (w->contents);
itdata = bidi_shelve_cache ();
SET_TEXT_POS_FROM_MARKER (startp, w->start);
CHARPOS (startp) = min (ZV, max (BEGV, CHARPOS (startp)));
BYTEPOS (startp) = min (ZV_BYTE, max (BEGV_BYTE, BYTEPOS (startp)));
CLIP_TEXT_POS_FROM_MARKER (startp, w->start);
start_display (&it, w, startp);
/* start_display takes into account the header-line row, but IT's
vpos still counts from the glyph row that includes the window's
......
......@@ -1494,7 +1494,6 @@ if it isn't already recorded. */)
&& !noninteractive)
{
struct text_pos startp;
ptrdiff_t charpos = marker_position (w->start);
struct it it;
struct buffer *old_buffer = NULL;
void *itdata = NULL;
......@@ -1512,12 +1511,7 @@ if it isn't already recorded. */)
`-l' containing a call to `rmail' with subsequent other
commands. At the end, W->start happened to be BEG, while
rmail had already narrowed the buffer. */
if (charpos < BEGV)
SET_TEXT_POS (startp, BEGV, BEGV_BYTE);
else if (charpos > ZV)
SET_TEXT_POS (startp, ZV, ZV_BYTE);
else
SET_TEXT_POS_FROM_MARKER (startp, w->start);
CLIP_TEXT_POS_FROM_MARKER (startp, w->start);
itdata = bidi_shelve_cache ();
start_display (&it, w, startp);
......@@ -5038,7 +5032,6 @@ displayed_window_lines (struct window *w)
{
struct it it;
struct text_pos start;
ptrdiff_t charpos = marker_position (w->start);
int height = window_box_height (w);
struct buffer *old_buffer;
int bottom_y;
......@@ -5055,12 +5048,7 @@ displayed_window_lines (struct window *w)
/* In case W->start is out of the accessible range, do something
reasonable. This happens in Info mode when Info-scroll-down
calls (recenter -1) while W->start is 1. */
if (charpos < BEGV)
SET_TEXT_POS (start, BEGV, BEGV_BYTE);
else if (charpos > ZV)
SET_TEXT_POS (start, ZV, ZV_BYTE);
else
SET_TEXT_POS_FROM_MARKER (start, w->start);
CLIP_TEXT_POS_FROM_MARKER (start, w->start);
itdata = bidi_shelve_cache ();
start_display (&it, w, start);
......
......@@ -20606,13 +20606,8 @@ redisplay_mode_lines (Lisp_Object window, int force)
{
struct text_pos pt;
SET_TEXT_POS_FROM_MARKER (pt, w->pointm);
if (CHARPOS (pt) < BEGV)
TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);
else if (CHARPOS (pt) > (ZV - 1))
TEMP_SET_PT_BOTH (ZV, ZV_BYTE);
else
TEMP_SET_PT_BOTH (CHARPOS (pt), BYTEPOS (pt));
CLIP_TEXT_POS_FROM_MARKER (pt, w->pointm);
TEMP_SET_PT_BOTH (CHARPOS (pt), BYTEPOS (pt));
}
/* Display mode lines. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment