Mercurial > hg > xemacs-beta
diff src/redisplay.c @ 4187:26dccfc8fa60
[xemacs-hg @ 2007-09-26 13:27:59 by didierv]
More fixes about face indexes
author | didierv |
---|---|
date | Wed, 26 Sep 2007 13:28:01 +0000 |
parents | 98af8a976fc3 |
children | 62d532188a28 |
line wrap: on
line diff
--- a/src/redisplay.c Wed Sep 26 09:36:51 2007 +0000 +++ b/src/redisplay.c Wed Sep 26 13:28:01 2007 +0000 @@ -161,9 +161,9 @@ to be skipped before anything is displayed. */ Bytexpos byte_start_col_enabled; int start_col_xoffset; /* Number of pixels that still need to - be skipped. This is used for - horizontal scrolling of glyphs, where we want - to be able to scroll over part of the glyph. */ + be skipped. This is used for + horizontal scrolling of glyphs, where we want + to be able to scroll over part of the glyph. */ int hscroll_glyph_width_adjust; /* how much the width of the hscroll glyph differs from space_width (w). @@ -198,7 +198,7 @@ Charcount modeline_charpos; /* Number of chars used in result_str so far; corresponds to bytepos. */ Bytecount bytepos; /* Number of bytes used in result_str so far. - We don't actually copy the bytes into result_str + We don't actually copy the bytes into result_str until the end because we don't know how big the string is going to be until then. */ } pos_data; @@ -258,7 +258,7 @@ struct { /* Not used as yet, but could be used to wrap rather than clip glyphs. */ - int width; + int width; Lisp_Object glyph; } p_glyph; @@ -301,7 +301,7 @@ int no_regen); static int point_visible (struct window *w, Charbpos point, int type); static void calculate_yoffset (struct display_line *dl, - struct display_block *fixup); + struct display_block *fixup); static void calculate_baseline (pos_data *data); #ifdef ERROR_CHECK_DISPLAY @@ -320,7 +320,7 @@ (preempted = \ (!disable_preemption && \ ((preemption_count < max_preempts) || !NILP (Vexecuting_macro)) && \ - (!INTERACTIVE || \ + (!INTERACTIVE || \ detect_input_pending (QUEUED_EVENTS_REQUIRED_FOR_PREEMPTION))))) /* @@ -713,7 +713,7 @@ } /* There isn't an active block of the desired type, but there - might still be allocated blocks we need to reuse. */ + might still be allocated blocks we need to reuse. */ if (elt < Dynarr_largest (dl->display_blocks)) { struct display_block *dbp = Dynarr_atp (dl->display_blocks, elt); @@ -729,7 +729,7 @@ else { /* This line doesn't have any display blocks, so initialize the display - bock array. */ + bock array. */ dl->display_blocks = Dynarr_new (display_block); } @@ -847,11 +847,11 @@ { struct rune *r = Dynarr_atp (fixup->runes,i); if (r->type == RUNE_DGLYPH) - { - if (r->object.dglyph.ascent < dl->ascent) - r->object.dglyph.yoffset = dl->ascent - r->object.dglyph.ascent + + { + if (r->object.dglyph.ascent < dl->ascent) + r->object.dglyph.yoffset = dl->ascent - r->object.dglyph.ascent + r->object.dglyph.descent; - } + } } } @@ -897,11 +897,11 @@ if (!data->new_ascent && !data->new_descent) { /* We've got a blank line so initialize these values from the default - face. */ + face. */ default_face_font_info (data->window, &data->new_ascent, &data->new_descent, 0, 0, 0); } - + /* No automatically positioned glyphs? Return at once. */ if (!data->need_baseline_computation) return; @@ -913,7 +913,7 @@ { int default_font_ascent, default_font_descent, default_font_height; int scaled_default_font_ascent, scaled_default_font_descent; - + default_face_font_info (data->window, &default_font_ascent, &default_font_descent, &default_font_height, 0, 0); @@ -924,16 +924,16 @@ data->new_ascent = max (data->new_ascent, scaled_default_font_ascent); /* The ascent may have expanded now. Do we still need to grow the descent, - or are things big enough? - - The +1 caters for the baseline row itself. */ + or are things big enough? + + The +1 caters for the baseline row itself. */ if (data->max_pixmap_height > data->new_ascent + data->new_descent) - { - scaled_default_font_descent = (data->max_pixmap_height * + { + scaled_default_font_descent = (data->max_pixmap_height * default_font_descent / default_font_height) + 1; - data->new_descent = max (data->new_descent, scaled_default_font_descent); - } + data->new_descent = max (data->new_descent, scaled_default_font_descent); + } } } @@ -1127,7 +1127,7 @@ Ichar ch = data->font_is_bogus ? '~' : data->ch; data->last_char_width = - redisplay_text_width_ichar_string (XWINDOW (data->window), + redisplay_text_width_ichar_string (XWINDOW (data->window), data->findex, &ch, 1); } else @@ -1302,7 +1302,7 @@ prop_block_dynarr *retval; /* If we have still not fully scrolled horizontally, subtract - the width of this tab and return. */ + the width of this tab and return. */ if (char_tab_width < data->start_col) { data->start_col -= char_tab_width; @@ -1630,7 +1630,7 @@ comment sounds familiar. */ /* #### Still need to add any remaining elements to the - propagation information. */ + propagation information. */ if (prop) return prop; } @@ -1722,11 +1722,11 @@ XBUFFER (WINDOW_BUFFER (XWINDOW (data->window))); /* #### Chuck fix this shit or I'm gonna scream! */ if (byte_old_charpos > BYTE_BUF_BEGV (buf)) - data->byte_charpos = prev_bytebpos (buf, byte_old_charpos); - else + data->byte_charpos = prev_bytebpos (buf, byte_old_charpos); + else /* #### is this correct? Does anyone know? Does anyone care? Is this a cheesy hack or what? */ - data->byte_charpos = BYTE_BUF_BEGV (buf) - 1; + data->byte_charpos = BYTE_BUF_BEGV (buf) - 1; } } break; @@ -1747,12 +1747,12 @@ data->blank_width = data->max_pixpos - data->pixpos; /* We pass a bogus value of char_tab_width. It shouldn't - matter because unless something is really screwed up - this call won't cause that arg to be used. */ + matter because unless something is really screwed up + this call won't cause that arg to be used. */ add_failed = add_blank_rune (data, XWINDOW (data->window), 0); /* This can happen in the case where we have a tab which - is wider than the window. */ + is wider than the window. */ if (data->blank_width != pb->data.p_blank.width) { pb->data.p_blank.width -= data->blank_width; @@ -1841,8 +1841,8 @@ int glyph_char_width = width / space_width (w); /* If we still have not fully scrolled horizontally after - taking into account the width of the glyph, subtract its - width and return. */ + taking into account the width of the glyph, subtract its + width and return. */ if (glyph_char_width < data->start_col) { data->start_col -= glyph_char_width; @@ -1879,7 +1879,7 @@ than the window. We could alternatively just completely ignore the glyph and proceed from there but I think that this is a better solution. - + This does, however, create a different problem in that we can end up adding the object to every single line, never getting any further - for instance an extent with a long @@ -1901,7 +1901,7 @@ width = data->max_pixpos - data->pixpos; /* Add the glyph we are displaying, but clipping, to the propagation data so that we don't try and do it - again. */ + again. */ retval = Dynarr_new (prop_block); pb.type = PROP_GLYPH; pb.data.p_glyph.glyph = gb->glyph; @@ -1956,7 +1956,7 @@ data->new_ascent = max (data->new_ascent, pix_ascent); data->new_descent = max (data->new_descent, pix_descent); data->max_pixmap_height = max (data->max_pixmap_height, height); - + rb.object.dglyph.descent = pix_descent; } @@ -2001,7 +2001,7 @@ rb.endpos = bytebpos_to_charbpos (XBUFFER (WINDOW_BUFFER (w)), data->byte_endpos); else - rb.endpos = 0; + rb.endpos = 0; rb.type = RUNE_DGLYPH; rb.object.dglyph.glyph = gb->glyph; rb.object.dglyph.extent = gb->extent; @@ -2274,8 +2274,8 @@ } /* If selective display was an integer and we aren't working on - a continuation line then find the next line we are actually - supposed to display. */ + a continuation line then find the next line we are actually + supposed to display. */ if (selective > 0 && (data.byte_charpos == BYTE_BUF_BEGV (b) || BUF_FETCH_CHAR (b, prev_bytebpos (b, data.byte_charpos)) == '\n')) @@ -2304,7 +2304,7 @@ works because we always recalculate the extent-fragments for propagated data, we never actually propagate the fragments that still need to be displayed. */ - if (*prop && Dynarr_atp (*prop, 0)->type == PROP_GLYPH) + if (*prop && Dynarr_atp (*prop, 0)->type == PROP_GLYPH) { last_glyph = Dynarr_atp (*prop, 0)->data.p_glyph.glyph; Dynarr_free (*prop); @@ -2323,12 +2323,12 @@ initial = 0; /* Determine what is next to be displayed. We first handle any - glyphs returned by glyphs_at_charbpos. If there are no glyphs to - display then we determine what to do based on the character at the - current buffer position. */ + glyphs returned by glyphs_at_charbpos. If there are no glyphs to + display then we determine what to do based on the character at the + current buffer position. */ /* If the current position is covered by an invisible extent, do - nothing (except maybe add some ellipses). + nothing (except maybe add some ellipses). #### The behavior of begin and end-glyphs at the edge of an invisible extent should be investigated further. This is @@ -2365,7 +2365,7 @@ } /* If point is in an invisible region we place it on the - next visible character. */ + next visible character. */ if (data.cursor_type == CURSOR_ON && data.byte_charpos == data.byte_cursor_charpos) { @@ -2414,31 +2414,31 @@ /* #### I think this is safe, but could be wrong. */ data.ch = BYTE_BUF_FETCH_CHAR (b, data.byte_charpos); - if (Dynarr_length (data.ef->end_glyphs) > 0) + if (Dynarr_length (data.ef->end_glyphs) > 0) { *prop = add_glyph_runes (&data, END_GLYPHS); tmpglyphs = data.ef->end_glyphs; } /* If there are begin glyphs, add them to the line. */ - if (!*prop && Dynarr_length (data.ef->begin_glyphs) > 0) + if (!*prop && Dynarr_length (data.ef->begin_glyphs) > 0) { *prop = add_glyph_runes (&data, BEGIN_GLYPHS); tmpglyphs = data.ef->begin_glyphs; } - if (*prop) + if (*prop) { /* If we just clipped a glyph and we are at the end of a line and there are more glyphs to display then do appropriate processing to not get a continuation glyph. */ - if (*prop != ADD_FAILED + if (*prop != ADD_FAILED && Dynarr_atp (*prop, 0)->type == PROP_GLYPH && data.ch == '\n') - { + { /* If there are no more glyphs then do the normal - processing. + processing. #### This doesn't actually work if the same glyph is present more than once in the block. To solve @@ -2477,7 +2477,7 @@ entry = display_table_entry (data.ch, face_dt, window_dt); /* If there is a display table entry for it, hand it off to - add_disp_table_entry_runes and let it worry about it. */ + add_disp_table_entry_runes and let it worry about it. */ if (!NILP (entry) && !EQ (entry, make_char (data.ch))) { *prop = add_disp_table_entry_runes (&data, entry); @@ -2487,12 +2487,12 @@ } /* Check if we have hit a newline character. If so, add a marker - to the line and end this loop. */ + to the line and end this loop. */ else if (data.ch == '\n') { /* We aren't going to be adding an end glyph so give its - space back in order to make sure that the cursor can - fit. */ + space back in order to make sure that the cursor can + fit. */ data.max_pixpos += data.end_glyph_width; if (selective > 0 @@ -2520,10 +2520,10 @@ } /* We need to set data.byte_charpos to the start of the - next visible region in order to make this line - appear to contain all of the invisible area. - Otherwise, the line cache won't work - correctly. */ + next visible region in order to make this line + appear to contain all of the invisible area. + Otherwise, the line cache won't work + correctly. */ INC_BYTEBPOS (b, data.byte_charpos); while (byte_spaces_at_point (b, data.byte_charpos) >= selective) { @@ -2549,9 +2549,9 @@ } /* If the current character is ^M, and selective display is - enabled, then add the invisible-text-glyph if - selective-display-ellipses is set. In any case, this - line is done. */ + enabled, then add the invisible-text-glyph if + selective-display-ellipses is set. In any case, this + line is done. */ else if (data.ch == (('M' & 037)) && selective == -1) { Bytebpos byte_next_charpos; @@ -2564,7 +2564,7 @@ DEC_BYTEBPOS (b, byte_next_charpos); /* If the cursor is somewhere in the elided text make - sure that the cursor gets drawn appropriately. */ + sure that the cursor gets drawn appropriately. */ if (data.cursor_type == CURSOR_ON && (data.byte_cursor_charpos >= data.byte_charpos && data.byte_cursor_charpos < byte_next_charpos)) @@ -2573,14 +2573,14 @@ } /* We won't be adding a truncation or continuation glyph - so give up the room allocated for them. */ + so give up the room allocated for them. */ data.max_pixpos += data.end_glyph_width; if (!NILP (b->selective_display_ellipses)) { /* We don't propagate anything from the invisible - text glyph if it fails to fit. This is - intentional. */ + text glyph if it fails to fit. This is + intentional. */ struct glyph_block gb; gb.extent = Qnil; @@ -2590,16 +2590,16 @@ } /* Set the buffer position to the end of the line. We - need to do this before potentially adding a newline - so that the cursor flag will get set correctly (if - needed). */ + need to do this before potentially adding a newline + so that the cursor flag will get set correctly (if + needed). */ data.byte_charpos = byte_next_charpos; if (NILP (b->selective_display_ellipses) || data.byte_cursor_charpos == byte_next_charpos) { /* We have to at least add a newline character so - that the cursor shows up properly. */ + that the cursor shows up properly. */ data.ch = '\n'; data.blank_width = DEVMETH (d, eol_cursor_width, ()); data.findex = DEFAULT_INDEX; @@ -2611,15 +2611,15 @@ } /* This had better be a newline but doing it this way - we'll see obvious incorrect results if it isn't. No - need to abort here. */ + we'll see obvious incorrect results if it isn't. No + need to abort here. */ data.ch = BYTE_BUF_FETCH_CHAR (b, data.byte_charpos); goto done; } /* If the current character is considered to be printable, then - just add it. */ + just add it. */ else if (data.ch >= printable_min) { *prop = add_ichar_rune (&data); @@ -2628,8 +2628,8 @@ } /* If the current character is a tab, determine the next tab - starting position and add a blank rune which extends from the - current pixel position to that starting position. */ + starting position and add a blank rune which extends from the + current pixel position to that starting position. */ else if (data.ch == '\t') { int tab_start_pixpos = data.pixpos; @@ -2657,7 +2657,7 @@ *prop = add_blank_rune (&data, w, char_tab_width); /* add_blank_rune is only supposed to be called with - sizes guaranteed to fit in the available space. */ + sizes guaranteed to fit in the available space. */ assert (!(*prop)); if (prop_width) @@ -2675,7 +2675,7 @@ } /* If character is a control character, pass it off to - add_control_char_runes. + add_control_char_runes. The is_*() routines have undefined results on arguments outside of the range [-1, 255]. (This @@ -2691,7 +2691,7 @@ } /* If the character is above the ASCII range and we have not - already handled it, then print it as an octal number. */ + already handled it, then print it as an octal number. */ else if (data.ch >= 0200) { *prop = add_octal_runes (&data); @@ -2701,7 +2701,7 @@ } /* Assume the current character is considered to be printable, - then just add it. */ + then just add it. */ else { *prop = add_ichar_rune (&data); @@ -2729,14 +2729,14 @@ check. */ /* The common case is that the line ended because we hit a newline. - In that case, the next character is just the next buffer - position. */ + In that case, the next character is just the next buffer + position. */ if (data.ch == '\n') { /* If data.start_col_enabled is still true, then the window is - scrolled far enough so that nothing on this line is visible. - We need to stick a truncation glyph at the beginning of the - line in that case unless the line is completely blank. */ + scrolled far enough so that nothing on this line is visible. + We need to stick a truncation glyph at the beginning of the + line in that case unless the line is completely blank. */ if (data.byte_start_col_enabled) { if (data.cursor_type == CURSOR_ON) @@ -2761,7 +2761,7 @@ else { /* This duplicates code down below to add a newline to - the end of an otherwise empty line.*/ + the end of an otherwise empty line.*/ data.ch = '\n'; data.blank_width = DEVMETH (d, eol_cursor_width, ()); @@ -2773,16 +2773,16 @@ } /* Otherwise we have a buffer line which cannot fit on one display - line. */ + line. */ else { struct glyph_block gb; struct glyph_cachel *cachel; /* If the line is to be truncated then we actually have to look - for the next newline. We also add the end-of-line glyph which - we know will fit because we adjusted the right border before - we starting laying out the line. */ + for the next newline. We also add the end-of-line glyph which + we know will fit because we adjusted the right border before + we starting laying out the line. */ data.max_pixpos += data.end_glyph_width; data.findex = DEFAULT_INDEX; gb.extent = Qnil; @@ -2795,11 +2795,11 @@ byte_pos = byte_find_next_newline_no_quit (b, data.byte_charpos, 1); /* If the cursor is past the truncation line then we - make it appear on the truncation glyph. If we've hit - the end of the buffer then we also make the cursor - appear unless eob is immediately preceded by a - newline. In that case the cursor should actually - appear on the next line. */ + make it appear on the truncation glyph. If we've hit + the end of the buffer then we also make the cursor + appear unless eob is immediately preceded by a + newline. In that case the cursor should actually + appear on the next line. */ if (data.cursor_type == CURSOR_ON && data.byte_cursor_charpos >= data.byte_charpos && (data.byte_cursor_charpos < byte_pos || @@ -2839,9 +2839,9 @@ && (!echo_area_active (f) || data.byte_charpos == BYTE_BUF_ZV (b))) { /* We need to add a marker to the end of the line since there is no - newline character in order for the cursor to get drawn. We label - it as a newline so that it gets handled correctly by the - whitespace routines below. */ + newline character in order for the cursor to get drawn. We label + it as a newline so that it gets handled correctly by the + whitespace routines below. */ data.ch = '\n'; data.blank_width = DEVMETH (d, eol_cursor_width, ()); @@ -3026,12 +3026,12 @@ gb.extent = Qnil; add_glyph_rune (&data, &gb, BEGIN_GLYPHS, 0, 0); } - + if (data.max_pixmap_height) { int height = data.new_ascent + data.new_descent; int pix_ascent, pix_descent; - + pix_descent = data.max_pixmap_height * data.new_descent / height; pix_ascent = data.max_pixmap_height - pix_descent; calculate_baseline (&data); @@ -3271,13 +3271,13 @@ int width = Dynarr_atp (ib, marker)->width; /* If everything now fits in the available inside margin - space, we're done. */ + space, we're done. */ if (used_in <= avail_in) done = 1; else { /* Otherwise see if we have room to move a glyph to the - outside. */ + outside. */ if (used_out + width <= avail_out) { used_out += width; @@ -3377,8 +3377,8 @@ odb = get_display_block_from_line (dl, LEFT_OUTSIDE_MARGIN); odb->start_pos = dl->bounds.left_out; /* #### We should stop adding a blank to account for the space - between the end of the glyphs and the margin and instead set - this accordingly. */ + between the end of the glyphs and the margin and instead set + this accordingly. */ odb->end_pos = dl->bounds.left_in; Dynarr_reset (odb->runes); } @@ -3585,13 +3585,13 @@ int width = Dynarr_atp (ib, marker)->width; /* If everything now fits in the available inside margin - space, we're done. */ + space, we're done. */ if (used_in <= avail_in) done = 1; else { /* Otherwise see if we have room to move a glyph to the - outside. */ + outside. */ if (used_out + width <= avail_out) { used_out += width; @@ -3688,7 +3688,7 @@ { odb = get_display_block_from_line (dl, RIGHT_OUTSIDE_MARGIN); /* #### See comments before odb->start_pos init in - create_left_glyph_block */ + create_left_glyph_block */ odb->start_pos = dl->bounds.right_in; odb->end_pos = dl->bounds.right_out; Dynarr_reset (odb->runes); @@ -3701,7 +3701,7 @@ idb = get_display_block_from_line (dl, RIGHT_INSIDE_MARGIN); idb->start_pos = dl->bounds.right_white; /* #### See comments before odb->start_pos init in - create_left_glyph_block */ + create_left_glyph_block */ idb->end_pos = dl->bounds.right_in; Dynarr_reset (idb->runes); } @@ -3785,9 +3785,9 @@ /* This function is also used in frame.c by `generate_title_string' */ void generate_formatted_string_db (Lisp_Object format_str, Lisp_Object result_str, - struct window *w, struct display_line *dl, - struct display_block *db, face_index findex, - int min_pixpos, int max_pixpos, int type) + struct window *w, struct display_line *dl, + struct display_block *db, face_index findex, + int min_pixpos, int max_pixpos, int type) { struct frame *f = XFRAME (w->frame); struct device *d = XDEVICE (f->device); @@ -3821,13 +3821,13 @@ if (! NILP (result_str)) offset = w->modeline_hscroll; generate_fstring_runes (w, &data, 0, 0, -1, format_str, 0, - max_pixpos - min_pixpos, findex, type, &offset, + max_pixpos - min_pixpos, findex, type, &offset, Qnil); if (Dynarr_length (db->runes)) { struct rune *rb = - Dynarr_atp (db->runes, Dynarr_length (db->runes) - 1); + Dynarr_atp (db->runes, Dynarr_length (db->runes) - 1); c_pixpos = rb->xpos + rb->width; } else @@ -3859,44 +3859,44 @@ sledgehammer_check_ascii_begin (result_str); detach_all_extents (result_str); resize_string (result_str, -1, - data.bytepos - XSTRING_LENGTH (result_str)); + data.bytepos - XSTRING_LENGTH (result_str)); strdata = XSTRING_DATA (result_str); for (elt = 0, len = 0; elt < Dynarr_length (db->runes); elt++) - { - if (Dynarr_atp (db->runes, elt)->type == RUNE_CHAR) - { - len += (set_itext_ichar - (strdata + len, Dynarr_atp (db->runes, - elt)->object.chr.ch)); - } - } + { + if (Dynarr_atp (db->runes, elt)->type == RUNE_CHAR) + { + len += (set_itext_ichar + (strdata + len, Dynarr_atp (db->runes, + elt)->object.chr.ch)); + } + } init_string_ascii_begin (result_str); bump_string_modiff (result_str); sledgehammer_check_ascii_begin (result_str); for (elt = 0; elt < Dynarr_length (formatted_string_extent_dynarr); - elt++) - { - Lisp_Object extent = Qnil; - Lisp_Object child; - - extent = wrap_extent (Dynarr_at (formatted_string_extent_dynarr, elt)); - child = Fgethash (extent, buf->modeline_extent_table, Qnil); - if (NILP (child)) - { - child = Fmake_extent (Qnil, Qnil, result_str); - Fputhash (extent, child, buf->modeline_extent_table); - } - Fset_extent_parent (child, extent); - set_extent_endpoints - (XEXTENT (child), - Dynarr_at (formatted_string_extent_start_dynarr, elt), - Dynarr_at (formatted_string_extent_end_dynarr, elt), - result_str); - } + elt++) + { + Lisp_Object extent = Qnil; + Lisp_Object child; + + extent = wrap_extent (Dynarr_at (formatted_string_extent_dynarr, elt)); + child = Fgethash (extent, buf->modeline_extent_table, Qnil); + if (NILP (child)) + { + child = Fmake_extent (Qnil, Qnil, result_str); + Fputhash (extent, child, buf->modeline_extent_table); + } + Fset_extent_parent (child, extent); + set_extent_endpoints + (XEXTENT (child), + Dynarr_at (formatted_string_extent_start_dynarr, elt), + Dynarr_at (formatted_string_extent_end_dynarr, elt), + result_str); + } in_modeline_generation = 0; } @@ -3999,7 +3999,7 @@ static Charcount add_string_to_fstring_db_runes (pos_data *data, const Ibyte *str, - Charcount pos, Charcount min_pos, + Charcount pos, Charcount min_pos, Charcount max_pos) { /* This function has been Mule-ized. */ @@ -4012,7 +4012,7 @@ add_blank_rune (data, NULL, 0); end = (Dynarr_length (db->runes) + - bytecount_to_charcount (str, strlen ((const char *) str))); + bytecount_to_charcount (str, strlen ((const char *) str))); if (max_pos != -1) end = min (max_pos, end); @@ -4025,15 +4025,15 @@ succeeded = (add_ichar_rune (data) != ADD_FAILED); INC_IBYTEPTR (cur_pos); if (succeeded) - { - pos++; - data->modeline_charpos++; - data->bytepos += cur_pos - old_cur_pos; - } + { + pos++; + data->modeline_charpos++; + data->bytepos += cur_pos - old_cur_pos; + } } while (Dynarr_length (db->runes) < min_pos && - (data->pixpos + data->blank_width <= data->max_pixpos)) + (data->pixpos + data->blank_width <= data->max_pixpos)) add_blank_rune (data, NULL, 0); return Dynarr_length (db->runes); @@ -4043,7 +4043,7 @@ modeline extents. */ static Charcount add_glyph_to_fstring_db_runes (pos_data *data, Lisp_Object glyph, - Charcount pos, Charcount UNUSED (min_pos), + Charcount pos, Charcount UNUSED (min_pos), Charcount max_pos, Lisp_Object extent) { /* This function has been Mule-ized. */ @@ -4065,7 +4065,7 @@ pos++; while (Dynarr_length (db->runes) < pos && - (data->pixpos + data->blank_width <= data->max_pixpos)) + (data->pixpos + data->blank_width <= data->max_pixpos)) add_blank_rune (data, NULL, 0); return Dynarr_length (db->runes); @@ -4085,9 +4085,9 @@ modeline. */ static Charcount generate_fstring_runes (struct window *w, pos_data *data, Charcount pos, - Charcount min_pos, Charcount max_pos, - Lisp_Object elt, int depth, int max_pixsize, - face_index findex, int type, Charcount *offset, + Charcount min_pos, Charcount max_pos, + Lisp_Object elt, int depth, int max_pixsize, + face_index findex, int type, Charcount *offset, Lisp_Object cur_ext) { /* This function has been Mule-ized. */ @@ -4095,7 +4095,7 @@ -- C zero-terminated-string lossage. -- Non-printable characters should be converted into something - appropriate (e.g. ^F) instead of blindly being printed anyway. + appropriate (e.g. ^F) instead of blindly being printed anyway. */ tail_recurse: @@ -4107,21 +4107,21 @@ if (STRINGP (elt)) { /* A string. Add to the display line and check for %-constructs - within it. */ + within it. */ Ibyte *this_str = XSTRING_DATA (elt); while ((pos < max_pos || max_pos == -1) && *this_str) - { - Ibyte *last = this_str; - - while (*this_str && *this_str != '%') - this_str++; - - if (this_str != last) - { - /* No %-construct */ - Charcount size = + { + Ibyte *last = this_str; + + while (*this_str && *this_str != '%') + this_str++; + + if (this_str != last) + { + /* No %-construct */ + Charcount size = bytecount_to_charcount (last, this_str - last); if (size <= *offset) @@ -4136,72 +4136,72 @@ pos, pos, tmp_max); *offset = 0; } - } - else /* *this_str == '%' */ - { - Charcount spec_width = 0; - - this_str++; /* skip over '%' */ - - /* We can't allow -ve args due to the "%-" construct. - * Argument specifies minwidth but not maxwidth - * (maxwidth can be specified by - * (<negative-number> . <stuff>) modeline elements) - */ - while (isdigit (*this_str)) - { - spec_width = spec_width * 10 + (*this_str - '0'); - this_str++; - } - spec_width += pos; - - if (*this_str == 'M') - { - pos = generate_fstring_runes (w, data, pos, spec_width, - max_pos, Vglobal_mode_string, - depth, max_pixsize, findex, - type, offset, cur_ext); - } - else if (*this_str == '-') - { - Charcount num_to_add; - - if (max_pixsize < 0) - num_to_add = 0; - else if (max_pos != -1) - num_to_add = max_pos - pos; - else - { - int cur_pixsize; - int dash_pixsize; - Ibyte ch = '-'; - SET_CURRENT_MODE_CHARS_PIXSIZE; - - dash_pixsize = - redisplay_text_width_string (w, findex, &ch, Qnil, 0, - 1); - - if (dash_pixsize == 0) + } + else /* *this_str == '%' */ + { + Charcount spec_width = 0; + + this_str++; /* skip over '%' */ + + /* We can't allow -ve args due to the "%-" construct. + * Argument specifies minwidth but not maxwidth + * (maxwidth can be specified by + * (<negative-number> . <stuff>) modeline elements) + */ + while (isdigit (*this_str)) + { + spec_width = spec_width * 10 + (*this_str - '0'); + this_str++; + } + spec_width += pos; + + if (*this_str == 'M') + { + pos = generate_fstring_runes (w, data, pos, spec_width, + max_pos, Vglobal_mode_string, + depth, max_pixsize, findex, + type, offset, cur_ext); + } + else if (*this_str == '-') + { + Charcount num_to_add; + + if (max_pixsize < 0) + num_to_add = 0; + else if (max_pos != -1) + num_to_add = max_pos - pos; + else + { + int cur_pixsize; + int dash_pixsize; + Ibyte ch = '-'; + SET_CURRENT_MODE_CHARS_PIXSIZE; + + dash_pixsize = + redisplay_text_width_string (w, findex, &ch, Qnil, 0, + 1); + + if (dash_pixsize == 0) num_to_add = 0; else { num_to_add = (max_pixsize - cur_pixsize) / dash_pixsize; num_to_add++; } - } - - while (num_to_add--) - pos = add_string_to_fstring_db_runes - (data, (const Ibyte *) "-", pos, pos, max_pos); - } - else if (*this_str != 0) - { - Ichar ch = itext_ichar (this_str); - Ibyte *str; + } + + while (num_to_add--) + pos = add_string_to_fstring_db_runes + (data, (const Ibyte *) "-", pos, pos, max_pos); + } + else if (*this_str != 0) + { + Ichar ch = itext_ichar (this_str); + Ibyte *str; Charcount size; - decode_mode_spec (w, ch, type); - - str = Dynarr_atp (mode_spec_ibyte_string, 0); + decode_mode_spec (w, ch, type); + + str = Dynarr_atp (mode_spec_ibyte_string, 0); size = bytecount_to_charcount /* Skip the null character added by `decode_mode_spec' */ (str, Dynarr_length (mode_spec_ibyte_string)) - 1; @@ -4220,35 +4220,35 @@ max_pos); *offset = 0; } - } - - /* NOT this_str++. There could be any sort of character at - the current position. */ - INC_IBYTEPTR (this_str); - } - - if (max_pixsize > 0) - { - int cur_pixsize; - SET_CURRENT_MODE_CHARS_PIXSIZE; - - if (cur_pixsize >= max_pixsize) - break; - } - } + } + + /* NOT this_str++. There could be any sort of character at + the current position. */ + INC_IBYTEPTR (this_str); + } + + if (max_pixsize > 0) + { + int cur_pixsize; + SET_CURRENT_MODE_CHARS_PIXSIZE; + + if (cur_pixsize >= max_pixsize) + break; + } + } } else if (SYMBOLP (elt)) { /* A symbol: process the value of the symbol recursively - as if it appeared here directly. */ + as if it appeared here directly. */ Lisp_Object tem = symbol_value_in_buffer (elt, w->buffer); if (!UNBOUNDP (tem)) - { + { /* If value is a string, output that string literally: - don't check for % within it. */ - if (STRINGP (tem)) - { + don't check for % within it. */ + if (STRINGP (tem)) + { Ibyte *str = XSTRING_DATA (tem); Charcount size = string_char_length (tem); @@ -4265,14 +4265,14 @@ min_pos, max_pos); *offset = 0; } - } - /* Give up right away for nil or t. */ - else if (!EQ (tem, elt)) - { - elt = tem; - goto tail_recurse; - } - } + } + /* Give up right away for nil or t. */ + else if (!EQ (tem, elt)) + { + elt = tem; + goto tail_recurse; + } + } } else if (GENERIC_SPECIFIERP (elt)) { @@ -4341,97 +4341,97 @@ } } else if (INTP (car)) - { - Charcount lim = XINT (car); - - elt = XCDR (elt); - - if (lim < 0) - { - /* Negative int means reduce maximum width. - * DO NOT change MIN_PIXPOS here! - * (20 -10 . foo) should truncate foo to 10 col - * and then pad to 20. - */ - if (max_pos == -1) - max_pos = pos - lim; - else - max_pos = min (max_pos, pos - lim); - } - else if (lim > 0) - { - /* Padding specified. Don't let it be more than - * current maximum. - */ - lim += pos; - if (max_pos != -1 && lim > max_pos) - lim = max_pos; - /* If that's more padding than already wanted, queue it. - * But don't reduce padding already specified even if - * that is beyond the current truncation point. - */ - if (lim > min_pos) - min_pos = lim; - } - goto tail_recurse; - } + { + Charcount lim = XINT (car); + + elt = XCDR (elt); + + if (lim < 0) + { + /* Negative int means reduce maximum width. + * DO NOT change MIN_PIXPOS here! + * (20 -10 . foo) should truncate foo to 10 col + * and then pad to 20. + */ + if (max_pos == -1) + max_pos = pos - lim; + else + max_pos = min (max_pos, pos - lim); + } + else if (lim > 0) + { + /* Padding specified. Don't let it be more than + * current maximum. + */ + lim += pos; + if (max_pos != -1 && lim > max_pos) + lim = max_pos; + /* If that's more padding than already wanted, queue it. + * But don't reduce padding already specified even if + * that is beyond the current truncation point. + */ + if (lim > min_pos) + min_pos = lim; + } + goto tail_recurse; + } else if (STRINGP (car) || CONSP (car)) - { - int limit = 50; - - /* LIMIT is to protect against circular lists. */ - while (CONSP (elt) && --limit > 0 - && (pos < max_pos || max_pos == -1)) - { - pos = generate_fstring_runes (w, data, pos, pos, max_pos, - XCAR (elt), depth, max_pixsize, + { + int limit = 50; + + /* LIMIT is to protect against circular lists. */ + while (CONSP (elt) && --limit > 0 + && (pos < max_pos || max_pos == -1)) + { + pos = generate_fstring_runes (w, data, pos, pos, max_pos, + XCAR (elt), depth, max_pixsize, findex, type, offset, cur_ext); - elt = XCDR (elt); - } - } + elt = XCDR (elt); + } + } else if (EXTENTP (car)) - { - struct extent *ext = XEXTENT (car); - - if (EXTENT_LIVE_P (ext)) - { - face_index old_findex = data->findex; - Lisp_Object face; - Lisp_Object font_inst; - face_index new_findex; - Bytecount start = data->bytepos; - - face = extent_face (ext); - if (FACEP (face)) - { - /* #### needs to merge faces, sigh */ - /* #### needs to handle list of faces */ - new_findex = get_builtin_face_cache_index (w, face); - /* !!#### not right; needs to compute the max height of - all the charsets */ - font_inst = WINDOW_FACE_CACHEL_FONT (w, new_findex, - Vcharset_ascii); - - data->dl->ascent = max (data->dl->ascent, - XFONT_INSTANCE (font_inst)->ascent); - data->dl->descent = max (data->dl->descent, - XFONT_INSTANCE (font_inst)-> - descent); - } - else - new_findex = old_findex; - - data->findex = new_findex; - pos = generate_fstring_runes (w, data, pos, pos, max_pos, - XCDR (elt), depth - 1, + { + struct extent *ext = XEXTENT (car); + + if (EXTENT_LIVE_P (ext)) + { + face_index old_findex = data->findex; + Lisp_Object face; + Lisp_Object font_inst; + face_index new_findex; + Bytecount start = data->bytepos; + + face = extent_face (ext); + if (FACEP (face)) + { + /* #### needs to merge faces, sigh */ + /* #### needs to handle list of faces */ + new_findex = get_builtin_face_cache_index (w, face); + /* !!#### not right; needs to compute the max height of + all the charsets */ + font_inst = WINDOW_FACE_CACHEL_FONT (w, new_findex, + Vcharset_ascii); + + data->dl->ascent = max (data->dl->ascent, + XFONT_INSTANCE (font_inst)->ascent); + data->dl->descent = max (data->dl->descent, + XFONT_INSTANCE (font_inst)-> + descent); + } + else + new_findex = old_findex; + + data->findex = new_findex; + pos = generate_fstring_runes (w, data, pos, pos, max_pos, + XCDR (elt), depth - 1, max_pixsize, new_findex, type, offset, car); - data->findex = old_findex; - Dynarr_add (formatted_string_extent_dynarr, ext); - Dynarr_add (formatted_string_extent_start_dynarr, start); - Dynarr_add (formatted_string_extent_end_dynarr, data->bytepos); - } - } + data->findex = old_findex; + Dynarr_add (formatted_string_extent_dynarr, ext); + Dynarr_add (formatted_string_extent_start_dynarr, start); + Dynarr_add (formatted_string_extent_end_dynarr, data->bytepos); + } + } } else if (GLYPHP (elt)) { @@ -4520,8 +4520,8 @@ dla = window_display_lines (w, type); /* We don't care if there is a display line which is not - currently a modeline because it is definitely going to become - one if we have gotten to this point. */ + currently a modeline because it is definitely going to become + one if we have gotten to this point. */ if (Dynarr_length (dla) == 0) { if (Dynarr_largest (dla) > 0) @@ -4535,8 +4535,8 @@ } /* If we're adding a new place marker go ahead and generate the - modeline so that it is available for use by - window_modeline_height. */ + modeline so that it is available for use by + window_modeline_height. */ generate_modeline (w, Dynarr_atp (dla, 0), type); } @@ -4653,7 +4653,7 @@ extended characters show up as hex with a display table like this: - #s(range-table data ((256 524288) (format "%x"))) + #s(range-table data ((256 524288) (format "%x"))) Since more than one display table is possible, you have great flexibility in mapping ranges of characters. */ @@ -4680,10 +4680,9 @@ dl->num_chars = 0; dl->line_continuation = 0; - /* set up faces to use for clearing areas, used by - output_display_line */ + /* Set up faces to use for clearing areas, used by output_display_line. */ dl->default_findex = default_face; - if (default_face) + if (default_face > DEFAULT_INDEX) { dl->left_margin_findex = default_face; dl->right_margin_findex = default_face; @@ -4774,7 +4773,7 @@ { Lisp_Object last_glyph = Qnil; /* Deal with clipped glyphs that we have already displayed. */ - if (*prop && Dynarr_atp (*prop, 0)->type == PROP_GLYPH) + if (*prop && Dynarr_atp (*prop, 0)->type == PROP_GLYPH) { last_glyph = Dynarr_atp (*prop, 0)->data.p_glyph.glyph; Dynarr_free (*prop); @@ -4783,10 +4782,10 @@ /* Now compute the face and begin/end-glyph information. */ data.findex = /* Remember that the extent-fragment routines deal in - Bytexpos's. */ + Bytexpos's. */ extent_fragment_update (w, data.ef, data.byte_charpos, last_glyph); /* This is somewhat cheesy but the alternative is to - propagate default_face into extent_fragment_update. */ + propagate default_face into extent_fragment_update. */ if (data.findex == DEFAULT_INDEX) data.findex = default_face; @@ -4798,12 +4797,12 @@ initial = 0; /* Determine what is next to be displayed. We first handle any - glyphs returned by glyphs_at_charbpos. If there are no glyphs to - display then we determine what to do based on the character at the - current buffer position. */ + glyphs returned by glyphs_at_charbpos. If there are no glyphs to + display then we determine what to do based on the character at the + current buffer position. */ /* If the current position is covered by an invisible extent, do - nothing (except maybe add some ellipses). + nothing (except maybe add some ellipses). #### The behavior of begin and end-glyphs at the edge of an invisible extent should be investigated further. This is @@ -4850,9 +4849,9 @@ } /* If there is propagation data, then it represents the current - buffer position being displayed. Add them and advance the - position counter. This might also add the minibuffer - prompt. */ + buffer position being displayed. Add them and advance the + position counter. This might also add the minibuffer + prompt. */ else if (*prop) { dl->used_prop_data = 1; @@ -4910,7 +4909,7 @@ entry = display_table_entry (data.ch, face_dt, window_dt); /* If there is a display table entry for it, hand it off to - add_disp_table_entry_runes and let it worry about it. */ + add_disp_table_entry_runes and let it worry about it. */ if (!NILP (entry) && !EQ (entry, make_char (data.ch))) { *prop = add_disp_table_entry_runes (&data, entry); @@ -4920,18 +4919,18 @@ } /* Check if we have hit a newline character. If so, add a marker - to the line and end this loop. */ + to the line and end this loop. */ else if (data.ch == '\n') { /* We aren't going to be adding an end glyph so give its - space back in order to make sure that the cursor can - fit. */ + space back in order to make sure that the cursor can + fit. */ data.max_pixpos += data.end_glyph_width; goto done; } /* If the current character is considered to be printable, then - just add it. */ + just add it. */ else if (data.ch >= printable_min) { *prop = add_ichar_rune (&data); @@ -4940,8 +4939,8 @@ } /* If the current character is a tab, determine the next tab - starting position and add a blank rune which extends from the - current pixel position to that starting position. */ + starting position and add a blank rune which extends from the + current pixel position to that starting position. */ else if (data.ch == '\t') { int tab_start_pixpos = data.pixpos; @@ -4986,7 +4985,7 @@ } /* If character is a control character, pass it off to - add_control_char_runes. + add_control_char_runes. The is_*() routines have undefined results on arguments outside of the range [-1, 255]. (This @@ -5002,7 +5001,7 @@ } /* If the character is above the ASCII range and we have not - already handled it, then print it as an octal number. */ + already handled it, then print it as an octal number. */ else if (data.ch >= 0200) { *prop = add_octal_runes (&data); @@ -5012,7 +5011,7 @@ } /* Assume the current character is considered to be printable, - then just add it. */ + then just add it. */ else { *prop = add_ichar_rune (&data); @@ -5039,24 +5038,24 @@ check. */ /* The common case is that the line ended because we hit a newline. - In that case, the next character is just the next buffer - position. */ + In that case, the next character is just the next buffer + position. */ if (data.ch == '\n') { INC_BYTECOUNT (XSTRING_DATA (disp_string), data.byte_charpos); } /* Otherwise we have a buffer line which cannot fit on one display - line. */ + line. */ else { struct glyph_block gb; struct glyph_cachel *cachel; /* If the line is to be truncated then we actually have to look - for the next newline. We also add the end-of-line glyph which - we know will fit because we adjusted the right border before - we starting laying out the line. */ + for the next newline. We also add the end-of-line glyph which + we know will fit because we adjusted the right border before + we starting laying out the line. */ data.max_pixpos += data.end_glyph_width; data.findex = default_face; gb.extent = Qnil; @@ -5369,8 +5368,8 @@ &prop, default_face); Dynarr_unlock (dla); /* we need to make sure that we continue along the line if there - is more left to display otherwise we just end up redisplaying - the same chunk over and over again. */ + is more left to display otherwise we just end up redisplaying + the same chunk over and over again. */ if (next_pos == start_pos && next_pos < s_zv) start_pos++; else @@ -5547,7 +5546,7 @@ ypos = dlp->ypos + dlp->descent; /* See if we've been asked to start midway through a line, for - partial display line scrolling. */ + partial display line scrolling. */ if (yclip) { dlp->top_clip = yclip; @@ -5579,8 +5578,8 @@ if (dlp->cursor_elt != -1) { /* #### This check is steaming crap. Have to get things - fixed so when create_text_block hits EOB, we're done, - period. */ + fixed so when create_text_block hits EOB, we're done, + period. */ if (w->last_point_x[type] == -1) { w->last_point_x[type] = dlp->cursor_elt; @@ -5589,7 +5588,7 @@ else { /* #### This means that we've added a cursor at EOB - twice. Yuck oh yuck. */ + twice. Yuck oh yuck. */ struct display_block *db; Dynarr_lock (dla); @@ -5635,7 +5634,7 @@ if (need_modeline) { /* We know that this is the right thing to use because we put it - there when we first started working in this function. */ + there when we first started working in this function. */ generate_modeline (w, Dynarr_atp (dla, 0), type); } @@ -5729,7 +5728,7 @@ if (redisplay_move_cursor (w, pointm, WINDOW_TTY_P (w))) { /* Always regenerate the modeline in case it is - displaying the current line or column. */ + displaying the current line or column. */ regenerate_modeline (w); success = 1; } @@ -5814,8 +5813,8 @@ old_end = ddl->end_charpos + ddl->offset; /* If this is the first line being updated and it used - propagation data, fail. Otherwise we'll be okay because - we'll have the necessary propagation data. */ + propagation data, fail. Otherwise we'll be okay because + we'll have the necessary propagation data. */ if (line == first_line && ddl->used_prop_data) return 0; @@ -5824,9 +5823,9 @@ ddl->offset = 0; /* #### If there is propagated stuff the fail. We could - probably actually deal with this if the line had propagated - information when originally created by a full - regeneration. */ + probably actually deal with this if the line had propagated + information when originally created by a full + regeneration. */ if (prop) { Dynarr_free (prop); @@ -5834,7 +5833,7 @@ } /* If any line position parameters have changed or a - cursor has disappeared or disappeared, fail. */ + cursor has disappeared or disappeared, fail. */ db = get_display_block_from_line (ddl, TEXT); if (cdl->ypos != ddl->ypos || cdl->ascent != ddl->ascent @@ -5858,7 +5857,7 @@ last_line = line; /* If the extent changes end on the line we just updated then - we're done. Otherwise go on to the next line. */ + we're done. Otherwise go on to the next line. */ if (end_unchanged <= ddl->end_charpos) break; else @@ -5975,7 +5974,7 @@ ddl->offset = 0; /* If there is propagated stuff then it is pretty much a - guarantee that more than just the one line is affected. */ + guarantee that more than just the one line is affected. */ if (prop) { Dynarr_free (prop); @@ -5987,7 +5986,7 @@ return 0; /* If any line position parameters have changed or a - cursor has disappeared or disappeared, fail. */ + cursor has disappeared or disappeared, fail. */ if (cdl->ypos != ddl->ypos || cdl->ascent != ddl->ascent || cdl->descent != ddl->descent @@ -5999,7 +5998,7 @@ } /* If the changed area also ends on this line, then we may be in - business. Update everything and return success. */ + business. Update everything and return success. */ if (end_unchanged >= ddl->charpos && end_unchanged <= ddl->end_charpos) { w->last_modified[DESIRED_DISP] = make_int (BUF_MODIFF (b)); @@ -6019,13 +6018,13 @@ regenerate_modeline (w); /* #### For now we just flush the cache until this has been - tested. After that is done, this should correct the - cache directly. */ + tested. After that is done, this should correct the + cache directly. */ Dynarr_reset (w->line_start_cache); /* Adjust the extent changed boundaries to remove any - overlap with the buffer changes since we've just - successfully updated that area. */ + overlap with the buffer changes since we've just + successfully updated that area. */ if (extent_beg_unchanged != -1 && extent_beg_unchanged >= beg_unchanged && extent_beg_unchanged < end_unchanged) @@ -6040,9 +6039,9 @@ extent_beg_unchanged = extent_end_unchanged = -1; /* This could lead to odd results if it fails, but since the - buffer changes update succeeded this probably will to. - We already know that the extent changes start at or after - the line because we checked before entering the loop. */ + buffer changes update succeeded this probably will to. + We already know that the extent changes start at or after + the line because we checked before entering the loop. */ if (extent_beg_unchanged != -1 && extent_end_unchanged != -1 && ((extent_beg_unchanged < ddl->charpos) @@ -6253,8 +6252,8 @@ if (echo_active) { old_pointm = selected_globally - ? BUF_PT (b) - : marker_position (w->pointm[CURRENT_DISP]); + ? BUF_PT (b) + : marker_position (w->pointm[CURRENT_DISP]); pointm = 1; } else @@ -6343,7 +6342,7 @@ the_buffer); /* #### BUFU amounts of overkill just to get the cursor - location marked properly. FIX ME FIX ME FIX ME */ + location marked properly. FIX ME FIX ME FIX ME */ regenerate_window (w, startp, pointm, DESIRED_DISP); } @@ -6356,7 +6355,7 @@ && XINT (w->last_facechange[CURRENT_DISP]) >= BUF_FACECHANGE (b) && pointm >= startp /* This check is to make sure we restore the minibuffer after a - temporary change to the echo area. */ + temporary change to the echo area. */ && !(MINI_WINDOW_P (w) && f->buffers_changed) && !f->frame_changed && !truncation_changed @@ -6388,8 +6387,8 @@ else { /* If the new point is visible in the redisplay structures, - then let the output update routines handle it, otherwise - do things the hard way. */ + then let the output update routines handle it, otherwise + do things the hard way. */ if (!w->windows_changed && !f->clip_changed && !f->extents_changed @@ -6406,7 +6405,7 @@ if (redisplay_move_cursor (w, pointm, FRAME_TTY_P (f))) { /* Always regenerate in case it is displaying - the current line or column. */ + the current line or column. */ regenerate_modeline (w); skip_output = 1; @@ -6424,7 +6423,7 @@ } /* If we weren't able to take the shortcut method, then use - the brute force method. */ + the brute force method. */ regenerate_window (w, startp, pointm, DESIRED_DISP); if (point_visible (w, pointm, DESIRED_DISP)) @@ -6713,11 +6712,11 @@ it was typical to call it at the end of a critical section (which occurs once per frame); but what then happens if multiple frames have frame changes held up? - + This means we are O(N^2) over frames. I seriously doubt it matters. --ben */ Lisp_Object frmcons, devcons, concons; - + FRAME_LOOP_NO_BREAK (frmcons, devcons, concons) { struct frame *f = XFRAME (XCAR (frmcons)); @@ -7031,11 +7030,11 @@ } /* If the frame redisplay did not get preempted, then this flag - should have gotten set to 0. It might be possible for that - not to happen if a size change event were to occur at an odd - time. To make sure we don't miss anything we simply don't - reset the top level flags until the condition ends up being - in the right state. */ + should have gotten set to 0. It might be possible for that + not to happen if a size change event were to occur at an odd + time. To make sure we don't miss anything we simply don't + reset the top level flags until the condition ends up being + in the right state. */ if (f->size_changed) size_change_failed = 1; } @@ -7163,7 +7162,7 @@ !inhibit_warning_display) { /* If an error occurs during this function, oh well. - If we report another warning, we could get stuck in an + If we report another warning, we could get stuck in an infinite loop reporting warnings. */ call0_trapping_problems (0, Qdisplay_warning_buffer, @@ -7253,9 +7252,9 @@ /* print the current column */ case 'c': { - Charbpos pt = (w == XWINDOW (Fselected_window (Qnil))) - ? BUF_PT (b) - : marker_position (w->pointm[type]); + Charbpos pt = (w == XWINDOW (Fselected_window (Qnil))) + ? BUF_PT (b) + : marker_position (w->pointm[type]); int col = column_at_point (b, pt, 1) + !!column_number_start_at_one; char buf[DECIMAL_PRINT_SIZE (long)]; @@ -7269,14 +7268,14 @@ /* print the file coding system */ case 'C': { - Lisp_Object codesys = b->buffer_file_coding_system; - /* Be very careful here not to get an error. */ + Lisp_Object codesys = b->buffer_file_coding_system; + /* Be very careful here not to get an error. */ if (NILP (codesys) || SYMBOLP (codesys) || CODING_SYSTEMP (codesys)) - { - codesys = find_coding_system_for_text_file (codesys, 0); + { + codesys = find_coding_system_for_text_file (codesys, 0); if (CODING_SYSTEMP (codesys)) - obj = XCODING_SYSTEM_MNEMONIC (codesys); - } + obj = XCODING_SYSTEM_MNEMONIC (codesys); + } } break; @@ -7323,7 +7322,7 @@ break; /* print * or hyphen -- XEmacs change to allow a buffer to be - read-only but still indicate whether it is modified. */ + read-only but still indicate whether it is modified. */ case '+': str = ((BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) ? "*" @@ -7333,7 +7332,7 @@ break; /* #### defined in 19.29 decode_mode_spec, but not in - modeline-format doc string. */ + modeline-format doc string. */ /* This differs from %* in that it ignores read-only-ness. */ case '&': str = ((BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) @@ -7379,7 +7378,7 @@ else { /* This hard limit is ok since the string it will hold has a - fixed maximum length of 3. But just to be safe... */ + fixed maximum length of 3. But just to be safe... */ char buf[10]; Charcount chars = pos - BUF_BEGV (b); Charcount total = BUF_ZV (b) - BUF_BEGV (b); @@ -7390,7 +7389,7 @@ (chars * 100 + total/2) / total; /* We can't normally display a 3-digit number, so get us a - 2-digit number that is close. */ + 2-digit number that is close. */ if (percent == 100) percent = 99; @@ -7411,8 +7410,8 @@ Charbpos botpos = BUF_Z (b) - w->window_end_pos[type]; /* botpos is only accurate as of the last redisplay, so we can - only treat it as a hint. In particular, after erase-buffer, - botpos may be negative. */ + only treat it as a hint. In particular, after erase-buffer, + botpos may be negative. */ if (botpos < toppos) botpos = toppos; @@ -7426,7 +7425,7 @@ else { /* This hard limit is ok since the string it will hold has a - fixed maximum length of around 6. But just to be safe... */ + fixed maximum length of around 6. But just to be safe... */ char buf[10]; Charcount chars = botpos - BUF_BEGV (b); Charcount total = BUF_ZV (b) - BUF_BEGV (b); @@ -7437,7 +7436,7 @@ (chars * 100 + total/2) / max (total, 1); /* We can't normally display a 3-digit number, so get us a - 2-digit number that is close. */ + 2-digit number that is close. */ if (percent == 100) percent = 99; @@ -7520,7 +7519,7 @@ if (dl->display_blocks) { for (block = 0; block < Dynarr_largest (dl->display_blocks); block++) - { + { struct display_block *db = Dynarr_atp (dl->display_blocks, block); Dynarr_free (db->runes); @@ -7688,16 +7687,16 @@ if (!w->line_cache_validation_override) { /* f->extents_changed used to be in here because extent face and - size changes can cause text shifting. However, the extent - covering the region is constantly having its face set and - priority altered by the mouse code. This means that the line - start cache is constantly being invalidated. This is bad - since the mouse code also triggers heavy usage of the cache. - Since it is an unlikely that f->extents being changed - indicates that the cache really needs to be updated and if it - does redisplay will catch it pretty quickly we no longer - invalidate the cache if it is set. This greatly speeds up - dragging out regions with the mouse. */ + size changes can cause text shifting. However, the extent + covering the region is constantly having its face set and + priority altered by the mouse code. This means that the line + start cache is constantly being invalidated. This is bad + since the mouse code also triggers heavy usage of the cache. + Since it is an unlikely that f->extents being changed + indicates that the cache really needs to be updated and if it + does redisplay will catch it pretty quickly we no longer + invalidate the cache if it is set. This greatly speeds up + dragging out regions with the mouse. */ if (XINT (w->line_cache_last_updated) < BUF_MODIFF (b) || f->faces_changed || f->clip_changed) @@ -7769,8 +7768,8 @@ int win_char_height = window_char_height (w, 1); /* Occasionally we get here with a 0 height - window. find_next_newline_no_quit will abort if we pass it a - count of 0 so handle that case. */ + window. find_next_newline_no_quit will abort if we pass it a + count of 0 so handle that case. */ if (!win_char_height) win_char_height = 1; @@ -7983,7 +7982,7 @@ window_char_height (w, 0)); /* We've already actually processed old_startp, so increment - immediately. */ + immediately. */ start_elt++; /* If this happens we didn't add any extra elements. Bummer. */ @@ -8032,7 +8031,7 @@ static Charbpos start_end_of_last_line (struct window *w, Charbpos startp, int end, - int may_error) + int may_error) { struct buffer *b = XBUFFER (w->buffer); line_start_cache_dynarr *cache = w->line_start_cache; @@ -8168,7 +8167,7 @@ pixheight -= Dynarr_atp (w->line_start_cache, cur_elt)->height; /* Do not take into account the value of vertical_clip here. - That is the responsibility of the calling functions. */ + That is the responsibility of the calling functions. */ if (pixheight < 0) { w->line_cache_validation_override--; @@ -8248,18 +8247,18 @@ else { /* The calculated value of pixpos is correct for the bottom line - or what we want when line is -1. Therefore we subtract one - because we have already handled one line. */ + or what we want when line is -1. Therefore we subtract one + because we have already handled one line. */ int new_line = -line - 1; int cur_elt = point_in_line_start_cache (w, point, new_line); int pixpos = WINDOW_TEXT_BOTTOM (w); Charbpos retval, search_point; /* If scroll_on_clipped_lines is false, the last "visible" line of - the window covers the pixel at WINDOW_TEXT_BOTTOM (w) - 1. - If s_o_c_l is true, then we don't want to count a clipped - line, so back up from the bottom by the height of the line - containing point. */ + the window covers the pixel at WINDOW_TEXT_BOTTOM (w) - 1. + If s_o_c_l is true, then we don't want to count a clipped + line, so back up from the bottom by the height of the line + containing point. */ if (scroll_on_clipped_lines) pixpos -= Dynarr_atp (w->line_start_cache, cur_elt)->height; else @@ -8376,15 +8375,15 @@ Dynarr_atp (internal_cache, Dynarr_length (internal_cache) - 1)->end; /* We aren't allowed to generate additional information to fill in - gaps, so if the DESIRED structs don't overlap the cache, reset the - cache. */ + gaps, so if the DESIRED structs don't overlap the cache, reset the + cache. */ if (Dynarr_length (cache)) { if (end < low_bound || start > high_bound) Dynarr_reset (cache); /* #### What should really happen if what we are doing is - extending a line (the last line)? */ + extending a line (the last line)? */ if (Dynarr_length (cache) == 1 && Dynarr_length (internal_cache) == 1) Dynarr_reset (cache); @@ -8399,7 +8398,7 @@ } /* An extra check just in case the calling function didn't pass in - the bounds of the DESIRED structs in the first place. */ + the bounds of the DESIRED structs in the first place. */ if (start >= low_bound && end <= high_bound) { w->line_cache_validation_override--; @@ -8407,7 +8406,7 @@ } /* At this point we know that the internal cache partially overlaps - the main cache. */ + the main cache. */ if (start < low_bound) { int ic_elt = Dynarr_length (internal_cache) - 1; @@ -8470,13 +8469,13 @@ while (startp < old_lb || low_bound == -1) { int ic_elt; - Charbpos new_startp; + Charbpos new_startp; regenerate_window (w, startp, point, CMOTION_DISP); update_internal_cache_list (w, CMOTION_DISP); /* If this assert is triggered then regenerate_window failed - to layout a single line. This is not possible since we + to layout a single line. This is not possible since we force at least a single line to be layout for CMOTION_DISP */ assert (Dynarr_length (internal_cache)); assert (startp == Dynarr_atp (internal_cache, 0)->start); @@ -8496,28 +8495,28 @@ new_startp = Dynarr_atp (internal_cache, ic_elt)->end + 1; - /* - * Handle invisible text properly: - * If the last line we're inserting has the same end as the - * line before which it will be added, merge the two lines. - */ - if (Dynarr_length (cache) && - Dynarr_atp (internal_cache, ic_elt)->end == - Dynarr_atp (cache, marker)->end) - { - Dynarr_atp (cache, marker)->start - = Dynarr_atp (internal_cache, ic_elt)->start; - Dynarr_atp (cache, marker)->height - = Dynarr_atp (internal_cache, ic_elt)->height; - ic_elt--; - } - - if (ic_elt >= 0) /* we still have lines to add.. */ - { - Dynarr_insert_many (cache, Dynarr_atp (internal_cache, 0), - ic_elt + 1, marker); - marker += (ic_elt + 1); - } + /* + * Handle invisible text properly: + * If the last line we're inserting has the same end as the + * line before which it will be added, merge the two lines. + */ + if (Dynarr_length (cache) && + Dynarr_atp (internal_cache, ic_elt)->end == + Dynarr_atp (cache, marker)->end) + { + Dynarr_atp (cache, marker)->start + = Dynarr_atp (internal_cache, ic_elt)->start; + Dynarr_atp (cache, marker)->height + = Dynarr_atp (internal_cache, ic_elt)->height; + ic_elt--; + } + + if (ic_elt >= 0) /* we still have lines to add.. */ + { + Dynarr_insert_many (cache, Dynarr_atp (internal_cache, 0), + ic_elt + 1, marker); + marker += (ic_elt + 1); + } if (startp < low_bound || low_bound == -1) low_bound = startp; @@ -8983,7 +8982,7 @@ if (MINI_WINDOW_P (*w) && !minibuf_level) { /* Must reset the window value since some callers will ignore - the return value if it is set. */ + the return value if it is set. */ *w = 0; UPDATE_CACHE_RETURN; } @@ -9087,10 +9086,10 @@ || x_coord >= dl->bounds.right_in) { /* If we are over the outside margins then we - know the loop over the text block isn't going - to accomplish anything. So we go ahead and - set what information we can right here and - return. */ + know the loop over the text block isn't going + to accomplish anything. So we go ahead and + set what information we can right here and + return. */ (*row)--; *obj_y = y_coord - (dl->ypos - dl->ascent); get_position_object (dl, obj1, obj2, x_coord, @@ -9147,8 +9146,8 @@ } /* In this case we failed to find a non-glyph - character so we return the last position - displayed on the line. */ + character so we return the last position + displayed on the line. */ if (elt == Dynarr_length (db->runes)) { if (dl->modeline) @@ -9197,7 +9196,7 @@ { (*row)--; /* At this point we may have glyphs in the right - inside margin. */ + inside margin. */ if (check_margin_glyphs) get_position_object (dl, obj1, obj2, x_coord, &low_x_coord, &high_x_coord); @@ -9226,7 +9225,7 @@ *obj_y = y_coord - (dl->ypos - dl->ascent); /* At this point we may have glyphs in the left - inside margin. */ + inside margin. */ if (check_margin_glyphs) get_position_object (dl, obj1, obj2, x_coord, 0, 0); @@ -9687,7 +9686,7 @@ display_line_dynarr *dl; dl = window_display_lines (w, CURRENT_DISP); - + for (i = 0; i < Dynarr_largest (dl); i++) for (j = i + 1; j < Dynarr_largest (dl); j++) assert (Dynarr_atp (dl, i)->display_blocks !=