From 6b682d2b398b241fe32fe98104ef0a58ec20bde9 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 15 Sep 2014 18:25:54 +0300 Subject: Fix display of R2L lines in partial-width windows. src/xdisp.c (init_iterator): Don't use it->bidi_p before it is assigned the correct value. (extend_face_to_end_of_line): Account for truncation and continuation glyphs in R2L rows when one of the fringes is not displayed. (display_line): Don't assign negative X offset to a row if we are going to produce a truncation glyph for it. When handling truncated R2L rows, consider the width of the left fringe instead of the right one. (produce_special_glyphs): Fix bogus assignments. --- src/ChangeLog | 14 ++++++++++++++ src/xdisp.c | 56 +++++++++++++++++++++++++++++++++++++++++++------------- 2 files changed, 57 insertions(+), 13 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index c32b4c4498..09b606d1dd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,17 @@ +2014-09-15 Eli Zaretskii + + Fix display of R2L lines in partial-width windows. + * xdisp.c (init_iterator): Don't use it->bidi_p before it is + assigned the correct value. + (extend_face_to_end_of_line): Account for truncation and + continuation glyphs in R2L rows when one of the fringes is not + displayed. + (display_line): Don't assign negative X offset to a row if we are + going to produce a truncation glyph for it. When handling + truncated R2L rows, consider the width of the left fringe instead + of the right one. + (produce_special_glyphs): Fix bogus assignments. + 2014-09-14 Eli Zaretskii * w32.c (fcntl): Support O_NONBLOCK fcntl on the write side of diff --git a/src/xdisp.c b/src/xdisp.c index 6b327c8429..909349b81b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -2994,12 +2994,8 @@ init_iterator (struct it *it, struct window *w, /* If we truncate lines, leave room for the truncation glyph(s) at the right margin. Otherwise, leave room for the continuation - glyph(s). Done only if the window has no fringes. Since we - don't know at this point whether there will be any R2L lines in - the window, we reserve space for truncation/continuation glyphs - even if only one of the fringes is absent. */ - if (WINDOW_RIGHT_FRINGE_WIDTH (it->w) == 0 - || (it->bidi_p && WINDOW_LEFT_FRINGE_WIDTH (it->w) == 0)) + glyph(s). Done only if the window has no right fringe. */ + if (WINDOW_RIGHT_FRINGE_WIDTH (it->w) == 0) { if (it->line_wrap == TRUNCATE) it->last_visible_x -= it->truncation_pixel_width; @@ -3064,6 +3060,19 @@ init_iterator (struct it *it, struct window *w, iterator. */ if (it->bidi_p) { + /* Since we don't know at this point whether there will be + any R2L lines in the window, we reserve space for + truncation/continuation glyphs even if only the left + fringe is absent. */ + if (base_face_id == DEFAULT_FACE_ID + && WINDOW_LEFT_FRINGE_WIDTH (it->w) == 0 + && WINDOW_RIGHT_FRINGE_WIDTH (it->w) != 0) + { + if (it->line_wrap == TRUNCATE) + it->last_visible_x -= it->truncation_pixel_width; + else + it->last_visible_x -= it->continuation_pixel_width; + } /* Note the paragraph direction that this buffer wants to use. */ if (EQ (BVAR (current_buffer, bidi_paragraph_direction), @@ -19334,7 +19343,18 @@ extend_face_to_end_of_line (struct it *it) for (row_width = 0, g = row_start; g < row_end; g++) row_width += g->pixel_width; - stretch_width = window_box_width (it->w, TEXT_AREA) - row_width; + + /* FIXME: There are various minor display glitches in R2L + rows when only one of the fringes is missing. The + strange condition below produces the least bad effect. */ + if ((WINDOW_LEFT_FRINGE_WIDTH (it->w) == 0) + == (WINDOW_RIGHT_FRINGE_WIDTH (it->w) == 0) + || WINDOW_RIGHT_FRINGE_WIDTH (it->w) != 0) + stretch_width = window_box_width (it->w, TEXT_AREA); + else + stretch_width = it->last_visible_x - it->first_visible_x; + stretch_width -= row_width; + if (stretch_width > 0) { stretch_ascent = @@ -20475,9 +20495,17 @@ display_line (struct it *it) /* When the last glyph of an R2L row only fits partially on the line, we need to set row->x to a negative offset, so that the leftmost glyph is - the one that is partially visible. */ - if (row->reversed_p && new_x > it->last_visible_x) - row->x = it->last_visible_x - new_x; + the one that is partially visible. But if we are + going to produce the truncation glyph, this will + be taken care of in produce_special_glyphs. */ + if (row->reversed_p + && new_x > it->last_visible_x + && !(it->line_wrap == TRUNCATE + && WINDOW_LEFT_FRINGE_WIDTH (it->w) == 0)) + { + eassert (FRAME_WINDOW_P (it->f)); + row->x = it->last_visible_x - new_x; + } } else { @@ -20551,7 +20579,10 @@ display_line (struct it *it) that they are cropped at the right edge of the window, so an image glyph will always end exactly at last_visible_x, even if there's no right fringe. */ - && (WINDOW_RIGHT_FRINGE_WIDTH (it->w) || it->what == IT_IMAGE)) + && ((row->reversed_p + ? WINDOW_LEFT_FRINGE_WIDTH (it->w) + : WINDOW_RIGHT_FRINGE_WIDTH (it->w)) + || it->what == IT_IMAGE)) ? (it->current_x >= it->last_visible_x) : (it->current_x > it->last_visible_x))) { @@ -25719,14 +25750,13 @@ produce_special_glyphs (struct it *it, enum display_element_type what) temp_it.dp = NULL; temp_it.what = IT_CHARACTER; - temp_it.len = 1; temp_it.c = temp_it.char_to_display = GLYPH_CHAR (glyph); temp_it.face_id = GLYPH_FACE (glyph); temp_it.len = CHAR_BYTES (temp_it.c); PRODUCE_GLYPHS (&temp_it); it->pixel_width = temp_it.pixel_width; - it->nglyphs = temp_it.pixel_width; + it->nglyphs = temp_it.nglyphs; } #ifdef HAVE_WINDOW_SYSTEM -- cgit v1.2.3 From 2d83441cc06cca6706dc9b102598d1bf6fe7612b Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 15 Sep 2014 18:29:40 +0300 Subject: src/dispextern.h: Commentary fix. --- src/dispextern.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dispextern.h b/src/dispextern.h index 46ed99844e..576f22870c 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -2530,7 +2530,9 @@ struct it /* First and last visible x-position in the display area. If window is hscrolled by n columns, first_visible_x == n * FRAME_COLUMN_WIDTH - (f), and last_visible_x == pixel width of W + first_visible_x. */ + (f), and last_visible_x == pixel width of W + first_visible_x. + When truncation or continuation glyphs are produced due to lack of + fringes, last_visible_x excludes the space required for these glyphs. */ int first_visible_x, last_visible_x; /* Last visible y-position + 1 in the display area without a mode -- cgit v1.2.3 From ccb767d639543d70ac689c93eb64849eea376583 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Tue, 16 Sep 2014 08:04:56 +0400 Subject: Always use matched specpdl entry to record call arguments (Bug#18473). * lisp.h (record_in_backtrace): Adjust prototype. * eval.c (record_in_backtrace): Return current specpdl level. (set_backtrace_args, set_backtrace_nargs): Merge. Adjust all users. (eval_sub, Ffuncall): Record call arguments in matched specpdl entry and use that entry in call to backtrace_debug_on_exit. (apply_lambda): Likewise. Get current specpdl level as 3rd arg. (do_debug_on_call): Get current specpdl level as 2nd arg. --- src/ChangeLog | 11 +++++++++++ src/eval.c | 60 ++++++++++++++++++++++++++++------------------------------- src/lisp.h | 3 +-- 3 files changed, 40 insertions(+), 34 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 09b606d1dd..fe771fd8f7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2014-09-16 Dmitry Antipov + + Always use matched specpdl entry to record call arguments (Bug#18473). + * lisp.h (record_in_backtrace): Adjust prototype. + * eval.c (record_in_backtrace): Return current specpdl level. + (set_backtrace_args, set_backtrace_nargs): Merge. Adjust all users. + (eval_sub, Ffuncall): Record call arguments in matched specpdl + entry and use that entry in call to backtrace_debug_on_exit. + (apply_lambda): Likewise. Get current specpdl level as 3rd arg. + (do_debug_on_call): Get current specpdl level as 2nd arg. + 2014-09-15 Eli Zaretskii Fix display of R2L lines in partial-width windows. diff --git a/src/eval.c b/src/eval.c index 5e986c7ecc..929b98e9f7 100644 --- a/src/eval.c +++ b/src/eval.c @@ -111,7 +111,7 @@ union specbinding *backtrace_next (union specbinding *) EXTERNALLY_VISIBLE; union specbinding *backtrace_top (void) EXTERNALLY_VISIBLE; static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *); -static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args); +static Lisp_Object apply_lambda (Lisp_Object, Lisp_Object, ptrdiff_t); static Lisp_Object specpdl_symbol (union specbinding *pdl) @@ -179,17 +179,11 @@ backtrace_debug_on_exit (union specbinding *pdl) /* Functions to modify slots of backtrace records. */ static void -set_backtrace_args (union specbinding *pdl, Lisp_Object *args) +set_backtrace_args (union specbinding *pdl, Lisp_Object *args, ptrdiff_t nargs) { eassert (pdl->kind == SPECPDL_BACKTRACE); pdl->bt.args = args; -} - -static void -set_backtrace_nargs (union specbinding *pdl, ptrdiff_t n) -{ - eassert (pdl->kind == SPECPDL_BACKTRACE); - pdl->bt.nargs = n; + pdl->bt.nargs = nargs; } static void @@ -341,10 +335,10 @@ call_debugger (Lisp_Object arg) } static void -do_debug_on_call (Lisp_Object code) +do_debug_on_call (Lisp_Object code, ptrdiff_t count) { debug_on_next_call = 0; - set_backtrace_debug_on_exit (specpdl_ptr - 1, true); + set_backtrace_debug_on_exit (specpdl + count, true); call_debugger (list1 (code)); } @@ -2039,9 +2033,11 @@ grow_specpdl (void) } } -void +ptrdiff_t record_in_backtrace (Lisp_Object function, Lisp_Object *args, ptrdiff_t nargs) { + ptrdiff_t count = SPECPDL_INDEX (); + eassert (nargs >= UNEVALLED); specpdl_ptr->bt.kind = SPECPDL_BACKTRACE; specpdl_ptr->bt.debug_on_exit = false; @@ -2049,6 +2045,8 @@ record_in_backtrace (Lisp_Object function, Lisp_Object *args, ptrdiff_t nargs) specpdl_ptr->bt.args = args; specpdl_ptr->bt.nargs = nargs; grow_specpdl (); + + return count; } /* Eval a sub-expression of the current expression (i.e. in the same @@ -2059,6 +2057,7 @@ eval_sub (Lisp_Object form) Lisp_Object fun, val, original_fun, original_args; Lisp_Object funcar; struct gcpro gcpro1, gcpro2, gcpro3; + ptrdiff_t count; if (SYMBOLP (form)) { @@ -2096,10 +2095,10 @@ eval_sub (Lisp_Object form) original_args = XCDR (form); /* This also protects them from gc. */ - record_in_backtrace (original_fun, &original_args, UNEVALLED); + count = record_in_backtrace (original_fun, &original_args, UNEVALLED); if (debug_on_next_call) - do_debug_on_call (Qt); + do_debug_on_call (Qt, count); /* At this point, only original_fun and original_args have values that will be used below. */ @@ -2151,8 +2150,7 @@ eval_sub (Lisp_Object form) gcpro3.nvars = argnum; } - set_backtrace_args (specpdl_ptr - 1, vals); - set_backtrace_nargs (specpdl_ptr - 1, XINT (numargs)); + set_backtrace_args (specpdl + count, vals, XINT (numargs)); val = (XSUBR (fun)->function.aMANY) (XINT (numargs), vals); UNGCPRO; @@ -2173,8 +2171,7 @@ eval_sub (Lisp_Object form) UNGCPRO; - set_backtrace_args (specpdl_ptr - 1, argvals); - set_backtrace_nargs (specpdl_ptr - 1, XINT (numargs)); + set_backtrace_args (specpdl + count, argvals, XINT (numargs)); switch (i) { @@ -2227,7 +2224,7 @@ eval_sub (Lisp_Object form) } } else if (COMPILEDP (fun)) - val = apply_lambda (fun, original_args); + val = apply_lambda (fun, original_args, count); else { if (NILP (fun)) @@ -2244,7 +2241,7 @@ eval_sub (Lisp_Object form) } if (EQ (funcar, Qmacro)) { - ptrdiff_t count = SPECPDL_INDEX (); + ptrdiff_t count1 = SPECPDL_INDEX (); Lisp_Object exp; /* Bind lexical-binding during expansion of the macro, so the macro can know reliably if the code it outputs will be @@ -2252,19 +2249,19 @@ eval_sub (Lisp_Object form) specbind (Qlexical_binding, NILP (Vinternal_interpreter_environment) ? Qnil : Qt); exp = apply1 (Fcdr (fun), original_args); - unbind_to (count, Qnil); + unbind_to (count1, Qnil); val = eval_sub (exp); } else if (EQ (funcar, Qlambda) || EQ (funcar, Qclosure)) - val = apply_lambda (fun, original_args); + val = apply_lambda (fun, original_args, count); else xsignal1 (Qinvalid_function, original_fun); } check_cons_list (); lisp_eval_depth--; - if (backtrace_debug_on_exit (specpdl_ptr - 1)) + if (backtrace_debug_on_exit (specpdl + count)) val = call_debugger (list2 (Qexit, val)); specpdl_ptr--; @@ -2747,7 +2744,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) Lisp_Object lisp_numargs; Lisp_Object val; register Lisp_Object *internal_args; - ptrdiff_t i; + ptrdiff_t i, count; QUIT; @@ -2760,13 +2757,13 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) } /* This also GCPROs them. */ - record_in_backtrace (args[0], &args[1], nargs - 1); + count = record_in_backtrace (args[0], &args[1], nargs - 1); /* Call GC after setting up the backtrace, so the latter GCPROs the args. */ maybe_gc (); if (debug_on_next_call) - do_debug_on_call (Qlambda); + do_debug_on_call (Qlambda, count); check_cons_list (); @@ -2885,14 +2882,14 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) } check_cons_list (); lisp_eval_depth--; - if (backtrace_debug_on_exit (specpdl_ptr - 1)) + if (backtrace_debug_on_exit (specpdl + count)) val = call_debugger (list2 (Qexit, val)); specpdl_ptr--; return val; } static Lisp_Object -apply_lambda (Lisp_Object fun, Lisp_Object args) +apply_lambda (Lisp_Object fun, Lisp_Object args, ptrdiff_t count) { Lisp_Object args_left; ptrdiff_t i; @@ -2919,15 +2916,14 @@ apply_lambda (Lisp_Object fun, Lisp_Object args) UNGCPRO; - set_backtrace_args (specpdl_ptr - 1, arg_vector); - set_backtrace_nargs (specpdl_ptr - 1, i); + set_backtrace_args (specpdl + count, arg_vector, i); tem = funcall_lambda (fun, numargs, arg_vector); /* Do the debug-on-exit now, while arg_vector still exists. */ - if (backtrace_debug_on_exit (specpdl_ptr - 1)) + if (backtrace_debug_on_exit (specpdl + count)) { /* Don't do it again when we return to eval. */ - set_backtrace_debug_on_exit (specpdl_ptr - 1, false); + set_backtrace_debug_on_exit (specpdl + count, false); tem = call_debugger (list2 (Qexit, tem)); } SAFE_FREE (); diff --git a/src/lisp.h b/src/lisp.h index 2b632ad19f..0bcc0ec0e3 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3955,8 +3955,7 @@ extern Lisp_Object safe_call2 (Lisp_Object, Lisp_Object, Lisp_Object); extern void init_eval (void); extern void syms_of_eval (void); extern void unwind_body (Lisp_Object); -extern void record_in_backtrace (Lisp_Object function, - Lisp_Object *args, ptrdiff_t nargs); +extern ptrdiff_t record_in_backtrace (Lisp_Object, Lisp_Object *, ptrdiff_t); extern void mark_specpdl (void); extern void get_backtrace (Lisp_Object array); Lisp_Object backtrace_top_function (void); -- cgit v1.2.3 From 005aff709292db4fda0c39e7ed512f064bb7d1a9 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Tue, 16 Sep 2014 08:07:51 +0400 Subject: Prefer ptrdiff_t to int and avoid integer overflows. * fileio.c (make_temp_name): * font.c (font_parse_family_registry): Avoid integer overflow on string size calculation. * data.c (Faset): Likewise for byte index. --- src/ChangeLog | 6 ++++++ src/data.c | 2 +- src/fileio.c | 2 +- src/font.c | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index fe771fd8f7..915a53f7e6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -9,6 +9,12 @@ (apply_lambda): Likewise. Get current specpdl level as 3rd arg. (do_debug_on_call): Get current specpdl level as 2nd arg. + Prefer ptrdiff_t to int and avoid integer overflows. + * fileio.c (make_temp_name): + * font.c (font_parse_family_registry): Avoid integer + overflow on string size calculation. + * data.c (Faset): Likewise for byte index. + 2014-09-15 Eli Zaretskii Fix display of R2L lines in partial-width windows. diff --git a/src/data.c b/src/data.c index 5aeb24b16d..f02b4588ad 100644 --- a/src/data.c +++ b/src/data.c @@ -2248,7 +2248,7 @@ bool-vector. IDX starts at 0. */) { if (! SINGLE_BYTE_CHAR_P (c)) { - int i; + ptrdiff_t i; for (i = SBYTES (array) - 1; i >= 0; i--) if (SREF (array, i) >= 0x80) diff --git a/src/fileio.c b/src/fileio.c index 261928dd82..b4653017b2 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -733,7 +733,7 @@ Lisp_Object make_temp_name (Lisp_Object prefix, bool base64_p) { Lisp_Object val, encoded_prefix; - int len; + ptrdiff_t len; printmax_t pid; char *p, *data; char pidbuf[INT_BUFSIZE_BOUND (printmax_t)]; diff --git a/src/font.c b/src/font.c index afa138003f..470fa1adc1 100644 --- a/src/font.c +++ b/src/font.c @@ -1724,7 +1724,7 @@ font_parse_name (char *name, ptrdiff_t namelen, Lisp_Object font) void font_parse_family_registry (Lisp_Object family, Lisp_Object registry, Lisp_Object font_spec) { - int len; + ptrdiff_t len; char *p0, *p1; if (! NILP (family) -- cgit v1.2.3 From c20b4c2de5a8c5ef4ac0655d74dd28c002b7aad3 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 16 Sep 2014 18:44:51 +0300 Subject: Fix block cursor display in R2L lines. src/xterm.c (x_draw_stretch_glyph_string): src/w32term.c (x_draw_stretch_glyph_string): Fix a thinko that caused the block cursor to disappear on a TAB in R2L lines in every window except the leftmost one. Reported by Martin Rudalics . --- src/ChangeLog | 8 ++++++++ src/w32term.c | 2 +- src/xterm.c | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 915a53f7e6..49ff8efc79 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2014-09-16 Eli Zaretskii + + * xterm.c (x_draw_stretch_glyph_string): + * w32term.c (x_draw_stretch_glyph_string): Fix a thinko that + caused the block cursor to disappear on a TAB in R2L lines in + every window except the leftmost one. Reported by Martin Rudalics + . + 2014-09-16 Dmitry Antipov Always use matched specpdl entry to record call arguments (Bug#18473). diff --git a/src/w32term.c b/src/w32term.c index 2781fb63d6..e4813e9e02 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -2227,7 +2227,7 @@ x_draw_stretch_glyph_string (struct glyph_string *s) { /* In R2L rows, draw the cursor on the right edge of the stretch glyph. */ - int right_x = window_box_right_offset (s->w, TEXT_AREA); + int right_x = window_box_right (s->w, TEXT_AREA); if (x + background_width > right_x) background_width -= x - right_x; diff --git a/src/xterm.c b/src/xterm.c index 7723f1af77..f426755e40 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -2475,7 +2475,7 @@ x_draw_stretch_glyph_string (struct glyph_string *s) { /* In R2L rows, draw the cursor on the right edge of the stretch glyph. */ - int right_x = window_box_right_offset (s->w, TEXT_AREA); + int right_x = window_box_right (s->w, TEXT_AREA); if (x + background_width > right_x) background_width -= x - right_x; -- cgit v1.2.3 From 534f1f7cb6b25f05472d59b6b4757cb345f29b8d Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 16 Sep 2014 18:53:36 +0300 Subject: Fix display of hollow-box and hbar cursors on r2L lines. src/xterm.c (x_draw_hollow_cursor, x_draw_bar_cursor): src/w32term.c (x_draw_hollow_cursor, x_draw_bar_cursor): In R2L lines, draw the hollow-box and hbar cursors on the right side of cursor-glyph. Thanks to Martin Rudalics for testing on X. --- src/ChangeLog | 6 ++++++ src/w32term.c | 11 ++++++++++- src/xterm.c | 18 +++++++++++++++--- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 49ff8efc79..c86f6de157 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 2014-09-16 Eli Zaretskii + * xterm.c (x_draw_hollow_cursor, x_draw_bar_cursor): + * w32term.c (x_draw_hollow_cursor, x_draw_bar_cursor): In R2L + lines, draw the hollow-box and hbar cursors on the right side of + cursor-glyph. Thanks to martin rudalics for + testing on X. + * xterm.c (x_draw_stretch_glyph_string): * w32term.c (x_draw_stretch_glyph_string): Fix a thinko that caused the block cursor to disappear on a TAB in R2L lines in diff --git a/src/w32term.c b/src/w32term.c index e4813e9e02..5f15798eee 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -5086,6 +5086,12 @@ x_draw_hollow_cursor (struct window *w, struct glyph_row *row) /* Compute frame-relative coordinates for phys cursor. */ get_phys_cursor_geometry (w, row, cursor_glyph, &left, &top, &h); rect.left = left; + /* When on R2L character, show cursor at the right edge of the + glyph, unless the cursor box is as wide as the glyph or wider + (the latter happens when x-stretch-cursor is non-nil). */ + if ((cursor_glyph->resolved_level & 1) != 0 + && cursor_glyph->pixel_width > w->phys_cursor_width) + rect.left += cursor_glyph->pixel_width - w->phys_cursor_width; rect.top = top; rect.bottom = rect.top + h; rect.right = rect.left + w->phys_cursor_width; @@ -5167,7 +5173,7 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), width, row->height); } - else + else /* HBAR_CURSOR */ { int dummy_x, dummy_y, dummy_h; @@ -5178,6 +5184,9 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, get_phys_cursor_geometry (w, row, cursor_glyph, &dummy_x, &dummy_y, &dummy_h); + if ((cursor_glyph->resolved_level & 1) != 0 + && cursor_glyph->pixel_width > w->phys_cursor_width) + x += cursor_glyph->pixel_width - w->phys_cursor_width; w32_fill_area (f, hdc, cursor_color, x, WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y + row->height - width), diff --git a/src/xterm.c b/src/xterm.c index f426755e40..717df45256 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -7126,6 +7126,15 @@ x_draw_hollow_cursor (struct window *w, struct glyph_row *row) GCForeground, &xgcv); gc = dpyinfo->scratch_cursor_gc; + /* When on R2L character, show cursor at the right edge of the + glyph, unless the cursor box is as wide as the glyph or wider + (the latter happens when x-stretch-cursor is non-nil). */ + if ((cursor_glyph->resolved_level & 1) != 0 + && cursor_glyph->pixel_width > w->phys_cursor_width) + { + x += cursor_glyph->pixel_width - w->phys_cursor_width; + wd -= 1; + } /* Set clipping, draw the rectangle, and reset clipping again. */ x_clip_to_row (w, row, TEXT_AREA, gc); XDrawRectangle (dpy, FRAME_X_WINDOW (f), gc, x, y, wd, h - 1); @@ -7211,9 +7220,10 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), width, row->height); } - else + else /* HBAR_CURSOR */ { int dummy_x, dummy_y, dummy_h; + int x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); if (width < 0) width = row->height; @@ -7223,8 +7233,10 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text get_phys_cursor_geometry (w, row, cursor_glyph, &dummy_x, &dummy_y, &dummy_h); - XFillRectangle (dpy, window, gc, - WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x), + if ((cursor_glyph->resolved_level & 1) != 0 + && cursor_glyph->pixel_width > w->phys_cursor_width) + x += cursor_glyph->pixel_width - w->phys_cursor_width; + XFillRectangle (dpy, window, gc, x, WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y + row->height - width), w->phys_cursor_width, width); -- cgit v1.2.3 From df2ead390d7d54cb6c368e3099fb910a182ac7af Mon Sep 17 00:00:00 2001 From: Kan-Ru Chen Date: Thu, 18 Sep 2014 14:06:17 +0200 Subject: Fix `fit-window-to-buffer' (Bug#18498). * window.el (fit-window-to-buffer): When counting buffer width, count the whole visible buffer. Correctly convert the body-height to pixel size for window-text-pixel-size (Bug#18498). --- lisp/ChangeLog | 6 ++++++ lisp/window.el | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b696eb61ab..0a72fa4aa2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2014-09-18 Kan-Ru Chen + + * window.el (fit-window-to-buffer): When counting buffer width, + count the whole visible buffer. Correctly convert the body-height + to pixel size for window-text-pixel-size (Bug#18498). + 2014-09-14 Glenn Morris * image.el (image-multi-frame-p): Fix thinko - do not force diff --git a/lisp/window.el b/lisp/window.el index 4dc30ff968..7692c797af 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -7289,10 +7289,10 @@ accessible position." max-width)) (+ total-width (window-max-delta nil t nil nil nil nil pixelwise)))) - ;; When fitting vertically, assume that WINDOW's start - ;; position remains unaltered. WINDOW can't get wider - ;; than its frame's pixel width, its height remains - ;; unaltered. + ;; When fitting horizontally, assume that WINDOW's + ;; start position remains unaltered. WINDOW can't get + ;; wider than its frame's pixel width, its height + ;; remains unaltered. (width (+ (car (window-text-pixel-size nil (window-start) (point-max) (frame-pixel-width) @@ -7301,7 +7301,7 @@ accessible position." ;; overshoots when the first line below ;; the bottom is wider than the window. (* body-height - (if pixelwise char-height 1)))) + (if pixelwise 1 char-height)))) (window-right-divider-width)))) (unless pixelwise (setq width (/ (+ width char-width -1) char-width))) -- cgit v1.2.3 From a810675374498ff80464e48eeeb39f1854ef37bd Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 18 Sep 2014 18:10:33 +0300 Subject: Fix bug #18490 with redisplay of other windows showing a narrowed buffer. src/xdisp.c (redisplay_internal): Force redisplay of all windows that show a buffer whose narrowing has changed. --- src/ChangeLog | 5 +++++ src/xdisp.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index c86f6de157..880f49e3e8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2014-09-18 Eli Zaretskii + + * xdisp.c (redisplay_internal): Force redisplay of all windows + that show a buffer whose narrowing has changed. (Bug#18490) + 2014-09-16 Eli Zaretskii * xterm.c (x_draw_hollow_cursor, x_draw_bar_cursor): diff --git a/src/xdisp.c b/src/xdisp.c index 909349b81b..754862d59d 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -13598,6 +13598,12 @@ redisplay_internal (void) if (mode_line_update_needed (w)) w->update_mode_line = 1; + + /* If reconsider_clip_changes above decided that the narrowing + in the current buffer changed, make sure all other windows + showing that buffer will be redisplayed. */ + if (current_buffer->clip_changed) + bset_update_mode_line (current_buffer); } /* Normally the message* functions will have already displayed and -- cgit v1.2.3 From 41932b21a2f716ec1021485c40331ee9a88a66a3 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 18 Sep 2014 20:20:57 +0300 Subject: Clarify the doc strings of mouse-position and set-mouse-position. src/frame.c (Fmouse_position, Fset_mouse_position): Clarify the units in which the position is measured. (Bug#18493) --- src/ChangeLog | 3 +++ src/frame.c | 13 +++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 880f49e3e8..b442158a82 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2014-09-18 Eli Zaretskii + * frame.c (Fmouse_position, Fset_mouse_position): Clarify the + units in which the position is measured. (Bug#18493) + * xdisp.c (redisplay_internal): Force redisplay of all windows that show a buffer whose narrowing has changed. (Bug#18490) diff --git a/src/frame.c b/src/frame.c index 0c13016435..35fd190ba2 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1524,9 +1524,9 @@ The functions are run with one argument, the frame to be deleted. */) DEFUN ("mouse-position", Fmouse_position, Smouse_position, 0, 0, 0, doc: /* Return a list (FRAME X . Y) giving the current mouse frame and position. -The position is given in character cells, where (0, 0) is the -upper-left corner of the frame, X is the horizontal offset, and Y is -the vertical offset. +The position is given in canonical character cells, where (0, 0) is the +upper-left corner of the frame, X is the horizontal offset, and Y is the +vertical offset, measured in units of the frame's default character size. If Emacs is running on a mouseless terminal or hasn't been programmed to read the mouse position, it returns the selected frame for FRAME and nil for X and Y. @@ -1609,9 +1609,10 @@ Coordinates are relative to the frame, not a window, so the coordinates of the top left character in the frame may be nonzero due to left-hand scroll bars or the menu bar. -The position is given in character cells, where (0, 0) is the -upper-left corner of the frame, X is the horizontal offset, and Y is -the vertical offset. +The position is given in canonical character cells, where (0, 0) is +the upper-left corner of the frame, X is the horizontal offset, and +Y is the vertical offset, measured in units of the frame's default +character size. This function is a no-op for an X frame that is not visible. If you have just created a frame, you must wait for it to become visible -- cgit v1.2.3 From 46b189d794059d05c1f517ece236dbcf16a659e7 Mon Sep 17 00:00:00 2001 From: David Engster Date: Thu, 18 Sep 2014 22:37:19 +0200 Subject: Do not call egrep to determine emacs version in EDE. * ede/emacs.el (ede-emacs-version): Do not call 'egrep' to determine Emacs version (it was dead code anyway). Make sure that configure.ac or configure.in exist. (Bug#18476) --- lisp/cedet/ChangeLog | 6 ++++++ lisp/cedet/ede/emacs.el | 9 ++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lisp/cedet/ChangeLog b/lisp/cedet/ChangeLog index 750e0bca09..05bd95a50c 100644 --- a/lisp/cedet/ChangeLog +++ b/lisp/cedet/ChangeLog @@ -1,3 +1,9 @@ +2014-09-18 David Engster + + * ede/emacs.el (ede-emacs-version): Do not call 'egrep' to + determine Emacs version (it was dead code anyway). Make sure that + configure.ac or configure.in exist. (Bug#18476) + 2014-05-01 Glenn Morris * ede.el (ede-project-directories, ede-check-project-directory): diff --git a/lisp/cedet/ede/emacs.el b/lisp/cedet/ede/emacs.el index 43f16da8a7..76925a6671 100644 --- a/lisp/cedet/ede/emacs.el +++ b/lisp/cedet/ede/emacs.el @@ -80,12 +80,6 @@ Return a tuple of ( EMACSNAME . VERSION )." (with-current-buffer buff (erase-buffer) (setq default-directory (file-name-as-directory dir)) - (or (file-exists-p configure_ac) - (setq configure_ac "configure.in")) - ;(call-process "egrep" nil buff nil "-n" "-e" "^version=" "Makefile") - (call-process "egrep" nil buff nil "-n" "-e" "AC_INIT" configure_ac) - (goto-char (point-min)) - ;(re-search-forward "version=\\([0-9.]+\\)") (cond ;; Maybe XEmacs? ((file-exists-p "version.sh") @@ -113,7 +107,8 @@ m4_define(\\[SXEM4CS_BETA_VERSION\\], \\[\\([0-9]+\\)\\])") ;; Insert other Emacs here... ;; Vaguely recent version of GNU Emacs? - (t + ((or (file-exists-p configure_ac) + (file-exists-p (setq configure_ac "configure.in"))) (insert-file-contents configure_ac) (goto-char (point-min)) (re-search-forward "AC_INIT(\\(?:GNU \\)?[eE]macs,\\s-*\\([0-9.]+\\)\\s-*[,)]") -- cgit v1.2.3 From 3a449b759c008c5c2ffa4524f09d8d90e1c764d4 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Thu, 18 Sep 2014 23:59:55 +0300 Subject: * src/image.c (imagemagick_load_image): Add delay to imagemagick metadata. (Bug#10747, bug#18334) --- src/ChangeLog | 5 +++++ src/image.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index b442158a82..ea4dde398a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2014-09-18 Juri Linkov + + * image.c (imagemagick_load_image): Add delay to imagemagick metadata. + (Bug#10747, bug#18334) + 2014-09-18 Eli Zaretskii * frame.c (Fmouse_position, Fset_mouse_position): Clarify the diff --git a/src/image.c b/src/image.c index 13efc80ab2..b47a35dd71 100644 --- a/src/image.c +++ b/src/image.c @@ -8232,6 +8232,12 @@ imagemagick_load_image (struct frame *f, struct image *img, return 0; } + if (MagickGetImageDelay (image_wand) > 0) + img->lisp_data = + Fcons (Qdelay, + Fcons (make_float (MagickGetImageDelay (image_wand) / 100.0), + img->lisp_data)); + if (MagickGetNumberImages (image_wand) > 1) img->lisp_data = Fcons (Qcount, -- cgit v1.2.3 From 35ee96fdcba8a223013759cc0f81bf146f3d47e3 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Fri, 19 Sep 2014 05:55:43 +0400 Subject: Clarify url-http and url-retrieve-internal docstrings * lisp/url/url-http.el (url-http): Same. * lisp/url/url.el (url-retrieve-internal): Clarify the docstring. Fixes: debbugs:18116 --- lisp/url/ChangeLog | 6 ++++++ lisp/url/url-http.el | 4 ++-- lisp/url/url.el | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 4880bfea30..dfaf6f8c52 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@ -1,3 +1,9 @@ +2014-09-19 Dmitry + + * url.el (url-retrieve-internal): Clarify the docstring. + + * url-http.el (url-http): Same. (Bug#18116) + 2014-06-26 Leo Liu * url-http.el (url-http-end-of-headers): Remove duplicate defvar. diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index dcb86689ca..b0a3b688a5 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -1170,8 +1170,8 @@ the end of the document." "Retrieve URL via HTTP asynchronously. URL must be a parsed URL. See `url-generic-parse-url' for details. -When retrieval is completed, execute the function CALLBACK, using -the arguments listed in CBARGS. The first element in CBARGS +When retrieval is completed, execute the function CALLBACK, passing it +an updated value of CBARGS as arguments. The first element in CBARGS should be a plist describing what has happened so far during the request, as described in the docstring of `url-retrieve' (if in doubt, specify nil). diff --git a/lisp/url/url.el b/lisp/url/url.el index cbbcfd4f18..ca18d718dc 100644 --- a/lisp/url/url.el +++ b/lisp/url/url.el @@ -170,8 +170,8 @@ URL-encoded before it's used." (defun url-retrieve-internal (url callback cbargs &optional silent inhibit-cookies) "Internal function; external interface is `url-retrieve'. -CBARGS is the list of arguments that the callback function will -receive; its first element should be a plist specifying what has +The callback function will receive an updated value of CBARGS as +arguments; its first element should be a plist specifying what has happened so far during the request, as described in the docstring of `url-retrieve' (if in doubt, specify nil). -- cgit v1.2.3 From b761843bb07f1b50ed0468a25bfb9b073cdbb2ee Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Fri, 19 Sep 2014 06:29:25 +0400 Subject: Add the missing last name to ChangeLog --- lisp/url/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index dfaf6f8c52..8b0765291c 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@ -1,4 +1,4 @@ -2014-09-19 Dmitry +2014-09-19 Dmitry Gutov * url.el (url-retrieve-internal): Clarify the docstring. -- cgit v1.2.3 From 63126683dbcf3ac507c3afd20ecbce88fb6e0fa4 Mon Sep 17 00:00:00 2001 From: David Caldwell Date: Sun, 21 Sep 2014 22:35:22 +0200 Subject: * configure.ac: Increase headerpad_extra to 1000, update the comment about load commands. * src/unexmacosx.c (dump_it): Improve error message. Fixes: debbugs:18505 --- ChangeLog | 5 +++++ configure.ac | 10 ++++++---- src/ChangeLog | 4 ++++ src/unexmacosx.c | 4 +++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index b1951aa6c7..bffcbbab44 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-09-21 Jan Djärv + + * configure.ac: Increase headerpad_extra to 1000, update the comment + about load commands (Bug#18505). + 2014-09-13 Eli Zaretskii * configure.ac (HAVE_SOUND): Check for mmsystem.h header that diff --git a/configure.ac b/configure.ac index f05c14a319..0102551ece 100644 --- a/configure.ac +++ b/configure.ac @@ -4859,17 +4859,19 @@ case "$opsys" in darwin) ## The -headerpad option tells ld (see man page) to leave room at the ## end of the header for adding load commands. Needed for dumping. - ## 0x690 is the total size of 30 segment load commands (at 56 - ## each); under Cocoa 31 commands are required. + ## 0x1000 is enough for roughly 52 load commands on the x86_64 + ## architecture (where they are 78 bytes each). The actual number of + ## load commands added is not consistent but normally ranges from + ## about 14 to about 34. Setting it high gets us plenty of slop and + ## only costs about 1.5K of wasted binary space. + headerpad_extra=1000 if test "$HAVE_NS" = "yes"; then libs_nsgui="-framework AppKit" if test "$NS_IMPL_COCOA" = "yes"; then libs_nsgui="$libs_nsgui -framework IOKit" fi - headerpad_extra=6C8 else libs_nsgui= - headerpad_extra=690 fi LD_SWITCH_SYSTEM_TEMACS="-fno-pie -prebind $libs_nsgui -Xlinker -headerpad -Xlinker $headerpad_extra" diff --git a/src/ChangeLog b/src/ChangeLog index ea4dde398a..684de49852 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2014-09-21 David Caldwell (tiny change) + + * unexmacosx.c (dump_it): Improve error message. + 2014-09-18 Juri Linkov * image.c (imagemagick_load_image): Add delay to imagemagick metadata. diff --git a/src/unexmacosx.c b/src/unexmacosx.c index 8cd80a7a54..7d4762fdab 100644 --- a/src/unexmacosx.c +++ b/src/unexmacosx.c @@ -1302,7 +1302,9 @@ dump_it (void) } if (curr_header_offset > text_seg_lowest_offset) - unexec_error ("not enough room for load commands for new __DATA segments"); + unexec_error ("not enough room for load commands for new __DATA segments" + " (increase headerpad_extra in configure.in to at least %lX)", + num_unexec_regions * sizeof (struct segment_command)); printf ("%ld unused bytes follow Mach-O header\n", text_seg_lowest_offset - curr_header_offset); -- cgit v1.2.3 From fc5ebc3f497a152132407d57a14cce147d59d29c Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Mon, 22 Sep 2014 09:34:05 +0400 Subject: On OSX, do not free font-specific data more than once (Bug#18501). * macfont.m (macfont_close): Release and free font-specific data only if it wasn't previously freed. --- src/ChangeLog | 6 ++++++ src/macfont.m | 31 ++++++++++++++++++------------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 684de49852..4d969d7327 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2014-09-22 Dmitry Antipov + + On OSX, do not free font-specific data more than once (Bug#18501). + * macfont.m (macfont_close): Release and free font-specific data + only if it wasn't previously freed. + 2014-09-21 David Caldwell (tiny change) * unexmacosx.c (dump_it): Improve error message. diff --git a/src/macfont.m b/src/macfont.m index 1bb3fb1413..69bde9f66a 100644 --- a/src/macfont.m +++ b/src/macfont.m @@ -2616,20 +2616,25 @@ static void macfont_close (struct font *font) { struct macfont_info *macfont_info = (struct macfont_info *) font; - int i; - block_input (); - CFRelease (macfont_info->macfont); - CGFontRelease (macfont_info->cgfont); - if (macfont_info->screen_font) - CFRelease (macfont_info->screen_font); - macfont_release_cache (macfont_info->cache); - for (i = 0; i < macfont_info->metrics_nrows; i++) - if (macfont_info->metrics[i]) - xfree (macfont_info->metrics[i]); - if (macfont_info->metrics) - xfree (macfont_info->metrics); - unblock_input (); + if (macfont_info->cache) + { + int i; + + block_input (); + CFRelease (macfont_info->macfont); + CGFontRelease (macfont_info->cgfont); + if (macfont_info->screen_font) + CFRelease (macfont_info->screen_font); + macfont_release_cache (macfont_info->cache); + for (i = 0; i < macfont_info->metrics_nrows; i++) + if (macfont_info->metrics[i]) + xfree (macfont_info->metrics[i]); + if (macfont_info->metrics) + xfree (macfont_info->metrics); + macfont_info->cache = NULL; + unblock_input (); + } } static int -- cgit v1.2.3