emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114092: * dispextern.h (SET_TEXT_POS_FROM_MARKER):


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r114092: * dispextern.h (SET_TEXT_POS_FROM_MARKER): Indent.
Date: Sun, 01 Sep 2013 16:22:53 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114092
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Sun 2013-09-01 20:21:48 +0400
message:
  * 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.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/dispextern.h               
dispextern.h-20091113204419-o5vbwnq5f7feedwu-218
  src/dispnew.c                  dispnew.c-20091113204419-o5vbwnq5f7feedwu-258
  src/window.c                   window.c-20091113204419-o5vbwnq5f7feedwu-231
  src/xdisp.c                    xdisp.c-20091113204419-o5vbwnq5f7feedwu-240
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-09-01 09:59:19 +0000
+++ b/src/ChangeLog     2013-09-01 16:21:48 +0000
@@ -1,3 +1,11 @@
+2013-09-01  Dmitry Antipov  <address@hidden>
+
+       * 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  <address@hidden>
 
        * fontset.c (face_for_char): Check char in the current face font first

=== modified file 'src/dispextern.h'
--- a/src/dispextern.h  2013-08-30 12:17:44 +0000
+++ b/src/dispextern.h  2013-09-01 16:21:48 +0000
@@ -223,8 +223,16 @@
 /* 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.  */
 

=== modified file 'src/dispnew.c'
--- a/src/dispnew.c     2013-08-28 11:00:03 +0000
+++ b/src/dispnew.c     2013-09-01 16:21:48 +0000
@@ -5066,9 +5066,7 @@
      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

=== modified file 'src/window.c'
--- a/src/window.c      2013-08-31 09:22:53 +0000
+++ b/src/window.c      2013-09-01 16:21:48 +0000
@@ -1494,7 +1494,6 @@
       && !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 @@
          `-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 @@
 {
   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 @@
   /* 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);

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2013-08-28 11:00:03 +0000
+++ b/src/xdisp.c       2013-09-01 16:21:48 +0000
@@ -20606,13 +20606,8 @@
            {
              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.  */


reply via email to

[Prev in Thread] Current Thread [Next in Thread]