aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim F. Storm2004-02-08 23:20:52 +0000
committerKim F. Storm2004-02-08 23:20:52 +0000
commit6d9257263ebfa2dc2d39809584a4e67f5f8b4662 (patch)
tree3162e7c4a8d635cd1da022059f9049e075299dbb
parent4fa0780f7039b2cceafe69867df2a9f36fc824f8 (diff)
downloademacs-6d9257263ebfa2dc2d39809584a4e67f5f8b4662.tar.gz
emacs-6d9257263ebfa2dc2d39809584a4e67f5f8b4662.zip
(Voverflow_newline_into_fringe, syms_of_xdisp)
(left_bits, right_bits, up_arrow_bits, down_arrow_bits) (continued_bits, continuation_bits, ov_bits, first_line_bits) (last_line_bits, filled_box_cursor_bits, hollow_box_cursor_bits) (bar_cursor_bits, hbar_cursor_bits, zv_bits, hollow_square_bits) (fringe_bitmaps, draw_fringe_bitmap, draw_row_fringe_bitmaps) (draw_window_fringes, compute_fringe_widths, update_window_fringes): Move fringe handling vars and code to new file fringe.c. (handle_display_prop): Handle left-fringe and right-fringe display properties; store user fringe bitmaps in iterator. (move_it_in_display_line_to): Handle cursor in fringe at eob. (clear_garbaged_frames): Set force_flush_display_p if resized. (redisplay_window): Redraw fringe bitmaps if not just_this_one_p. (display_line): Handle cursor in fringe at eob. (display_line): Set row user fringe bitmaps from iterator.
-rw-r--r--src/xdisp.c779
1 files changed, 93 insertions, 686 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 5186a8641c3..de62a646984 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -311,10 +311,7 @@ extern Lisp_Object Qscroll_bar;
311Lisp_Object Vshow_trailing_whitespace; 311Lisp_Object Vshow_trailing_whitespace;
312 312
313#ifdef HAVE_WINDOW_SYSTEM 313#ifdef HAVE_WINDOW_SYSTEM
314/* Non-nil means that newline may flow into the right fringe. */ 314extern Lisp_Object Voverflow_newline_into_fringe;
315
316Lisp_Object Voverflow_newline_into_fringe;
317#endif /* HAVE_WINDOW_SYSTEM */
318 315
319/* Test if overflow newline into fringe. Called with iterator IT 316/* Test if overflow newline into fringe. Called with iterator IT
320 at or past right window margin, and with IT->current_x set. */ 317 at or past right window margin, and with IT->current_x set. */
@@ -325,6 +322,8 @@ Lisp_Object Voverflow_newline_into_fringe;
325 && WINDOW_RIGHT_FRINGE_WIDTH (it->w) > 0 \ 322 && WINDOW_RIGHT_FRINGE_WIDTH (it->w) > 0 \
326 && it->current_x == it->last_visible_x) 323 && it->current_x == it->last_visible_x)
327 324
325#endif /* HAVE_WINDOW_SYSTEM */
326
328/* Non-nil means show the text cursor in void text areas 327/* Non-nil means show the text cursor in void text areas
329 i.e. in blank areas after eol and eob. This used to be 328 i.e. in blank areas after eol and eob. This used to be
330 the default in 21.3. */ 329 the default in 21.3. */
@@ -3279,6 +3278,8 @@ handle_display_prop (it)
3279 && !EQ (XCAR (prop), Qraise) 3278 && !EQ (XCAR (prop), Qraise)
3280 /* Marginal area specifications. */ 3279 /* Marginal area specifications. */
3281 && !(CONSP (XCAR (prop)) && EQ (XCAR (XCAR (prop)), Qmargin)) 3280 && !(CONSP (XCAR (prop)) && EQ (XCAR (XCAR (prop)), Qmargin))
3281 && !EQ (XCAR (prop), Qleft_fringe)
3282 && !EQ (XCAR (prop), Qright_fringe)
3282 && !NILP (XCAR (prop))) 3283 && !NILP (XCAR (prop)))
3283 { 3284 {
3284 for (; CONSP (prop); prop = XCDR (prop)) 3285 for (; CONSP (prop); prop = XCDR (prop))
@@ -3485,6 +3486,43 @@ handle_single_display_prop (it, prop, object, position,
3485 } 3486 }
3486#endif /* HAVE_WINDOW_SYSTEM */ 3487#endif /* HAVE_WINDOW_SYSTEM */
3487 } 3488 }
3489 else if (CONSP (prop)
3490 && (EQ (XCAR (prop), Qleft_fringe)
3491 || EQ (XCAR (prop), Qright_fringe))
3492 && CONSP (XCDR (prop)))
3493 {
3494 unsigned face_id = DEFAULT_FACE_ID;
3495
3496 /* `(left-fringe BITMAP FACE)'. */
3497 if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f))
3498 return 0;
3499
3500#ifdef HAVE_WINDOW_SYSTEM
3501 value = XCAR (XCDR (prop));
3502 if (!NUMBERP (value)
3503 || !valid_fringe_bitmap_id_p (XINT (value)))
3504 return 0;
3505
3506 if (CONSP (XCDR (XCDR (prop))))
3507 {
3508 Lisp_Object face_name = XCAR (XCDR (XCDR (prop)));
3509 face_id = lookup_named_face (it->f, face_name, 'A');
3510 if (face_id < 0)
3511 return 0;
3512 }
3513
3514 if (EQ (XCAR (prop), Qleft_fringe))
3515 {
3516 it->left_user_fringe_bitmap = value;
3517 it->left_user_fringe_face_id = face_id;
3518 }
3519 else
3520 {
3521 it->right_user_fringe_bitmap = value;
3522 it->right_user_fringe_face_id = face_id;
3523 }
3524#endif /* HAVE_WINDOW_SYSTEM */
3525 }
3488 else if (!it->string_from_display_prop_p) 3526 else if (!it->string_from_display_prop_p)
3489 { 3527 {
3490 /* `((margin left-margin) VALUE)' or `((margin right-margin) 3528 /* `((margin left-margin) VALUE)' or `((margin right-margin)
@@ -5614,7 +5652,11 @@ move_it_in_display_line_to (it, to_charpos, to_x, op)
5614#ifdef HAVE_WINDOW_SYSTEM 5652#ifdef HAVE_WINDOW_SYSTEM
5615 if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) 5653 if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
5616 { 5654 {
5617 get_next_display_element (it); 5655 if (!get_next_display_element (it))
5656 {
5657 result = MOVE_POS_MATCH_OR_ZV;
5658 break;
5659 }
5618 if (ITERATOR_AT_END_OF_LINE_P (it)) 5660 if (ITERATOR_AT_END_OF_LINE_P (it))
5619 { 5661 {
5620 result = MOVE_NEWLINE_OR_CR; 5662 result = MOVE_NEWLINE_OR_CR;
@@ -5682,7 +5724,11 @@ move_it_in_display_line_to (it, to_charpos, to_x, op)
5682#ifdef HAVE_WINDOW_SYSTEM 5724#ifdef HAVE_WINDOW_SYSTEM
5683 if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) 5725 if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
5684 { 5726 {
5685 get_next_display_element (it); 5727 if (!get_next_display_element (it))
5728 {
5729 result = MOVE_POS_MATCH_OR_ZV;
5730 break;
5731 }
5686 if (ITERATOR_AT_END_OF_LINE_P (it)) 5732 if (ITERATOR_AT_END_OF_LINE_P (it))
5687 { 5733 {
5688 result = MOVE_NEWLINE_OR_CR; 5734 result = MOVE_NEWLINE_OR_CR;
@@ -7618,7 +7664,10 @@ clear_garbaged_frames ()
7618 if (FRAME_VISIBLE_P (f) && FRAME_GARBAGED_P (f)) 7664 if (FRAME_VISIBLE_P (f) && FRAME_GARBAGED_P (f))
7619 { 7665 {
7620 if (f->resized_p) 7666 if (f->resized_p)
7621 Fredraw_frame (frame); 7667 {
7668 Fredraw_frame (frame);
7669 f->force_flush_display_p = 1;
7670 }
7622 clear_current_matrices (f); 7671 clear_current_matrices (f);
7623 changed_count++; 7672 changed_count++;
7624 f->garbaged = 0; 7673 f->garbaged = 0;
@@ -8932,536 +8981,6 @@ note_tool_bar_highlight (f, x, y)
8932 8981
8933 8982
8934 8983
8935/***********************************************************************
8936 Fringes
8937 ***********************************************************************/
8938
8939#ifdef HAVE_WINDOW_SYSTEM
8940
8941/* Notice that all bitmaps bits are "mirrored". */
8942
8943/* An arrow like this: `<-'. */
8944/*
8945 ...xx...
8946 ....xx..
8947 .....xx.
8948 ..xxxxxx
8949 ..xxxxxx
8950 .....xx.
8951 ....xx..
8952 ...xx...
8953*/
8954static unsigned char left_bits[] = {
8955 0x18, 0x0c, 0x06, 0x3f, 0x3f, 0x06, 0x0c, 0x18};
8956
8957
8958/* Right truncation arrow bitmap `->'. */
8959/*
8960 ...xx...
8961 ..xx....
8962 .xx.....
8963 xxxxxx..
8964 xxxxxx..
8965 .xx.....
8966 ..xx....
8967 ...xx...
8968*/
8969static unsigned char right_bits[] = {
8970 0x18, 0x30, 0x60, 0xfc, 0xfc, 0x60, 0x30, 0x18};
8971
8972
8973/* Up arrow bitmap. */
8974/*
8975 ...xx...
8976 ..xxxx..
8977 .xxxxxx.
8978 xxxxxxxx
8979 ...xx...
8980 ...xx...
8981 ...xx...
8982 ...xx...
8983*/
8984static unsigned char up_arrow_bits[] = {
8985 0x18, 0x3c, 0x7e, 0xff, 0x18, 0x18, 0x18, 0x18};
8986
8987
8988/* Down arrow bitmap. */
8989/*
8990 ...xx...
8991 ...xx...
8992 ...xx...
8993 ...xx...
8994 xxxxxxxx
8995 .xxxxxx.
8996 ..xxxx..
8997 ...xx...
8998*/
8999static unsigned char down_arrow_bits[] = {
9000 0x18, 0x18, 0x18, 0x18, 0xff, 0x7e, 0x3c, 0x18};
9001
9002/* Marker for continued lines. */
9003/*
9004 ..xxxx..
9005 .xxxxx..
9006 xx......
9007 xxx..x..
9008 xxxxxx..
9009 .xxxxx..
9010 ..xxxx..
9011 .xxxxx..
9012*/
9013static unsigned char continued_bits[] = {
9014 0x3c, 0x7c, 0xc0, 0xe4, 0xfc, 0x7c, 0x3c, 0x7c};
9015
9016/* Marker for continuation lines. */
9017/*
9018 ..xxxx..
9019 ..xxxxx.
9020 ......xx
9021 ..x..xxx
9022 ..xxxxxx
9023 ..xxxxx.
9024 ..xxxx..
9025 ..xxxxx.
9026*/
9027static unsigned char continuation_bits[] = {
9028 0x3c, 0x3e, 0x03, 0x27, 0x3f, 0x3e, 0x3c, 0x3e};
9029
9030/* Overlay arrow bitmap. A triangular arrow. */
9031/*
9032 ......xx
9033 ....xxxx
9034 ...xxxxx
9035 ..xxxxxx
9036 ..xxxxxx
9037 ...xxxxx
9038 ....xxxx
9039 ......xx
9040*/
9041static unsigned char ov_bits[] = {
9042 0x03, 0x0f, 0x1f, 0x3f, 0x3f, 0x1f, 0x0f, 0x03};
9043
9044
9045/* First line bitmap. An left-up angle. */
9046/*
9047 ..xxxxxx
9048 ..xxxxxx
9049 ......xx
9050 ......xx
9051 ......xx
9052 ......xx
9053 ......xx
9054 ........
9055*/
9056static unsigned char first_line_bits[] = {
9057 0x3f, 0x3f, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00};
9058
9059
9060/* Last line bitmap. An left-down angle. */
9061/*
9062 ........
9063 xx......
9064 xx......
9065 xx......
9066 xx......
9067 xx......
9068 xxxxxx..
9069 xxxxxx..
9070*/
9071static unsigned char last_line_bits[] = {
9072 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0xfc};
9073
9074/* Filled box cursor bitmap. A filled box; max 13 pixels high. */
9075/*
9076 .xxxxxxx
9077 .xxxxxxx
9078 .xxxxxxx
9079 .xxxxxxx
9080 .xxxxxxx
9081 .xxxxxxx
9082 .xxxxxxx
9083 .xxxxxxx
9084 .xxxxxxx
9085 .xxxxxxx
9086 .xxxxxxx
9087 .xxxxxxx
9088 .xxxxxxx
9089*/
9090static unsigned char filled_box_cursor_bits[] = {
9091 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f};
9092
9093/* Hollow box cursor bitmap. A hollow box; max 13 pixels high. */
9094/*
9095 .xxxxxxx
9096 .x.....x
9097 .x.....x
9098 .x.....x
9099 .x.....x
9100 .x.....x
9101 .x.....x
9102 .x.....x
9103 .x.....x
9104 .x.....x
9105 .x.....x
9106 .x.....x
9107 .xxxxxxx
9108*/
9109static unsigned char hollow_box_cursor_bits[] = {
9110 0x7f, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x7f};
9111
9112/* Bar cursor bitmap. A vertical bar; max 13 pixels high. */
9113/*
9114 ......xx
9115 ......xx
9116 ......xx
9117 ......xx
9118 ......xx
9119 ......xx
9120 ......xx
9121 ......xx
9122 ......xx
9123 ......xx
9124 ......xx
9125 ......xx
9126 ......xx
9127*/
9128static unsigned char bar_cursor_bits[] = {
9129 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03};
9130
9131/* HBar cursor bitmap. A horisontal bar; 2 pixels high. */
9132/*
9133 .xxxxxxx
9134 .xxxxxxx
9135*/
9136static unsigned char hbar_cursor_bits[] = {
9137 0x7f, 0x7f};
9138
9139
9140/* Bitmap drawn to indicate lines not displaying text if
9141 `indicate-empty-lines' is non-nil. */
9142static unsigned char zv_bits[] = {
9143 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
9144 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
9145 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
9146 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
9147 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
9148 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
9149 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00,
9150 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00};
9151
9152/* Hollow square bitmap. */
9153/*
9154 .xxxxxx.
9155 .x....x.
9156 .x....x.
9157 .x....x.
9158 .x....x.
9159 .xxxxxx.
9160*/
9161static unsigned char hollow_square_bits[] = {
9162 0x7e, 0x42, 0x42, 0x42, 0x42, 0x7e};
9163
9164
9165struct fringe_bitmap fringe_bitmaps[MAX_FRINGE_BITMAPS] =
9166{
9167 { 0, 0, 0, NULL /* NO_FRINGE_BITMAP */ },
9168 { 8, sizeof (left_bits), 0, left_bits },
9169 { 8, sizeof (right_bits), 0, right_bits },
9170 { 8, sizeof (up_arrow_bits), -1, up_arrow_bits },
9171 { 8, sizeof (down_arrow_bits), -2, down_arrow_bits },
9172 { 8, sizeof (continued_bits), 0, continued_bits },
9173 { 8, sizeof (continuation_bits), 0, continuation_bits },
9174 { 8, sizeof (ov_bits), 0, ov_bits },
9175 { 8, sizeof (first_line_bits), -1, first_line_bits },
9176 { 8, sizeof (last_line_bits), -2, last_line_bits },
9177 { 8, sizeof (filled_box_cursor_bits), 0, filled_box_cursor_bits },
9178 { 8, sizeof (hollow_box_cursor_bits), 0, hollow_box_cursor_bits },
9179 { 8, sizeof (bar_cursor_bits), 0, bar_cursor_bits },
9180 { 8, sizeof (hbar_cursor_bits), -2, hbar_cursor_bits },
9181 { 8, sizeof (zv_bits), 3, zv_bits },
9182 { 8, sizeof (hollow_square_bits), 0, hollow_square_bits },
9183};
9184
9185
9186/* Draw the bitmap WHICH in one of the left or right fringes of
9187 window W. ROW is the glyph row for which to display the bitmap; it
9188 determines the vertical position at which the bitmap has to be
9189 drawn.
9190 LEFT_P is 1 for left fringe, 0 for right fringe.
9191*/
9192
9193void
9194draw_fringe_bitmap (w, row, left_p)
9195 struct window *w;
9196 struct glyph_row *row;
9197 int left_p;
9198{
9199 struct frame *f = XFRAME (WINDOW_FRAME (w));
9200 struct draw_fringe_bitmap_params p;
9201 enum fringe_bitmap_type which;
9202 int period;
9203
9204 if (left_p)
9205 which = row->left_fringe_bitmap;
9206 else if (!row->cursor_in_fringe_p)
9207 which = row->right_fringe_bitmap;
9208 else
9209 switch (w->phys_cursor_type)
9210 {
9211 case HOLLOW_BOX_CURSOR:
9212 if (row->visible_height >= sizeof(hollow_box_cursor_bits))
9213 which = HOLLOW_BOX_CURSOR_BITMAP;
9214 else
9215 which = HOLLOW_SQUARE_BITMAP;
9216 break;
9217 case FILLED_BOX_CURSOR:
9218 which = FILLED_BOX_CURSOR_BITMAP;
9219 break;
9220 case BAR_CURSOR:
9221 which = BAR_CURSOR_BITMAP;
9222 break;
9223 case HBAR_CURSOR:
9224 which = HBAR_CURSOR_BITMAP;
9225 break;
9226 case NO_CURSOR:
9227 default:
9228 w->phys_cursor_on_p = 0;
9229 row->cursor_in_fringe_p = 0;
9230 which = row->right_fringe_bitmap;
9231 break;
9232 }
9233
9234 period = fringe_bitmaps[which].period;
9235
9236 /* Convert row to frame coordinates. */
9237 p.y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y);
9238
9239 p.which = which;
9240 p.wd = fringe_bitmaps[which].width;
9241
9242 p.h = fringe_bitmaps[which].height;
9243 p.dh = (period > 0 ? (p.y % period) : 0);
9244 p.h -= p.dh;
9245 /* Clip bitmap if too high. */
9246 if (p.h > row->height)
9247 p.h = row->height;
9248
9249 p.face = FACE_FROM_ID (f, FRINGE_FACE_ID);
9250 PREPARE_FACE_FOR_DISPLAY (f, p.face);
9251
9252 /* Clear left fringe if no bitmap to draw or if bitmap doesn't fill
9253 the fringe. */
9254 p.bx = -1;
9255 if (left_p)
9256 {
9257 int wd = WINDOW_LEFT_FRINGE_WIDTH (w);
9258 int x = window_box_left (w, (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
9259 ? LEFT_MARGIN_AREA
9260 : TEXT_AREA));
9261 if (p.wd > wd)
9262 p.wd = wd;
9263 p.x = x - p.wd - (wd - p.wd) / 2;
9264
9265 if (p.wd < wd || row->height > p.h)
9266 {
9267 /* If W has a vertical border to its left, don't draw over it. */
9268 wd -= ((!WINDOW_LEFTMOST_P (w)
9269 && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w))
9270 ? 1 : 0);
9271 p.bx = x - wd;
9272 p.nx = wd;
9273 }
9274 }
9275 else
9276 {
9277 int x = window_box_right (w,
9278 (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
9279 ? RIGHT_MARGIN_AREA
9280 : TEXT_AREA));
9281 int wd = WINDOW_RIGHT_FRINGE_WIDTH (w);
9282 if (p.wd > wd)
9283 p.wd = wd;
9284 p.x = x + (wd - p.wd) / 2;
9285 /* Clear right fringe if no bitmap to draw of if bitmap doesn't fill
9286 the fringe. */
9287 if (p.wd < wd || row->height > p.h)
9288 {
9289 p.bx = x;
9290 p.nx = wd;
9291 }
9292 }
9293
9294 if (p.bx >= 0)
9295 {
9296 int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w);
9297
9298 p.by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, row->y));
9299 p.ny = row->visible_height;
9300 }
9301
9302 /* Adjust y to the offset in the row to start drawing the bitmap. */
9303 if (period == 0)
9304 p.y += (row->height - p.h) / 2;
9305 else if (period == -2)
9306 {
9307 p.h = fringe_bitmaps[which].height;
9308 p.y += (row->visible_height - p.h);
9309 }
9310
9311 rif->draw_fringe_bitmap (w, row, &p);
9312}
9313
9314/* Draw fringe bitmaps for glyph row ROW on window W. Call this
9315 function with input blocked. */
9316
9317void
9318draw_row_fringe_bitmaps (w, row)
9319 struct window *w;
9320 struct glyph_row *row;
9321{
9322 xassert (interrupt_input_blocked);
9323
9324 /* If row is completely invisible, because of vscrolling, we
9325 don't have to draw anything. */
9326 if (row->visible_height <= 0)
9327 return;
9328
9329 if (WINDOW_LEFT_FRINGE_WIDTH (w) != 0)
9330 draw_fringe_bitmap (w, row, 1);
9331
9332 if (WINDOW_RIGHT_FRINGE_WIDTH (w) != 0)
9333 draw_fringe_bitmap (w, row, 0);
9334}
9335
9336/* Draw the fringes of window W. Only fringes for rows marked for
9337 update in redraw_fringe_bitmaps_p are drawn. */
9338
9339void
9340draw_window_fringes (w)
9341 struct window *w;
9342{
9343 struct glyph_row *row;
9344 int yb = window_text_bottom_y (w);
9345 int nrows = w->current_matrix->nrows;
9346 int y = 0, rn;
9347
9348 if (w->pseudo_window_p)
9349 return;
9350
9351 for (y = 0, rn = 0, row = w->current_matrix->rows;
9352 y < yb && rn < nrows;
9353 y += row->height, ++row, ++rn)
9354 {
9355 if (!row->redraw_fringe_bitmaps_p)
9356 continue;
9357 draw_row_fringe_bitmaps (w, row);
9358 row->redraw_fringe_bitmaps_p = 0;
9359 }
9360}
9361
9362
9363/* Compute actual fringe widths for frame F.
9364
9365 If REDRAW is 1, redraw F if the fringe settings was actually
9366 modified and F is visible.
9367
9368 Since the combined left and right fringe must occupy an integral
9369 number of columns, we may need to add some pixels to each fringe.
9370 Typically, we add an equal amount (+/- 1 pixel) to each fringe,
9371 but a negative width value is taken literally (after negating it).
9372
9373 We never make the fringes narrower than specified. It is planned
9374 to make fringe bitmaps customizable and expandable, and at that
9375 time, the user will typically specify the minimum number of pixels
9376 needed for his bitmaps, so we shouldn't select anything less than
9377 what is specified.
9378*/
9379
9380void
9381compute_fringe_widths (f, redraw)
9382 struct frame *f;
9383 int redraw;
9384{
9385 int o_left = FRAME_LEFT_FRINGE_WIDTH (f);
9386 int o_right = FRAME_RIGHT_FRINGE_WIDTH (f);
9387 int o_cols = FRAME_FRINGE_COLS (f);
9388
9389 Lisp_Object left_fringe = Fassq (Qleft_fringe, f->param_alist);
9390 Lisp_Object right_fringe = Fassq (Qright_fringe, f->param_alist);
9391 int left_fringe_width, right_fringe_width;
9392
9393 if (!NILP (left_fringe))
9394 left_fringe = Fcdr (left_fringe);
9395 if (!NILP (right_fringe))
9396 right_fringe = Fcdr (right_fringe);
9397
9398 left_fringe_width = ((NILP (left_fringe) || !INTEGERP (left_fringe)) ? 8 :
9399 XINT (left_fringe));
9400 right_fringe_width = ((NILP (right_fringe) || !INTEGERP (right_fringe)) ? 8 :
9401 XINT (right_fringe));
9402
9403 if (left_fringe_width || right_fringe_width)
9404 {
9405 int left_wid = left_fringe_width >= 0 ? left_fringe_width : -left_fringe_width;
9406 int right_wid = right_fringe_width >= 0 ? right_fringe_width : -right_fringe_width;
9407 int conf_wid = left_wid + right_wid;
9408 int font_wid = FRAME_COLUMN_WIDTH (f);
9409 int cols = (left_wid + right_wid + font_wid-1) / font_wid;
9410 int real_wid = cols * font_wid;
9411 if (left_wid && right_wid)
9412 {
9413 if (left_fringe_width < 0)
9414 {
9415 /* Left fringe width is fixed, adjust right fringe if necessary */
9416 FRAME_LEFT_FRINGE_WIDTH (f) = left_wid;
9417 FRAME_RIGHT_FRINGE_WIDTH (f) = real_wid - left_wid;
9418 }
9419 else if (right_fringe_width < 0)
9420 {
9421 /* Right fringe width is fixed, adjust left fringe if necessary */
9422 FRAME_LEFT_FRINGE_WIDTH (f) = real_wid - right_wid;
9423 FRAME_RIGHT_FRINGE_WIDTH (f) = right_wid;
9424 }
9425 else
9426 {
9427 /* Adjust both fringes with an equal amount.
9428 Note that we are doing integer arithmetic here, so don't
9429 lose a pixel if the total width is an odd number. */
9430 int fill = real_wid - conf_wid;
9431 FRAME_LEFT_FRINGE_WIDTH (f) = left_wid + fill/2;
9432 FRAME_RIGHT_FRINGE_WIDTH (f) = right_wid + fill - fill/2;
9433 }
9434 }
9435 else if (left_fringe_width)
9436 {
9437 FRAME_LEFT_FRINGE_WIDTH (f) = real_wid;
9438 FRAME_RIGHT_FRINGE_WIDTH (f) = 0;
9439 }
9440 else
9441 {
9442 FRAME_LEFT_FRINGE_WIDTH (f) = 0;
9443 FRAME_RIGHT_FRINGE_WIDTH (f) = real_wid;
9444 }
9445 FRAME_FRINGE_COLS (f) = cols;
9446 }
9447 else
9448 {
9449 FRAME_LEFT_FRINGE_WIDTH (f) = 0;
9450 FRAME_RIGHT_FRINGE_WIDTH (f) = 0;
9451 FRAME_FRINGE_COLS (f) = 0;
9452 }
9453
9454 if (redraw && FRAME_VISIBLE_P (f))
9455 if (o_left != FRAME_LEFT_FRINGE_WIDTH (f) ||
9456 o_right != FRAME_RIGHT_FRINGE_WIDTH (f) ||
9457 o_cols != FRAME_FRINGE_COLS (f))
9458 redraw_frame (f);
9459}
9460
9461#endif /* HAVE_WINDOW_SYSTEM */
9462
9463
9464
9465/************************************************************************ 8984/************************************************************************
9466 Horizontal scrolling 8985 Horizontal scrolling
9467 ************************************************************************/ 8986 ************************************************************************/
@@ -11679,136 +11198,6 @@ set_vertical_scroll_bar (w)
11679 set_vertical_scroll_bar_hook (w, end - start, whole, start); 11198 set_vertical_scroll_bar_hook (w, end - start, whole, start);
11680} 11199}
11681 11200
11682#ifdef HAVE_WINDOW_SYSTEM
11683
11684/* Recalculate the bitmaps to show in the fringes of window W.
11685 If FORCE_P is 0, only mark rows with modified bitmaps for update in
11686 redraw_fringe_bitmaps_p; else mark all rows for update. */
11687
11688int
11689update_window_fringes (w, force_p)
11690 struct window *w;
11691 int force_p;
11692{
11693 struct glyph_row *row, *cur = 0;
11694 int yb = window_text_bottom_y (w);
11695 int rn, nrows = w->current_matrix->nrows;
11696 int y;
11697 int redraw_p = 0;
11698 Lisp_Object ind;
11699
11700 if (w->pseudo_window_p)
11701 return 0;
11702
11703 if (!MINI_WINDOW_P (w)
11704 && (ind = XBUFFER (w->buffer)->indicate_buffer_boundaries, !NILP (ind)))
11705 {
11706 int do_eob = 1, do_bob = 1;
11707
11708 for (y = 0, rn = 0;
11709 y < yb && rn < nrows;
11710 y += row->height, ++rn)
11711 {
11712 unsigned indicate_bob_p, indicate_top_line_p;
11713 unsigned indicate_eob_p, indicate_bottom_line_p;
11714
11715 row = w->desired_matrix->rows + rn;
11716 if (!row->enabled_p)
11717 row = w->current_matrix->rows + rn;
11718
11719 indicate_bob_p = row->indicate_bob_p;
11720 indicate_top_line_p = row->indicate_top_line_p;
11721 indicate_eob_p = row->indicate_eob_p;
11722 indicate_bottom_line_p = row->indicate_bottom_line_p;
11723
11724 row->indicate_bob_p = row->indicate_top_line_p = 0;
11725 row->indicate_eob_p = row->indicate_bottom_line_p = 0;
11726
11727 if (MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (w->buffer)))
11728 row->indicate_bob_p = do_bob, do_bob = 0;
11729 else if (EQ (ind, Qt)
11730 && (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0) == rn)
11731 row->indicate_top_line_p = 1;
11732
11733 if (MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (w->buffer)))
11734 row->indicate_eob_p = do_eob, do_eob = 0;
11735 else if (EQ (ind, Qt)
11736 && y + row->height >= yb)
11737 row->indicate_bottom_line_p = 1;
11738
11739 if (indicate_bob_p != row->indicate_bob_p
11740 || indicate_top_line_p != row->indicate_top_line_p
11741 || indicate_eob_p != row->indicate_eob_p
11742 || indicate_bottom_line_p != row->indicate_bottom_line_p)
11743 row->redraw_fringe_bitmaps_p = 1;
11744 }
11745 }
11746
11747 for (y = 0, rn = 0;
11748 y < yb && rn < nrows;
11749 y += row->height, rn++)
11750 {
11751 enum fringe_bitmap_type left, right;
11752
11753 row = w->desired_matrix->rows + rn;
11754 cur = w->current_matrix->rows + rn;
11755 if (!row->enabled_p)
11756 row = cur;
11757
11758 /* Decide which bitmap to draw in the left fringe. */
11759 if (WINDOW_LEFT_FRINGE_WIDTH (w) == 0)
11760 left = NO_FRINGE_BITMAP;
11761 else if (row->overlay_arrow_p)
11762 left = OVERLAY_ARROW_BITMAP;
11763 else if (row->truncated_on_left_p)
11764 left = LEFT_TRUNCATION_BITMAP;
11765 else if (MATRIX_ROW_CONTINUATION_LINE_P (row))
11766 left = CONTINUATION_LINE_BITMAP;
11767 else if (row->indicate_empty_line_p)
11768 left = ZV_LINE_BITMAP;
11769 else if (row->indicate_bob_p)
11770 left = FIRST_LINE_BITMAP;
11771 else
11772 left = NO_FRINGE_BITMAP;
11773
11774 /* Decide which bitmap to draw in the right fringe. */
11775 if (WINDOW_RIGHT_FRINGE_WIDTH (w) == 0)
11776 right = NO_FRINGE_BITMAP;
11777 else if (row->truncated_on_right_p)
11778 right = RIGHT_TRUNCATION_BITMAP;
11779 else if (row->continued_p)
11780 right = CONTINUED_LINE_BITMAP;
11781 else if (row->indicate_eob_p)
11782 right = LAST_LINE_BITMAP;
11783 else if (row->indicate_top_line_p)
11784 right = UP_ARROW_BITMAP;
11785 else if (row->indicate_bottom_line_p)
11786 right = DOWN_ARROW_BITMAP;
11787 else if (row->indicate_empty_line_p && WINDOW_LEFT_FRINGE_WIDTH (w) == 0)
11788 right = ZV_LINE_BITMAP;
11789 else
11790 right = NO_FRINGE_BITMAP;
11791
11792 if (force_p
11793 || row->y != cur->y
11794 || row->visible_height != cur->visible_height
11795 || left != cur->left_fringe_bitmap
11796 || right != cur->right_fringe_bitmap
11797 || cur->redraw_fringe_bitmaps_p)
11798 {
11799 redraw_p = row->redraw_fringe_bitmaps_p = cur->redraw_fringe_bitmaps_p = 1;
11800 cur->left_fringe_bitmap = left;
11801 cur->right_fringe_bitmap = right;
11802 }
11803
11804 row->left_fringe_bitmap = left;
11805 row->right_fringe_bitmap = right;
11806 }
11807
11808 return redraw_p;
11809}
11810
11811#endif /* HAVE_WINDOW_SYSTEM */
11812 11201
11813/* Redisplay leaf window WINDOW. JUST_THIS_ONE_P non-zero means only 11202/* Redisplay leaf window WINDOW. JUST_THIS_ONE_P non-zero means only
11814 selected_window is redisplayed. 11203 selected_window is redisplayed.
@@ -12499,6 +11888,7 @@ redisplay_window (window, just_this_one_p)
12499 11888
12500#ifdef HAVE_WINDOW_SYSTEM 11889#ifdef HAVE_WINDOW_SYSTEM
12501 if (update_window_fringes (w, 0) 11890 if (update_window_fringes (w, 0)
11891 && !just_this_one_p
12502 && (used_current_matrix_p || overlay_arrow_seen) 11892 && (used_current_matrix_p || overlay_arrow_seen)
12503 && !w->pseudo_window_p) 11893 && !w->pseudo_window_p)
12504 { 11894 {
@@ -14839,6 +14229,11 @@ display_line (it)
14839 display the cursor there under X. Set the charpos of the 14229 display the cursor there under X. Set the charpos of the
14840 first glyph of blank lines not corresponding to any text 14230 first glyph of blank lines not corresponding to any text
14841 to -1. */ 14231 to -1. */
14232#ifdef HAVE_WINDOW_SYSTEM
14233 if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
14234 row->exact_window_width_line_p = 1;
14235 else
14236#endif /* HAVE_WINDOW_SYSTEM */
14842 if ((append_space (it, 1) && row->used[TEXT_AREA] == 1) 14237 if ((append_space (it, 1) && row->used[TEXT_AREA] == 1)
14843 || row->used[TEXT_AREA] == 0) 14238 || row->used[TEXT_AREA] == 0)
14844 { 14239 {
@@ -14951,8 +14346,14 @@ display_line (it)
14951#ifdef HAVE_WINDOW_SYSTEM 14346#ifdef HAVE_WINDOW_SYSTEM
14952 if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) 14347 if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
14953 { 14348 {
14954 get_next_display_element (it); 14349 if (!get_next_display_element (it))
14955 if (ITERATOR_AT_END_OF_LINE_P (it)) 14350 {
14351 row->exact_window_width_line_p = 1;
14352 it->continuation_lines_width = 0;
14353 row->continued_p = 0;
14354 row->ends_at_zv_p = 1;
14355 }
14356 else if (ITERATOR_AT_END_OF_LINE_P (it))
14956 { 14357 {
14957 row->continued_p = 0; 14358 row->continued_p = 0;
14958 row->exact_window_width_line_p = 1; 14359 row->exact_window_width_line_p = 1;
@@ -15057,7 +14458,7 @@ display_line (it)
15057 it->max_phys_ascent + it->max_phys_descent); 14458 it->max_phys_ascent + it->max_phys_descent);
15058 14459
15059 /* End of this display line if row is continued. */ 14460 /* End of this display line if row is continued. */
15060 if (row->continued_p) 14461 if (row->continued_p || row->ends_at_zv_p)
15061 break; 14462 break;
15062 } 14463 }
15063 14464
@@ -15123,7 +14524,15 @@ display_line (it)
15123 /* Don't truncate if we can overflow newline into fringe. */ 14524 /* Don't truncate if we can overflow newline into fringe. */
15124 if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) 14525 if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
15125 { 14526 {
15126 get_next_display_element (it); 14527 if (!get_next_display_element (it))
14528 {
14529#ifdef HAVE_WINDOW_SYSTEM
14530 it->continuation_lines_width = 0;
14531 row->ends_at_zv_p = 1;
14532 row->exact_window_width_line_p = 1;
14533 break;
14534#endif /* HAVE_WINDOW_SYSTEM */
14535 }
15127 if (ITERATOR_AT_END_OF_LINE_P (it)) 14536 if (ITERATOR_AT_END_OF_LINE_P (it))
15128 { 14537 {
15129 row->exact_window_width_line_p = 1; 14538 row->exact_window_width_line_p = 1;
@@ -15200,6 +14609,17 @@ display_line (it)
15200 /* Remember the position at which this line ends. */ 14609 /* Remember the position at which this line ends. */
15201 row->end = it->current; 14610 row->end = it->current;
15202 14611
14612 /* Save fringe bitmaps in this row. */
14613 row->left_user_fringe_bitmap = it->left_user_fringe_bitmap;
14614 row->left_user_fringe_face_id = it->left_user_fringe_face_id;
14615 row->right_user_fringe_bitmap = it->right_user_fringe_bitmap;
14616 row->right_user_fringe_face_id = it->right_user_fringe_face_id;
14617
14618 it->left_user_fringe_bitmap = 0;
14619 it->left_user_fringe_face_id = 0;
14620 it->right_user_fringe_bitmap = 0;
14621 it->right_user_fringe_face_id = 0;
14622
15203 /* Maybe set the cursor. */ 14623 /* Maybe set the cursor. */
15204 if (it->w->cursor.vpos < 0 14624 if (it->w->cursor.vpos < 0
15205 && PT >= MATRIX_ROW_START_CHARPOS (row) 14625 && PT >= MATRIX_ROW_START_CHARPOS (row)
@@ -20599,10 +20019,8 @@ Returns the alist element for the first matching AREA in MAP. */)
20599 if (NILP (map)) 20019 if (NILP (map))
20600 return Qnil; 20020 return Qnil;
20601 20021
20602 if (!INTEGERP (x)) 20022 CHECK_NUMBER (x);
20603 wrong_type_argument (Qintegerp, x); 20023 CHECK_NUMBER (y);
20604 if (!INTEGERP (y))
20605 wrong_type_argument (Qintegerp, y);
20606 20024
20607 return find_hot_spot (map, XINT (x), XINT (y)); 20025 return find_hot_spot (map, XINT (x), XINT (y));
20608} 20026}
@@ -22018,17 +21436,6 @@ wide as that tab on the display. */);
22018The face used for trailing whitespace is `trailing-whitespace'. */); 21436The face used for trailing whitespace is `trailing-whitespace'. */);
22019 Vshow_trailing_whitespace = Qnil; 21437 Vshow_trailing_whitespace = Qnil;
22020 21438
22021#ifdef HAVE_WINDOW_SYSTEM
22022 DEFVAR_LISP ("overflow-newline-into-fringe", &Voverflow_newline_into_fringe,
22023 doc: /* *Non-nil means that newline may flow into the right fringe.
22024This means that display lines which are exactly as wide as the window
22025(not counting the final newline) will only occupy one screen line, by
22026showing (or hiding) the final newline in the right fringe; when point
22027is at the final newline, the cursor is shown in the right fringe.
22028If nil, also continue lines which are exactly as wide as the window. */);
22029 Voverflow_newline_into_fringe = Qt;
22030#endif
22031
22032 DEFVAR_LISP ("void-text-area-pointer", &Vvoid_text_area_pointer, 21439 DEFVAR_LISP ("void-text-area-pointer", &Vvoid_text_area_pointer,
22033 doc: /* *The pointer shape to show in void text areas. 21440 doc: /* *The pointer shape to show in void text areas.
22034Nil means to show the text pointer. Other options are `arrow', `text', 21441Nil means to show the text pointer. Other options are `arrow', `text',