X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/a2709514e606b5bb03b0c8dfcc12aaa3dcf72a22..18ab493650d648ab8dca651ea2698861f926e895:/src/xdisp.c diff --git a/src/xdisp.c b/src/xdisp.c index 8b164008c3..d44e677eeb 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -2478,10 +2478,7 @@ init_iterator (struct it *it, struct window *w, else if (INTEGERP (w->redisplay_end_trigger)) it->redisplay_end_trigger_charpos = XINT (w->redisplay_end_trigger); - /* Correct bogus values of tab_width. */ - it->tab_width = XINT (BVAR (current_buffer, tab_width)); - if (it->tab_width <= 0 || it->tab_width > 1000) - it->tab_width = 8; + it->tab_width = SANE_TAB_WIDTH (current_buffer); /* Are lines in the display truncated? */ if (base_face_id != DEFAULT_FACE_ID @@ -3137,7 +3134,7 @@ next_overlay_change (EMACS_INT pos) /* Record one cached display string position found recently by compute_display_string_pos. */ static EMACS_INT cached_disp_pos; -static EMACS_INT cached_prev_pos; +static EMACS_INT cached_prev_pos = -1; static struct buffer *cached_disp_buffer; static int cached_disp_modiff; static int cached_disp_overlay_modiff; @@ -3182,20 +3179,25 @@ compute_display_string_pos (struct text_pos *position, b = XBUFFER (object); if (b == cached_disp_buffer && BUF_MODIFF (b) == cached_disp_modiff - && BUF_OVERLAY_MODIFF (b) == cached_disp_overlay_modiff) + && BUF_OVERLAY_MODIFF (b) == cached_disp_overlay_modiff + && !b->clip_changed) { - if (cached_prev_pos + if (cached_prev_pos >= 0 && cached_prev_pos < charpos && charpos <= cached_disp_pos) return cached_disp_pos; /* Handle overstepping either end of the known interval. */ if (charpos > cached_disp_pos) cached_prev_pos = cached_disp_pos; else /* charpos <= cached_prev_pos */ - cached_prev_pos = max (charpos - 1, BEGV); + cached_prev_pos = max (charpos - 1, 0); } /* Record new values in the cache. */ - cached_disp_buffer = b; + if (b != cached_disp_buffer) + { + cached_disp_buffer = b; + cached_prev_pos = max (charpos - 1, 0); + } cached_disp_modiff = BUF_MODIFF (b); cached_disp_overlay_modiff = BUF_OVERLAY_MODIFF (b); } @@ -8838,7 +8840,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte) if (nlflag) { EMACS_INT this_bol, this_bol_byte, prev_bol, prev_bol_byte; - intmax_t dups; + printmax_t dups; insert_1 ("\n", 1, 1, 0, 0); scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, -2, 0); @@ -8862,12 +8864,12 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte) if (dups > 1) { char dupstr[sizeof " [ times]" - + INT_STRLEN_BOUND (intmax_t)]; + + INT_STRLEN_BOUND (printmax_t)]; int duplen; /* If you change this format, don't forget to also change message_log_check_duplicate. */ - sprintf (dupstr, " [%"PRIdMAX" times]", dups); + sprintf (dupstr, " [%"pMd" times]", dups); duplen = strlen (dupstr); TEMP_SET_PT_BOTH (Z - 1, Z_BYTE - 1); insert_1 (dupstr, duplen, 1, 0, 1); @@ -9260,7 +9262,7 @@ vmessage (const char *m, va_list ap) { if (m) { - size_t len; + ptrdiff_t len; len = doprnt (FRAME_MESSAGE_BUF (f), FRAME_MESSAGE_BUF_SIZE (f), m, (char *)0, ap); @@ -10385,8 +10387,12 @@ store_mode_line_noprop_char (char c) double the buffer's size. */ if (mode_line_noprop_ptr == mode_line_noprop_buf_end) { - int len = MODE_LINE_NOPROP_LEN (0); - int new_size = 2 * len * sizeof *mode_line_noprop_buf; + ptrdiff_t len = MODE_LINE_NOPROP_LEN (0); + ptrdiff_t new_size; + + if (STRING_BYTES_BOUND / 2 < len) + memory_full (SIZE_MAX); + new_size = 2 * len; mode_line_noprop_buf = (char *) xrealloc (mode_line_noprop_buf, new_size); mode_line_noprop_buf_end = mode_line_noprop_buf + new_size; mode_line_noprop_ptr = mode_line_noprop_buf + len; @@ -10450,9 +10456,9 @@ x_consider_frame_title (Lisp_Object frame) /* Do we have more than one visible frame on this X display? */ Lisp_Object tail; Lisp_Object fmt; - int title_start; + ptrdiff_t title_start; char *title; - int len; + ptrdiff_t len; struct it it; int count = SPECPDL_INDEX (); @@ -21263,7 +21269,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop, if (FRAME_WINDOW_P (it->f) && valid_image_p (prop)) { - int id = lookup_image (it->f, prop); + ptrdiff_t id = lookup_image (it->f, prop); struct image *img = IMAGE_FROM_ID (it->f, id); return OK_PIXELS (width_p ? img->width : img->height); @@ -22135,7 +22141,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p) do { \ int face_id = (row)->glyphs[area][START].face_id; \ struct face *base_face = FACE_FROM_ID (f, face_id); \ - int cmp_id = (row)->glyphs[area][START].u.cmp.id; \ + ptrdiff_t cmp_id = (row)->glyphs[area][START].u.cmp.id; \ struct composition *cmp = composition_table[cmp_id]; \ XChar2b *char2b; \ struct glyph_string *first_s IF_LINT (= NULL); \