/[emacs]/emacs/src/window.c
ViewVC logotype

Diff of /emacs/src/window.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.508 by lute, Mon Jul 4 16:06:38 2005 UTC revision 1.509 by rms, Wed Jul 6 22:06:15 2005 UTC
# Line 5333  and redisplay normally--don't erase and Line 5333  and redisplay normally--don't erase and
5333    struct buffer *obuf = current_buffer;    struct buffer *obuf = current_buffer;
5334    int center_p = 0;    int center_p = 0;
5335    int charpos, bytepos;    int charpos, bytepos;
5336      int iarg;
5337      int this_scroll_margin;
5338    
5339    /* If redisplay is suppressed due to an error, try again.  */    /* If redisplay is suppressed due to an error, try again.  */
5340    obuf->display_error_modiff = 0;    obuf->display_error_modiff = 0;
# Line 5359  and redisplay normally--don't erase and Line 5361  and redisplay normally--don't erase and
5361    
5362    set_buffer_internal (buf);    set_buffer_internal (buf);
5363    
5364      /* Do this after making BUF current
5365         in case scroll_margin is buffer-local.  */
5366      this_scroll_margin = max (0, scroll_margin);
5367      this_scroll_margin = min (this_scroll_margin,
5368                                XFASTINT (w->total_lines) / 4);
5369    
5370    /* Handle centering on a graphical frame specially.  Such frames can    /* Handle centering on a graphical frame specially.  Such frames can
5371       have variable-height lines and centering point on the basis of       have variable-height lines and centering point on the basis of
5372       line counts would lead to strange effects.  */       line counts would lead to strange effects.  */
# Line 5375  and redisplay normally--don't erase and Line 5383  and redisplay normally--don't erase and
5383            charpos = IT_CHARPOS (it);            charpos = IT_CHARPOS (it);
5384            bytepos = IT_BYTEPOS (it);            bytepos = IT_BYTEPOS (it);
5385          }          }
5386        else if (XINT (arg) < 0)        else if (iarg < 0)
5387          {          {
5388            struct it it;            struct it it;
5389            struct text_pos pt;            struct text_pos pt;
5390            int nlines = - XINT (arg);            int nlines = -iarg;
5391            int extra_line_spacing;            int extra_line_spacing;
5392            int h = window_box_height (w);            int h = window_box_height (w);
5393    
5394              iarg = XINT (arg);
5395              iarg = - max (-iarg, this_scroll_margin);
5396    
5397            SET_TEXT_POS (pt, PT, PT_BYTE);            SET_TEXT_POS (pt, PT, PT_BYTE);
5398            start_display (&it, w, pt);            start_display (&it, w, pt);
5399    
# Line 5441  and redisplay normally--don't erase and Line 5452  and redisplay normally--don't erase and
5452        else        else
5453          {          {
5454            struct position pos;            struct position pos;
5455            pos = *vmotion (PT, - XINT (arg), w);  
5456              iarg = XINT (arg);
5457              iarg = max (iarg, this_scroll_margin);
5458    
5459              pos = *vmotion (PT, -iarg, w);
5460            charpos = pos.bufpos;            charpos = pos.bufpos;
5461            bytepos = pos.bytepos;            bytepos = pos.bytepos;
5462          }          }
# Line 5452  and redisplay normally--don't erase and Line 5467  and redisplay normally--don't erase and
5467        int ht = window_internal_height (w);        int ht = window_internal_height (w);
5468    
5469        if (center_p)        if (center_p)
5470          arg = make_number (ht / 2);          iarg = make_number (ht / 2);
5471        else if (XINT (arg) < 0)        else if (XINT (arg) < 0)
5472          arg = make_number (XINT (arg) + ht);          iarg = XINT (arg) + ht;
5473          else
5474            iarg = XINT (arg);
5475    
5476          /* Don't let it get into the margin at either top or bottom.  */
5477          iarg = max (iarg, this_scroll_margin);
5478          iarg = min (iarg, ht - this_scroll_margin - 1);
5479    
5480        pos = *vmotion (PT, - XINT (arg), w);        pos = *vmotion (PT, - iarg, w);
5481        charpos = pos.bufpos;        charpos = pos.bufpos;
5482        bytepos = pos.bytepos;        bytepos = pos.bytepos;
5483      }      }
# Line 5505  zero means top of window, negative means Line 5526  zero means top of window, negative means
5526    struct window *w = XWINDOW (selected_window);    struct window *w = XWINDOW (selected_window);
5527    int lines, start;    int lines, start;
5528    Lisp_Object window;    Lisp_Object window;
5529    #if 0
5530      int this_scroll_margin;
5531    #endif
5532    
5533    window = selected_window;    window = selected_window;
5534    start = marker_position (w->start);    start = marker_position (w->start);
# Line 5520  zero means top of window, negative means Line 5544  zero means top of window, negative means
5544      Fgoto_char (w->start);      Fgoto_char (w->start);
5545    
5546    lines = displayed_window_lines (w);    lines = displayed_window_lines (w);
5547    
5548    #if 0
5549      this_scroll_margin = max (0, scroll_margin);
5550      this_scroll_margin = min (this_scroll_margin, lines / 4);
5551    #endif
5552    
5553    if (NILP (arg))    if (NILP (arg))
5554      XSETFASTINT (arg, lines / 2);      XSETFASTINT (arg, lines / 2);
5555    else    else
5556      {      {
5557        arg = Fprefix_numeric_value (arg);        int iarg = XINT (Fprefix_numeric_value (arg));
5558        if (XINT (arg) < 0)  
5559          XSETINT (arg, XINT (arg) + lines);        if (iarg < 0)
5560            iarg = iarg + lines;
5561    
5562    #if 0  /* This code would prevent move-to-window-line from moving point
5563              to a place inside the scroll margins (which would cause the
5564              next redisplay to scroll).  I wrote this code, but then concluded
5565              it is probably better not to install it.  However, it is here
5566              inside #if 0 so as not to lose it.  -- rms.  */
5567    
5568          /* Don't let it get into the margin at either top or bottom.  */
5569          iarg = max (iarg, this_scroll_margin);
5570          iarg = min (iarg, lines - this_scroll_margin - 1);
5571    #endif
5572    
5573          arg = make_number (iarg);
5574      }      }
5575    
5576    /* Skip past a partially visible first line.  */    /* Skip past a partially visible first line.  */

Legend:
Removed from v.1.508  
changed lines
  Added in v.1.509

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26