aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim F. Storm2004-09-27 13:28:23 +0000
committerKim F. Storm2004-09-27 13:28:23 +0000
commit5797a7a0fc06f03c4800c0fd2bdd34d7d44fbb3a (patch)
tree7cdbaa5aeb8603606b4fb013fb6b23cd5872f31a
parentb2229037362245da8e56fb0a06e779065640285c (diff)
downloademacs-5797a7a0fc06f03c4800c0fd2bdd34d7d44fbb3a.tar.gz
emacs-5797a7a0fc06f03c4800c0fd2bdd34d7d44fbb3a.zip
(update_window_fringes): Handle new formats of
indicate-buffer-boundaries (symbol or alist). No longer allow a simple cons. (Ffringe_bitmaps_at_pos): Use nil value for no bitmap.
-rw-r--r--src/fringe.c94
1 files changed, 51 insertions, 43 deletions
diff --git a/src/fringe.c b/src/fringe.c
index 3eafda4f639..03cd5fe93af 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -32,6 +32,7 @@ Boston, MA 02111-1307, USA. */
32#ifdef HAVE_WINDOW_SYSTEM 32#ifdef HAVE_WINDOW_SYSTEM
33 33
34extern Lisp_Object Qtop, Qbottom, Qcenter; 34extern Lisp_Object Qtop, Qbottom, Qcenter;
35extern Lisp_Object Qup, Qdown, Qleft, Qright;
35 36
36/* Non-nil means that newline may flow into the right fringe. */ 37/* Non-nil means that newline may flow into the right fringe. */
37 38
@@ -706,9 +707,10 @@ update_window_fringes (w, force_p)
706 int rn, nrows = w->current_matrix->nrows; 707 int rn, nrows = w->current_matrix->nrows;
707 int y; 708 int y;
708 int redraw_p = 0; 709 int redraw_p = 0;
709 Lisp_Object ind; 710 Lisp_Object boundary_top = Qnil, boundary_bot = Qnil;
710 int boundary_pos = 0, arrow_pos = 0; 711 Lisp_Object arrow_top = Qnil, arrow_bot = Qnil;
711 int empty_pos = 0; 712 Lisp_Object empty_pos;
713 Lisp_Object ind = Qnil;
712 714
713 if (w->pseudo_window_p) 715 if (w->pseudo_window_p)
714 return 0; 716 return 0;
@@ -716,23 +718,29 @@ update_window_fringes (w, force_p)
716 if (!MINI_WINDOW_P (w) 718 if (!MINI_WINDOW_P (w)
717 && (ind = XBUFFER (w->buffer)->indicate_buffer_boundaries, !NILP (ind))) 719 && (ind = XBUFFER (w->buffer)->indicate_buffer_boundaries, !NILP (ind)))
718 { 720 {
719 int do_eob = 1, do_bob = 1; 721 if (EQ (ind, Qleft) || EQ (ind, Qright))
720 Lisp_Object arrows; 722 boundary_top = boundary_bot = arrow_top = arrow_bot = ind;
721 723 else if (CONSP (ind) && CONSP (XCAR (ind)))
722 if (CONSP (ind)) 724 {
723 arrows = XCDR (ind), ind = XCAR (ind); 725 Lisp_Object pos;
726 if (pos = Fassq (Qt, ind), !NILP (pos))
727 boundary_top = boundary_bot = arrow_top = arrow_bot = XCDR (pos);
728 if (pos = Fassq (Qtop, ind), !NILP (pos))
729 boundary_top = XCDR (pos);
730 if (pos = Fassq (Qbottom, ind), !NILP (pos))
731 boundary_bot = XCDR (pos);
732 if (pos = Fassq (Qup, ind), !NILP (pos))
733 arrow_top = XCDR (pos);
734 if (pos = Fassq (Qdown, ind), !NILP (pos))
735 arrow_bot = XCDR (pos);
736 }
724 else 737 else
725 arrows = ind; 738 ind = Qnil;
726 739 }
727 if (EQ (ind, Qleft))
728 boundary_pos = -1;
729 else if (EQ (ind, Qright))
730 boundary_pos = 1;
731 740
732 if (EQ (arrows, Qleft)) 741 if (!NILP (ind))
733 arrow_pos = -1; 742 {
734 else if (EQ (arrows, Qright)) 743 int do_eob = 1, do_bob = 1;
735 arrow_pos = 1;
736 744
737 for (y = 0, rn = 0; 745 for (y = 0, rn = 0;
738 y < yb && rn < nrows; 746 y < yb && rn < nrows;
@@ -753,17 +761,17 @@ update_window_fringes (w, force_p)
753 row->indicate_bob_p = row->indicate_top_line_p = 0; 761 row->indicate_bob_p = row->indicate_top_line_p = 0;
754 row->indicate_eob_p = row->indicate_bottom_line_p = 0; 762 row->indicate_eob_p = row->indicate_bottom_line_p = 0;
755 763
756 if (!NILP (ind) 764 if (!NILP (boundary_top)
757 && MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (w->buffer))) 765 && MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (w->buffer)))
758 row->indicate_bob_p = do_bob, do_bob = 0; 766 row->indicate_bob_p = do_bob, do_bob = 0;
759 else if (!NILP (arrows) 767 else if (!NILP (arrow_top)
760 && (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0) == rn) 768 && (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0) == rn)
761 row->indicate_top_line_p = 1; 769 row->indicate_top_line_p = 1;
762 770
763 if (!NILP (ind) 771 if (!NILP (boundary_bot)
764 && MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (w->buffer))) 772 && MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (w->buffer)))
765 row->indicate_eob_p = do_eob, do_eob = 0; 773 row->indicate_eob_p = do_eob, do_eob = 0;
766 else if (!NILP (arrows) 774 else if (!NILP (arrow_bot)
767 && y + row->height >= yb) 775 && y + row->height >= yb)
768 row->indicate_bottom_line_p = 1; 776 row->indicate_bottom_line_p = 1;
769 777
@@ -775,10 +783,9 @@ update_window_fringes (w, force_p)
775 } 783 }
776 } 784 }
777 785
778 if (EQ (XBUFFER (w->buffer)->indicate_empty_lines, Qright)) 786 empty_pos = XBUFFER (w->buffer)->indicate_empty_lines;
779 empty_pos = 1; 787 if (!NILP (empty_pos) && !EQ (empty_pos, Qright))
780 else if (EQ (XBUFFER (w->buffer)->indicate_empty_lines, Qleft)) 788 empty_pos = WINDOW_LEFT_FRINGE_WIDTH (w) == 0 ? Qright : Qleft;
781 empty_pos = -1;
782 789
783 for (y = 0, rn = 0; 790 for (y = 0, rn = 0;
784 y < yb && rn < nrows; 791 y < yb && rn < nrows;
@@ -802,20 +809,20 @@ update_window_fringes (w, force_p)
802 left = row->left_user_fringe_bitmap; 809 left = row->left_user_fringe_bitmap;
803 left_face_id = row->left_user_fringe_face_id; 810 left_face_id = row->left_user_fringe_face_id;
804 } 811 }
805 else if (row->indicate_bob_p && boundary_pos <= 0) 812 else if (row->indicate_bob_p && EQ (boundary_top, Qleft))
806 left = ((row->indicate_eob_p && boundary_pos < 0) 813 left = ((row->indicate_eob_p && EQ (boundary_bot, Qleft))
807 ? LEFT_BRACKET_BITMAP : TOP_LEFT_ANGLE_BITMAP); 814 ? LEFT_BRACKET_BITMAP : TOP_LEFT_ANGLE_BITMAP);
808 else if (row->indicate_eob_p && boundary_pos < 0) 815 else if (row->indicate_eob_p && EQ (boundary_bot, Qleft))
809 left = BOTTOM_LEFT_ANGLE_BITMAP; 816 left = BOTTOM_LEFT_ANGLE_BITMAP;
810 else if (row->truncated_on_left_p) 817 else if (row->truncated_on_left_p)
811 left = LEFT_TRUNCATION_BITMAP; 818 left = LEFT_TRUNCATION_BITMAP;
812 else if (MATRIX_ROW_CONTINUATION_LINE_P (row)) 819 else if (MATRIX_ROW_CONTINUATION_LINE_P (row))
813 left = CONTINUATION_LINE_BITMAP; 820 left = CONTINUATION_LINE_BITMAP;
814 else if (row->indicate_empty_line_p && empty_pos <= 0) 821 else if (row->indicate_empty_line_p && EQ (empty_pos, Qleft))
815 left = ZV_LINE_BITMAP; 822 left = ZV_LINE_BITMAP;
816 else if (row->indicate_top_line_p && arrow_pos <= 0) 823 else if (row->indicate_top_line_p && EQ (arrow_top, Qleft))
817 left = UP_ARROW_BITMAP; 824 left = UP_ARROW_BITMAP;
818 else if (row->indicate_bottom_line_p && arrow_pos < 0) 825 else if (row->indicate_bottom_line_p && EQ (arrow_bot, Qleft))
819 left = DOWN_ARROW_BITMAP; 826 left = DOWN_ARROW_BITMAP;
820 else 827 else
821 left = NO_FRINGE_BITMAP; 828 left = NO_FRINGE_BITMAP;
@@ -828,22 +835,20 @@ update_window_fringes (w, force_p)
828 right = row->right_user_fringe_bitmap; 835 right = row->right_user_fringe_bitmap;
829 right_face_id = row->right_user_fringe_face_id; 836 right_face_id = row->right_user_fringe_face_id;
830 } 837 }
831 else if (row->indicate_bob_p && boundary_pos > 0) 838 else if (row->indicate_bob_p && EQ (boundary_top, Qright))
832 right = ((row->indicate_eob_p && boundary_pos >= 0) 839 right = ((row->indicate_eob_p && EQ (boundary_bot, Qright))
833 ? RIGHT_BRACKET_BITMAP : TOP_RIGHT_ANGLE_BITMAP); 840 ? RIGHT_BRACKET_BITMAP : TOP_RIGHT_ANGLE_BITMAP);
834 else if (row->indicate_eob_p && boundary_pos >= 0) 841 else if (row->indicate_eob_p && EQ (boundary_bot, Qright))
835 right = BOTTOM_RIGHT_ANGLE_BITMAP; 842 right = BOTTOM_RIGHT_ANGLE_BITMAP;
836 else if (row->truncated_on_right_p) 843 else if (row->truncated_on_right_p)
837 right = RIGHT_TRUNCATION_BITMAP; 844 right = RIGHT_TRUNCATION_BITMAP;
838 else if (row->continued_p) 845 else if (row->continued_p)
839 right = CONTINUED_LINE_BITMAP; 846 right = CONTINUED_LINE_BITMAP;
840 else if (row->indicate_top_line_p && arrow_pos > 0) 847 else if (row->indicate_top_line_p && EQ (arrow_top, Qright))
841 right = UP_ARROW_BITMAP; 848 right = UP_ARROW_BITMAP;
842 else if (row->indicate_bottom_line_p && arrow_pos >= 0) 849 else if (row->indicate_bottom_line_p && EQ (arrow_bot, Qright))
843 right = DOWN_ARROW_BITMAP; 850 right = DOWN_ARROW_BITMAP;
844 else if (row->indicate_empty_line_p 851 else if (row->indicate_empty_line_p && EQ (empty_pos, Qright))
845 && (empty_pos > 0
846 || (WINDOW_LEFT_FRINGE_WIDTH (w) == 0 && empty_pos == 0)))
847 right = ZV_LINE_BITMAP; 852 right = ZV_LINE_BITMAP;
848 else 853 else
849 right = NO_FRINGE_BITMAP; 854 right = NO_FRINGE_BITMAP;
@@ -1247,7 +1252,8 @@ DEFUN ("fringe-bitmaps-at-pos", Ffringe_bitmaps_at_pos, Sfringe_bitmaps_at_pos,
1247If WINDOW is nil, use selected window. If POS is nil, use value of point 1252If WINDOW is nil, use selected window. If POS is nil, use value of point
1248in that window. Return value is a cons (LEFT . RIGHT) where LEFT and RIGHT 1253in that window. Return value is a cons (LEFT . RIGHT) where LEFT and RIGHT
1249are the fringe bitmap numbers for the bitmaps in the left and right fringe, 1254are the fringe bitmap numbers for the bitmaps in the left and right fringe,
1250resp. Return nil if POS is not visible in WINDOW. */) 1255resp. If left or right fringe is empty, the corresponding element is nil.
1256Return nil if POS is not visible in WINDOW. */)
1251 (pos, window) 1257 (pos, window)
1252 Lisp_Object pos, window; 1258 Lisp_Object pos, window;
1253{ 1259{
@@ -1274,8 +1280,10 @@ resp. Return nil if POS is not visible in WINDOW. */)
1274 row = MATRIX_FIRST_TEXT_ROW (w->current_matrix); 1280 row = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
1275 row = row_containing_pos (w, textpos, row, NULL, 0); 1281 row = row_containing_pos (w, textpos, row, NULL, 0);
1276 if (row) 1282 if (row)
1277 return Fcons (make_number (row->left_fringe_bitmap), 1283 return Fcons ((row->left_fringe_bitmap == NO_FRINGE_BITMAP
1278 make_number (row->right_fringe_bitmap)); 1284 ? Qnil : make_number (row->left_fringe_bitmap)),
1285 (row->right_fringe_bitmap == NO_FRINGE_BITMAP
1286 ? Qnil : make_number (row->right_fringe_bitmap)));
1279 else 1287 else
1280 return Qnil; 1288 return Qnil;
1281} 1289}