diff options
| author | Dmitry Antipov | 2013-09-01 20:21:48 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2013-09-01 20:21:48 +0400 |
| commit | cf91889acb493863b93dc199d2a39e7f3a9b4cd4 (patch) | |
| tree | af972c96d3a1021e9c0d0737f4afa5940b4387b6 /src | |
| parent | a30edef8a9491ea9b293c3ac792e52260723bd24 (diff) | |
| download | emacs-cf91889acb493863b93dc199d2a39e7f3a9b4cd4.tar.gz emacs-cf91889acb493863b93dc199d2a39e7f3a9b4cd4.zip | |
* 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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/dispextern.h | 12 | ||||
| -rw-r--r-- | src/dispnew.c | 4 | ||||
| -rw-r--r-- | src/window.c | 16 | ||||
| -rw-r--r-- | src/xdisp.c | 9 |
5 files changed, 23 insertions, 26 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 7c09394cbf8..96df66999da 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2013-09-01 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | * dispextern.h (SET_TEXT_POS_FROM_MARKER): Indent. | ||
| 4 | (CLIP_TEXT_POS_FROM_MARKER): New macro. | ||
| 5 | * dispnew.c (buffer_posn_from_coords): | ||
| 6 | * window.c (Fwindow_end, displayed_window_lines): | ||
| 7 | * xdisp.c (redisplay_mode_lines): Use it. | ||
| 8 | |||
| 1 | 2013-09-01 Jan Djärv <jan.h.d@swipnet.se> | 9 | 2013-09-01 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 10 | ||
| 3 | * fontset.c (face_for_char): Check char in the current face font first | 11 | * fontset.c (face_for_char): Check char in the current face font first |
diff --git a/src/dispextern.h b/src/dispextern.h index ce9a34a2e71..947e50fa4dd 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -223,8 +223,16 @@ struct text_pos | |||
| 223 | /* Set text position POS from marker MARKER. */ | 223 | /* Set text position POS from marker MARKER. */ |
| 224 | 224 | ||
| 225 | #define SET_TEXT_POS_FROM_MARKER(POS, MARKER) \ | 225 | #define SET_TEXT_POS_FROM_MARKER(POS, MARKER) \ |
| 226 | (CHARPOS (POS) = marker_position ((MARKER)), \ | 226 | (CHARPOS (POS) = marker_position (MARKER), \ |
| 227 | BYTEPOS (POS) = marker_byte_position ((MARKER))) | 227 | BYTEPOS (POS) = marker_byte_position (MARKER)) |
| 228 | |||
| 229 | /* Like above, but clip POS within accessible range. */ | ||
| 230 | |||
| 231 | #define CLIP_TEXT_POS_FROM_MARKER(POS, MARKER) \ | ||
| 232 | (CHARPOS (POS) = clip_to_bounds \ | ||
| 233 | (BEGV, marker_position (MARKER), ZV), \ | ||
| 234 | BYTEPOS (POS) = clip_to_bounds \ | ||
| 235 | (BEGV_BYTE, marker_byte_position (MARKER), ZV_BYTE)) | ||
| 228 | 236 | ||
| 229 | /* Set marker MARKER from text position POS. */ | 237 | /* Set marker MARKER from text position POS. */ |
| 230 | 238 | ||
diff --git a/src/dispnew.c b/src/dispnew.c index f2298ffabe4..0e336d4feea 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -5066,9 +5066,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p | |||
| 5066 | wrong thing with `face-remapping-alist' (bug#2044). */ | 5066 | wrong thing with `face-remapping-alist' (bug#2044). */ |
| 5067 | Fset_buffer (w->contents); | 5067 | Fset_buffer (w->contents); |
| 5068 | itdata = bidi_shelve_cache (); | 5068 | itdata = bidi_shelve_cache (); |
| 5069 | SET_TEXT_POS_FROM_MARKER (startp, w->start); | 5069 | CLIP_TEXT_POS_FROM_MARKER (startp, w->start); |
| 5070 | CHARPOS (startp) = min (ZV, max (BEGV, CHARPOS (startp))); | ||
| 5071 | BYTEPOS (startp) = min (ZV_BYTE, max (BEGV_BYTE, BYTEPOS (startp))); | ||
| 5072 | start_display (&it, w, startp); | 5070 | start_display (&it, w, startp); |
| 5073 | /* start_display takes into account the header-line row, but IT's | 5071 | /* start_display takes into account the header-line row, but IT's |
| 5074 | vpos still counts from the glyph row that includes the window's | 5072 | vpos still counts from the glyph row that includes the window's |
diff --git a/src/window.c b/src/window.c index 560f31e2c27..ef96861dc71 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -1494,7 +1494,6 @@ if it isn't already recorded. */) | |||
| 1494 | && !noninteractive) | 1494 | && !noninteractive) |
| 1495 | { | 1495 | { |
| 1496 | struct text_pos startp; | 1496 | struct text_pos startp; |
| 1497 | ptrdiff_t charpos = marker_position (w->start); | ||
| 1498 | struct it it; | 1497 | struct it it; |
| 1499 | struct buffer *old_buffer = NULL; | 1498 | struct buffer *old_buffer = NULL; |
| 1500 | void *itdata = NULL; | 1499 | void *itdata = NULL; |
| @@ -1512,12 +1511,7 @@ if it isn't already recorded. */) | |||
| 1512 | `-l' containing a call to `rmail' with subsequent other | 1511 | `-l' containing a call to `rmail' with subsequent other |
| 1513 | commands. At the end, W->start happened to be BEG, while | 1512 | commands. At the end, W->start happened to be BEG, while |
| 1514 | rmail had already narrowed the buffer. */ | 1513 | rmail had already narrowed the buffer. */ |
| 1515 | if (charpos < BEGV) | 1514 | CLIP_TEXT_POS_FROM_MARKER (startp, w->start); |
| 1516 | SET_TEXT_POS (startp, BEGV, BEGV_BYTE); | ||
| 1517 | else if (charpos > ZV) | ||
| 1518 | SET_TEXT_POS (startp, ZV, ZV_BYTE); | ||
| 1519 | else | ||
| 1520 | SET_TEXT_POS_FROM_MARKER (startp, w->start); | ||
| 1521 | 1515 | ||
| 1522 | itdata = bidi_shelve_cache (); | 1516 | itdata = bidi_shelve_cache (); |
| 1523 | start_display (&it, w, startp); | 1517 | start_display (&it, w, startp); |
| @@ -5038,7 +5032,6 @@ displayed_window_lines (struct window *w) | |||
| 5038 | { | 5032 | { |
| 5039 | struct it it; | 5033 | struct it it; |
| 5040 | struct text_pos start; | 5034 | struct text_pos start; |
| 5041 | ptrdiff_t charpos = marker_position (w->start); | ||
| 5042 | int height = window_box_height (w); | 5035 | int height = window_box_height (w); |
| 5043 | struct buffer *old_buffer; | 5036 | struct buffer *old_buffer; |
| 5044 | int bottom_y; | 5037 | int bottom_y; |
| @@ -5055,12 +5048,7 @@ displayed_window_lines (struct window *w) | |||
| 5055 | /* In case W->start is out of the accessible range, do something | 5048 | /* In case W->start is out of the accessible range, do something |
| 5056 | reasonable. This happens in Info mode when Info-scroll-down | 5049 | reasonable. This happens in Info mode when Info-scroll-down |
| 5057 | calls (recenter -1) while W->start is 1. */ | 5050 | calls (recenter -1) while W->start is 1. */ |
| 5058 | if (charpos < BEGV) | 5051 | CLIP_TEXT_POS_FROM_MARKER (start, w->start); |
| 5059 | SET_TEXT_POS (start, BEGV, BEGV_BYTE); | ||
| 5060 | else if (charpos > ZV) | ||
| 5061 | SET_TEXT_POS (start, ZV, ZV_BYTE); | ||
| 5062 | else | ||
| 5063 | SET_TEXT_POS_FROM_MARKER (start, w->start); | ||
| 5064 | 5052 | ||
| 5065 | itdata = bidi_shelve_cache (); | 5053 | itdata = bidi_shelve_cache (); |
| 5066 | start_display (&it, w, start); | 5054 | start_display (&it, w, start); |
diff --git a/src/xdisp.c b/src/xdisp.c index b65800bd4c4..d78e78a58d3 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -20606,13 +20606,8 @@ redisplay_mode_lines (Lisp_Object window, int force) | |||
| 20606 | { | 20606 | { |
| 20607 | struct text_pos pt; | 20607 | struct text_pos pt; |
| 20608 | 20608 | ||
| 20609 | SET_TEXT_POS_FROM_MARKER (pt, w->pointm); | 20609 | CLIP_TEXT_POS_FROM_MARKER (pt, w->pointm); |
| 20610 | if (CHARPOS (pt) < BEGV) | 20610 | TEMP_SET_PT_BOTH (CHARPOS (pt), BYTEPOS (pt)); |
| 20611 | TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); | ||
| 20612 | else if (CHARPOS (pt) > (ZV - 1)) | ||
| 20613 | TEMP_SET_PT_BOTH (ZV, ZV_BYTE); | ||
| 20614 | else | ||
| 20615 | TEMP_SET_PT_BOTH (CHARPOS (pt), BYTEPOS (pt)); | ||
| 20616 | } | 20611 | } |
| 20617 | 20612 | ||
| 20618 | /* Display mode lines. */ | 20613 | /* Display mode lines. */ |