emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/window.c


From: Richard M . Stallman
Subject: [Emacs-diffs] Changes to emacs/src/window.c
Date: Wed, 06 Jul 2005 18:06:16 -0400

Index: emacs/src/window.c
diff -c emacs/src/window.c:1.508 emacs/src/window.c:1.509
*** emacs/src/window.c:1.508    Mon Jul  4 16:06:38 2005
--- emacs/src/window.c  Wed Jul  6 22:06:15 2005
***************
*** 5333,5338 ****
--- 5333,5340 ----
    struct buffer *obuf = current_buffer;
    int center_p = 0;
    int charpos, bytepos;
+   int iarg;
+   int this_scroll_margin;
  
    /* If redisplay is suppressed due to an error, try again.  */
    obuf->display_error_modiff = 0;
***************
*** 5359,5364 ****
--- 5361,5372 ----
  
    set_buffer_internal (buf);
  
+   /* Do this after making BUF current
+      in case scroll_margin is buffer-local.  */
+   this_scroll_margin = max (0, scroll_margin);
+   this_scroll_margin = min (this_scroll_margin,
+                           XFASTINT (w->total_lines) / 4);
+ 
    /* Handle centering on a graphical frame specially.  Such frames can
       have variable-height lines and centering point on the basis of
       line counts would lead to strange effects.  */
***************
*** 5375,5388 ****
          charpos = IT_CHARPOS (it);
          bytepos = IT_BYTEPOS (it);
        }
!       else if (XINT (arg) < 0)
        {
          struct it it;
          struct text_pos pt;
!         int nlines = - XINT (arg);
          int extra_line_spacing;
          int h = window_box_height (w);
  
          SET_TEXT_POS (pt, PT, PT_BYTE);
          start_display (&it, w, pt);
  
--- 5383,5399 ----
          charpos = IT_CHARPOS (it);
          bytepos = IT_BYTEPOS (it);
        }
!       else if (iarg < 0)
        {
          struct it it;
          struct text_pos pt;
!         int nlines = -iarg;
          int extra_line_spacing;
          int h = window_box_height (w);
  
+         iarg = XINT (arg);
+         iarg = - max (-iarg, this_scroll_margin);
+ 
          SET_TEXT_POS (pt, PT, PT_BYTE);
          start_display (&it, w, pt);
  
***************
*** 5441,5447 ****
        else
        {
          struct position pos;
!         pos = *vmotion (PT, - XINT (arg), w);
          charpos = pos.bufpos;
          bytepos = pos.bytepos;
        }
--- 5452,5462 ----
        else
        {
          struct position pos;
! 
!         iarg = XINT (arg);
!         iarg = max (iarg, this_scroll_margin);
! 
!         pos = *vmotion (PT, -iarg, w);
          charpos = pos.bufpos;
          bytepos = pos.bytepos;
        }
***************
*** 5452,5462 ****
        int ht = window_internal_height (w);
  
        if (center_p)
!       arg = make_number (ht / 2);
        else if (XINT (arg) < 0)
!       arg = make_number (XINT (arg) + ht);
  
!       pos = *vmotion (PT, - XINT (arg), w);
        charpos = pos.bufpos;
        bytepos = pos.bytepos;
      }
--- 5467,5483 ----
        int ht = window_internal_height (w);
  
        if (center_p)
!       iarg = make_number (ht / 2);
        else if (XINT (arg) < 0)
!       iarg = XINT (arg) + ht;
!       else
!       iarg = XINT (arg);
  
!       /* Don't let it get into the margin at either top or bottom.  */
!       iarg = max (iarg, this_scroll_margin);
!       iarg = min (iarg, ht - this_scroll_margin - 1);
! 
!       pos = *vmotion (PT, - iarg, w);
        charpos = pos.bufpos;
        bytepos = pos.bytepos;
      }
***************
*** 5505,5510 ****
--- 5526,5534 ----
    struct window *w = XWINDOW (selected_window);
    int lines, start;
    Lisp_Object window;
+ #if 0
+   int this_scroll_margin;
+ #endif
  
    window = selected_window;
    start = marker_position (w->start);
***************
*** 5520,5532 ****
      Fgoto_char (w->start);
  
    lines = displayed_window_lines (w);
    if (NILP (arg))
      XSETFASTINT (arg, lines / 2);
    else
      {
!       arg = Fprefix_numeric_value (arg);
!       if (XINT (arg) < 0)
!       XSETINT (arg, XINT (arg) + lines);
      }
  
    /* Skip past a partially visible first line.  */
--- 5544,5576 ----
      Fgoto_char (w->start);
  
    lines = displayed_window_lines (w);
+ 
+ #if 0
+   this_scroll_margin = max (0, scroll_margin);
+   this_scroll_margin = min (this_scroll_margin, lines / 4);
+ #endif
+ 
    if (NILP (arg))
      XSETFASTINT (arg, lines / 2);
    else
      {
!       int iarg = XINT (Fprefix_numeric_value (arg));
! 
!       if (iarg < 0)
!       iarg = iarg + lines;
! 
! #if 0  /* This code would prevent move-to-window-line from moving point
!         to a place inside the scroll margins (which would cause the
!         next redisplay to scroll).  I wrote this code, but then concluded
!         it is probably better not to install it.  However, it is here
!         inside #if 0 so as not to lose it.  -- rms.  */
! 
!       /* Don't let it get into the margin at either top or bottom.  */
!       iarg = max (iarg, this_scroll_margin);
!       iarg = min (iarg, lines - this_scroll_margin - 1);
! #endif
! 
!       arg = make_number (iarg);
      }
  
    /* Skip past a partially visible first line.  */




reply via email to

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