aboutsummaryrefslogtreecommitdiffstats
path: root/src/dispextern.h
diff options
context:
space:
mode:
authorDmitry Antipov <[email protected]>2013-09-01 20:21:48 +0400
committerDmitry Antipov <[email protected]>2013-09-01 20:21:48 +0400
commitcf91889acb493863b93dc199d2a39e7f3a9b4cd4 (patch)
treeaf972c96d3a1021e9c0d0737f4afa5940b4387b6 /src/dispextern.h
parenta30edef8a9491ea9b293c3ac792e52260723bd24 (diff)
* 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/dispextern.h')
-rw-r--r--src/dispextern.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/dispextern.h b/src/dispextern.h
index ce9a34a2e7..947e50fa4d 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -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. */