comparison src/redisplay.c @ 173:8eaf7971accc r20-3b13

Import from CVS: tag r20-3b13
author cvs
date Mon, 13 Aug 2007 09:49:09 +0200
parents 6b37e6ddd302
children 9ad43877534d
comparison
equal deleted inserted replaced
172:a38aed19690b 173:8eaf7971accc
571 if (dl->display_blocks) 571 if (dl->display_blocks)
572 { 572 {
573 for (elt = 0; elt < Dynarr_length (dl->display_blocks); elt++) 573 for (elt = 0; elt < Dynarr_length (dl->display_blocks); elt++)
574 { 574 {
575 if (Dynarr_at (dl->display_blocks, elt).type == type) 575 if (Dynarr_at (dl->display_blocks, elt).type == type)
576 return (Dynarr_atp (dl->display_blocks, elt)); 576 return Dynarr_atp (dl->display_blocks, elt);
577 } 577 }
578 578
579 /* There isn't an active block of the desired type, but there 579 /* There isn't an active block of the desired type, but there
580 might still be allocated blocks we need to reuse. */ 580 might still be allocated blocks we need to reuse. */
581 if (elt < Dynarr_largest (dl->display_blocks)) 581 if (elt < Dynarr_largest (dl->display_blocks))
637 } 637 }
638 638
639 static int 639 static int
640 tab_pix_width (struct window *w) 640 tab_pix_width (struct window *w)
641 { 641 {
642 return (space_width (w) * tab_char_width (w)); 642 return space_width (w) * tab_char_width (w);
643 } 643 }
644 644
645 /* Given a pixel position in a window, return the pixel location of 645 /* Given a pixel position in a window, return the pixel location of
646 the next tabstop. Tabs are calculated from the left window edge in 646 the next tabstop. Tabs are calculated from the left window edge in
647 terms of spaces displayed in the default face. Formerly the space 647 terms of spaces displayed in the default face. Formerly the space
2624 it so that regenerate_window will exit properly. This is bogus. 2624 it so that regenerate_window will exit properly. This is bogus.
2625 The main loop should get fixed so that it isn't necessary to call 2625 The main loop should get fixed so that it isn't necessary to call
2626 this function if we are already at EOB. */ 2626 this function if we are already at EOB. */
2627 2627
2628 if (data.bi_bufpos == BI_BUF_ZV (b) && bi_start_pos == BI_BUF_ZV (b)) 2628 if (data.bi_bufpos == BI_BUF_ZV (b) && bi_start_pos == BI_BUF_ZV (b))
2629 return (data.bi_bufpos + 1); /* Yuck! */ 2629 return data.bi_bufpos + 1; /* Yuck! */
2630 else 2630 else
2631 return data.bi_bufpos; 2631 return data.bi_bufpos;
2632 } 2632 }
2633 2633
2634 /* Display the overlay arrow at the beginning of the given line. */ 2634 /* Display the overlay arrow at the beginning of the given line. */
2694 dl->descent = data.new_descent; 2694 dl->descent = data.new_descent;
2695 2695
2696 data.db->start_pos = dl->bounds.left_in; 2696 data.db->start_pos = dl->bounds.left_in;
2697 data.db->end_pos = data.pixpos; 2697 data.db->end_pos = data.pixpos;
2698 2698
2699 return (data.pixpos - dl->bounds.left_in); 2699 return data.pixpos - dl->bounds.left_in;
2700 } 2700 }
2701 2701
2702 /* Add a type of glyph to a margin display block. */ 2702 /* Add a type of glyph to a margin display block. */
2703 2703
2704 static int 2704 static int
4844 { 4844 {
4845 dl = Dynarr_atp (dla, Dynarr_length (dla) - 1); 4845 dl = Dynarr_atp (dla, Dynarr_length (dla) - 1);
4846 4846
4847 if (point >= (dl->bufpos + dl->offset) 4847 if (point >= (dl->bufpos + dl->offset)
4848 && point <= (dl->end_bufpos + dl->offset)) 4848 && point <= (dl->end_bufpos + dl->offset))
4849 return (!dl->clip); 4849 return !dl->clip;
4850 else 4850 else
4851 return 1; 4851 return 1;
4852 } 4852 }
4853 else 4853 else
4854 return 1; 4854 return 1;
4864 modeline and any potential horizontal scrollbar. */ 4864 modeline and any potential horizontal scrollbar. */
4865 4865
4866 int 4866 int
4867 window_half_pixpos (struct window *w) 4867 window_half_pixpos (struct window *w)
4868 { 4868 {
4869 return (WINDOW_TEXT_TOP (w) + (WINDOW_TEXT_HEIGHT (w) >> 1)); 4869 return WINDOW_TEXT_TOP (w) + (WINDOW_TEXT_HEIGHT (w) >> 1);
4870 } 4870 }
4871 4871
4872 /* Return the display line which is currently in the middle of the 4872 /* Return the display line which is currently in the middle of the
4873 window W for display lines TYPE. */ 4873 window W for display lines TYPE. */
4874 4874
5699 scan_buffer (b, '\n', end, 0, -lots, &shortage, 0); 5699 scan_buffer (b, '\n', end, 0, -lots, &shortage, 0);
5700 line = lots - shortage + 1; 5700 line = lots - shortage + 1;
5701 5701
5702 sprintf (window_line_number_buf, "%d", line); 5702 sprintf (window_line_number_buf, "%d", line);
5703 5703
5704 return (window_line_number_buf); 5704 return window_line_number_buf;
5705 } 5705 }
5706 5706
5707 /* Given a character representing an object in a modeline 5707 /* Given a character representing an object in a modeline
5708 specification, return a string (stored into the global array 5708 specification, return a string (stored into the global array
5709 `mode_spec_bufbyte_string') with the information that object 5709 `mode_spec_bufbyte_string') with the information that object
6276 line_start_cache_dynarr *cache = w->line_start_cache; 6276 line_start_cache_dynarr *cache = w->line_start_cache;
6277 6277
6278 if (!Dynarr_length (cache)) 6278 if (!Dynarr_length (cache))
6279 return -1; 6279 return -1;
6280 else 6280 else
6281 return (Dynarr_atp (cache, 0)->start); 6281 return Dynarr_atp (cache, 0)->start;
6282 } 6282 }
6283 6283
6284 /* Return the very last buffer position contained in the given 6284 /* Return the very last buffer position contained in the given
6285 window's cache, or -1 if the cache is empty. Assumes that the 6285 window's cache, or -1 if the cache is empty. Assumes that the
6286 cache is valid. */ 6286 cache is valid. */
6291 line_start_cache_dynarr *cache = w->line_start_cache; 6291 line_start_cache_dynarr *cache = w->line_start_cache;
6292 6292
6293 if (!Dynarr_length (cache)) 6293 if (!Dynarr_length (cache))
6294 return -1; 6294 return -1;
6295 else 6295 else
6296 return (Dynarr_atp (cache, Dynarr_length (cache) - 1)->end); 6296 return Dynarr_atp (cache, Dynarr_length (cache) - 1)->end;
6297 } 6297 }
6298 6298
6299 /* Return the index of the line POINT is contained within in window 6299 /* Return the index of the line POINT is contained within in window
6300 W's line start cache. It will enlarge the cache or move the cache 6300 W's line start cache. It will enlarge the cache or move the cache
6301 window in order to have POINT be present in the cache. MIN_PAST is 6301 window in order to have POINT be present in the cache. MIN_PAST is
6620 6620
6621 if (start_elt < 0) 6621 if (start_elt < 0)
6622 { 6622 {
6623 w->line_cache_validation_override--; 6623 w->line_cache_validation_override--;
6624 if (end) 6624 if (end)
6625 return (BUF_ZV (b)); 6625 return BUF_ZV (b);
6626 else 6626 else
6627 return (BUF_BEGV (b)); 6627 return BUF_BEGV (b);
6628 } 6628 }
6629 else 6629 else
6630 { 6630 {
6631 w->line_cache_validation_override--; 6631 w->line_cache_validation_override--;
6632 if (end) 6632 if (end)
6649 6649
6650 /* We've hit the end of the bottom so that's what it is. */ 6650 /* We've hit the end of the bottom so that's what it is. */
6651 if (from >= BUF_ZV (b)) 6651 if (from >= BUF_ZV (b))
6652 { 6652 {
6653 w->line_cache_validation_override--; 6653 w->line_cache_validation_override--;
6654 return (BUF_ZV (b)); 6654 return BUF_ZV (b);
6655 } 6655 }
6656 6656
6657 update_line_start_cache (w, from, to, BUF_PT (b), 0); 6657 update_line_start_cache (w, from, to, BUF_PT (b), 0);
6658 6658
6659 /* Updating the cache invalidates any current indexes. */ 6659 /* Updating the cache invalidates any current indexes. */
6729 int win_char_height; 6729 int win_char_height;
6730 6730
6731 if (cur_pos <= BUF_BEGV (b)) 6731 if (cur_pos <= BUF_BEGV (b))
6732 { 6732 {
6733 w->line_cache_validation_override--; 6733 w->line_cache_validation_override--;
6734 return (BUF_BEGV (b)); 6734 return BUF_BEGV (b);
6735 } 6735 }
6736 6736
6737 win_char_height = window_char_height (w, 0); 6737 win_char_height = window_char_height (w, 0);
6738 if (!win_char_height) 6738 if (!win_char_height)
6739 win_char_height = 1; 6739 win_char_height = 1;
6770 cur_elt = 0; /* Hit the top */ 6770 cur_elt = 0; /* Hit the top */
6771 else 6771 else
6772 cur_elt -= line; 6772 cur_elt -= line;
6773 6773
6774 w->line_cache_validation_override--; 6774 w->line_cache_validation_override--;
6775 return (Dynarr_atp (w->line_start_cache, cur_elt)->start); 6775 return Dynarr_atp (w->line_start_cache, cur_elt)->start;
6776 } 6776 }
6777 else 6777 else
6778 { 6778 {
6779 /* The calculated value of pixpos is correct for the bottom line 6779 /* The calculated value of pixpos is correct for the bottom line
6780 or what we want when line is -1. Therefore we subtract one 6780 or what we want when line is -1. Therefore we subtract one
7316 display_line_dynarr *dla; 7316 display_line_dynarr *dla;
7317 7317
7318 /* This is a safety valve in case this got called with a frame in 7318 /* This is a safety valve in case this got called with a frame in
7319 the middle of being deleted. */ 7319 the middle of being deleted. */
7320 if (!DEVICEP (f->device) || !DEVICE_LIVE_P (XDEVICE (f->device))) 7320 if (!DEVICEP (f->device) || !DEVICE_LIVE_P (XDEVICE (f->device)))
7321 device_check_failed = 1; 7321 {
7322 device_check_failed = 1;
7323 d = NULL, cache = NULL; /* Warning suppression */
7324 }
7322 else 7325 else
7323 { 7326 {
7324 d = XDEVICE (f->device); 7327 d = XDEVICE (f->device);
7325 cache = &d->pixel_to_glyph_cache; 7328 cache = &d->pixel_to_glyph_cache;
7326 } 7329 }