comparison src/window.c @ 1708:a19b0eb5dfc1

[xemacs-hg @ 2003-09-22 04:21:42 by james] Add new pos-visible-in-window-p parameter for Emacs compatibility.
author james
date Mon, 22 Sep 2003 04:21:43 +0000
parents cd0abfdb9e9d
children 84acc03a7080
comparison
equal deleted inserted replaced
1707:fca75a427ae3 1708:a19b0eb5dfc1
1411 (window)) 1411 (window))
1412 { 1412 {
1413 return window_is_rightmost (decode_window (window)) ? Qt : Qnil; 1413 return window_is_rightmost (decode_window (window)) ? Qt : Qnil;
1414 } 1414 }
1415 1415
1416 DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p, 0, 2, 0, /* 1416 DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p, 0, 3, 0, /*
1417 Return t if position POS is currently on the frame in WINDOW. 1417 Returns t if position POS is currently on the frame in WINDOW.
1418 Returns nil if that position is scrolled vertically out of view. 1418 Returns nil if that position is scrolled vertically out of view.
1419 If a character is only partially visible, nil is returned, unless the
1420 optional argument PARTIALLY is non-nil.
1419 POS defaults to point in WINDOW's buffer; WINDOW, to the selected window. 1421 POS defaults to point in WINDOW's buffer; WINDOW, to the selected window.
1420 */ 1422 */
1421 (pos, window)) 1423 (pos, window, partially))
1422 { 1424 {
1423 struct window *w = decode_window (window); 1425 struct window *w = decode_window (window);
1424 Charbpos top = marker_position (w->start[CURRENT_DISP]); 1426 Charbpos top = marker_position (w->start[CURRENT_DISP]);
1425 Charbpos posint; 1427 Charbpos posint;
1426 struct buffer *buf = XBUFFER (w->buffer); 1428 struct buffer *buf = XBUFFER (w->buffer);
1438 1440
1439 /* w->start can be out of range. If it is, do something reasonable. */ 1441 /* w->start can be out of range. If it is, do something reasonable. */
1440 if (top < BUF_BEGV (buf) || top > BUF_ZV (buf)) 1442 if (top < BUF_BEGV (buf) || top > BUF_ZV (buf))
1441 return Qnil; 1443 return Qnil;
1442 1444
1443 return point_would_be_visible (w, top, posint) ? Qt : Qnil; 1445 return point_would_be_visible (w, top, posint, !NILP (partially))
1446 ? Qt : Qnil;
1444 } 1447 }
1445 1448
1446 1449
1447 struct window * 1450 struct window *
1448 decode_window (Lisp_Object window) 1451 decode_window (Lisp_Object window)
4457 w->force_start = 1; 4460 w->force_start = 1;
4458 4461
4459 /* #### When the fuck does this happen? I'm so glad that history has 4462 /* #### When the fuck does this happen? I'm so glad that history has
4460 completely documented the behavior of the scrolling functions under 4463 completely documented the behavior of the scrolling functions under
4461 all circumstances. */ 4464 all circumstances. */
4462 tem = Fpos_visible_in_window_p (point, window); 4465 tem = Fpos_visible_in_window_p (point, window, Qnil);
4463 if (NILP (tem)) 4466 if (NILP (tem))
4464 { 4467 {
4465 Fvertical_motion (make_int (-window_char_height (w, 0) / 2), 4468 Fvertical_motion (make_int (-window_char_height (w, 0) / 2),
4466 window, Qnil); 4469 window, Qnil);
4467 Fset_marker (w->start[CURRENT_DISP], point, w->buffer); 4470 Fset_marker (w->start[CURRENT_DISP], point, w->buffer);
4565 w->buffer); 4568 w->buffer);
4566 w->force_start = 1; 4569 w->force_start = 1;
4567 w->start_at_line_beg = beginning_of_line_p (b, startp); 4570 w->start_at_line_beg = beginning_of_line_p (b, startp);
4568 MARK_WINDOWS_CHANGED (w); 4571 MARK_WINDOWS_CHANGED (w);
4569 4572
4570 if (!point_would_be_visible (w, startp, XINT (point))) 4573 if (!point_would_be_visible (w, startp, XINT (point), 0))
4571 Fset_window_point (wrap_window (w), make_int (startp)); 4574 Fset_window_point (wrap_window (w), make_int (startp));
4572 } 4575 }
4573 } 4576 }
4574 } 4577 }
4575 else if (value < 0) 4578 else if (value < 0)
4633 && dl->ascent + fheight * value > 0) 4636 && dl->ascent + fheight * value > 0)
4634 { 4637 {
4635 WINDOW_TEXT_TOP_CLIP (w) = (dl->ascent + fheight * value); 4638 WINDOW_TEXT_TOP_CLIP (w) = (dl->ascent + fheight * value);
4636 } 4639 }
4637 4640
4638 if (!point_would_be_visible (w, startp, XINT (point))) 4641 if (!point_would_be_visible (w, startp, XINT (point), 0))
4639 { 4642 {
4640 Charbpos new_point; 4643 Charbpos new_point;
4641 4644
4642 if (MINI_WINDOW_P (w)) 4645 if (MINI_WINDOW_P (w))
4643 new_point = startp; 4646 new_point = startp;
4678 w->buffer); 4681 w->buffer);
4679 w->force_start = 1; 4682 w->force_start = 1;
4680 w->start_at_line_beg = beginning_of_line_p (b, startp); 4683 w->start_at_line_beg = beginning_of_line_p (b, startp);
4681 MARK_WINDOWS_CHANGED (w); 4684 MARK_WINDOWS_CHANGED (w);
4682 4685
4683 if (!point_would_be_visible (w, startp, XINT (point))) 4686 if (!point_would_be_visible (w, startp, XINT (point), 0))
4684 { 4687 {
4685 Charbpos new_point = start_of_last_line (w, startp); 4688 Charbpos new_point = start_of_last_line (w, startp);
4686 4689
4687 Fset_window_point (wrap_window (w), make_int (new_point)); 4690 Fset_window_point (wrap_window (w), make_int (new_point));
4688 } 4691 }