diff options
author | Eli Zaretskii <eliz@gnu.org> | 2014-08-01 16:10:07 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2014-08-01 16:10:07 +0300 |
commit | 8afcf7e9d72d4d4173a00151dd8f2ba1866000c1 (patch) | |
tree | 0f8439faf6ec04103c1741aa1edbc5d5a939ff19 | |
parent | 4844e0422f7d318775cc7fce7845c0c568bd7ca3 (diff) | |
parent | eef5843c3458907e4bef35be10d46fea99f412f9 (diff) |
Merge from emacs-24; up to 2014-06-26T21:51:25Z!rgm@gnu.org.
-rw-r--r-- | lisp/ChangeLog | 5 | ||||
-rw-r--r-- | lisp/tutorial.el | 6 | ||||
-rw-r--r-- | src/ChangeLog | 32 | ||||
-rw-r--r-- | src/macros.c | 2 | ||||
-rw-r--r-- | src/xdisp.c | 80 |
5 files changed, 116 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e7496454fc..47f41a68cd 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-07-29 Eli Zaretskii <eliz@gnu.org> + + * tutorial.el (tutorial--display-changes): Accept punctuation + characters before the key binding. (Bug#18146) + 2014-07-31 Fabián Ezequiel Gallina <fgallina@gnu.org> * progmodes/python.el: Shell output capture enhancements. diff --git a/lisp/tutorial.el b/lisp/tutorial.el index 8925a02a9e..f6d4cb053e 100644 --- a/lisp/tutorial.el +++ b/lisp/tutorial.el @@ -548,7 +548,11 @@ with some explanatory links." (start (point)) (case-fold-search nil) (keybindings-regexp - (concat "[[:space:]]\\(" + ;; Accept either [:space:] or [:punct:] before the key + ;; binding because the Hebrew tutorial uses directional + ;; controls and Hebrew character maqaf, the Hebrew hyphen, + ;; immediately before the binding string. + (concat "\\([[:space:]]\\|[[:punct:]]\\)\\(" (mapconcat (lambda (kdf) (regexp-quote (tutorial--key-description (nth 1 kdf)))) diff --git a/src/ChangeLog b/src/ChangeLog index a0ac451f35..c28f8a607a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,35 @@ +2014-08-01 Eli Zaretskii <eliz@gnu.org> + + Fix display of R2L lines when the last character fits only partially. + See http://lists.gnu.org/archive/html/emacs-devel/2014-07/msg00476.html + for the details. + * xdisp.c (extend_face_to_end_of_line): If the last glyph of an + R2L row is visible only partially, give the row a negative x + offset. + (display_line): Fix the calculation of the glyph whose pixel width + is used to decide whether the last produced glyph fits on the + line. When the last glyph fits only partially, give the row a + negative x offset. + + Fix hscroll of R2L lines that begin with a TAB or another wide glyph. + * xdisp.c (append_stretch_glyph): In a R2L glyph row, decrease the + pixel width of the first glyph that is hscrolled from display. + (display_line): In R2L glyph rows, don't give a negative offset to + row->x when the first glyph begins before first_visible_x. + + * xdisp.c (display_line): If called with iterator set up to write + to a marginal area, delay the call to handle_line_prefix until we + switch back to the text area. (Bug#18035) + + * .gdbinit (xwindow): The members total_cols, total_lines, + left_col, and top_line are C integers (and has been so for the + last 1.5 years). + +2014-08-01 Andreas Schwab <schwab@suse.de> + + * macros.c (Fstart_kbd_macro): Initialize kbd_macro_ptr and + kbd_macro_end together with kbd_macro_buffer. (Bug#18140) + 2014-08-01 Dmitry Antipov <dmantipov@yandex.ru> * atimer.c (toplevel) [HAVE_TIMERFD]: Include errno.h. diff --git a/src/macros.c b/src/macros.c index 4730a8becc..c3d26d0d5c 100644 --- a/src/macros.c +++ b/src/macros.c @@ -63,6 +63,8 @@ macro before appending to it. */) { current_kboard->kbd_macro_buffer = xmalloc (30 * word_size); current_kboard->kbd_macro_bufsize = 30; + current_kboard->kbd_macro_ptr = current_kboard->kbd_macro_buffer; + current_kboard->kbd_macro_end = current_kboard->kbd_macro_buffer; } update_mode_lines = 19; if (NILP (append)) diff --git a/src/xdisp.c b/src/xdisp.c index bbe810d1a0..fe16b2c6a0 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -19337,6 +19337,12 @@ extend_face_to_end_of_line (struct it *it) it->face_id = saved_face_id; it->start_of_box_run_p = saved_box_start; } + /* If stretch_width comes out negative, it means that the + last glyph is only partially visible. In R2L rows, we + want the leftmost glyph to be partially visible, so we + need to give the row the corresponding left offset. */ + if (stretch_width < 0) + it->glyph_row->x = stretch_width; } #endif /* HAVE_WINDOW_SYSTEM */ } @@ -19963,6 +19969,7 @@ display_line (struct it *it) int cvpos; ptrdiff_t min_pos = ZV + 1, max_pos = 0; ptrdiff_t min_bpos IF_LINT (= 0), max_bpos IF_LINT (= 0); + bool pending_handle_line_prefix = false; /* We always start displaying at hpos zero even if hscrolled. */ eassert (it->hpos == 0 && it->current_x == 0); @@ -20023,13 +20030,23 @@ display_line (struct it *it) min_pos = CHARPOS (this_line_min_pos); min_bpos = BYTEPOS (this_line_min_pos); } - else + else if (it->area == TEXT_AREA) { - /* We only do this when not calling `move_it_in_display_line_to' - above, because move_it_in_display_line_to calls - handle_line_prefix itself. */ + /* We only do this when not calling move_it_in_display_line_to + above, because that function calls itself handle_line_prefix. */ handle_line_prefix (it); } + else + { + /* Line-prefix and wrap-prefix are always displayed in the text + area. But if this is the first call to display_line after + init_iterator, the iterator might have been set up to write + into a marginal area, e.g. if the line begins with some + display property that writes to the margins. So we need to + wait with the call to handle_line_prefix until whatever + writes to the margin has done its job. */ + pending_handle_line_prefix = true; + } /* Get the initial row height. This is either the height of the text hscrolled, if there is any, or zero. */ @@ -20161,6 +20178,14 @@ display_line (struct it *it) row->extra_line_spacing = max (row->extra_line_spacing, it->max_extra_line_spacing); set_iterator_to_next (it, 1); + /* If we didn't handle the line/wrap prefix above, and the + call to set_iterator_to_next just switched to TEXT_AREA, + process the prefix now. */ + if (it->area == TEXT_AREA && pending_handle_line_prefix) + { + pending_handle_line_prefix = false; + handle_line_prefix (it); + } continue; } @@ -20190,7 +20215,12 @@ display_line (struct it *it) it->max_phys_ascent + it->max_phys_descent); row->extra_line_spacing = max (row->extra_line_spacing, it->max_extra_line_spacing); - if (it->current_x - it->pixel_width < it->first_visible_x) + if (it->current_x - it->pixel_width < it->first_visible_x + /* In R2L rows, we arrange in extend_face_to_end_of_line + to add a right offset to the line, by a suitable + change to the stretch glyph that is the leftmost + glyph of the line. */ + && !row->reversed_p) row->x = x - it->first_visible_x; /* Record the maximum and minimum buffer positions seen so far in glyphs that will be displayed by this row. */ @@ -20204,7 +20234,13 @@ display_line (struct it *it) for (i = 0; i < nglyphs; ++i, x = new_x) { - glyph = row->glyphs[TEXT_AREA] + n_glyphs_before + i; + /* Identify the glyphs added by the last call to + PRODUCE_GLYPHS. In R2L rows, they are prepended to + the previous glyphs. */ + if (!row->reversed_p) + glyph = row->glyphs[TEXT_AREA] + n_glyphs_before + i; + else + glyph = row->glyphs[TEXT_AREA] + nglyphs - 1 - i; new_x = x + glyph->pixel_width; if (/* Lines are continued. */ @@ -20404,10 +20440,20 @@ display_line (struct it *it) if (it->bidi_p) RECORD_MAX_MIN_POS (it); - if (x < it->first_visible_x) + if (x < it->first_visible_x && !row->reversed_p) /* Glyph is partially visible, i.e. row starts at - negative X position. */ + negative X position. Don't do that in R2L + rows, where we arrange to add a right offset to + the line in extend_face_to_end_of_line, by a + suitable change to the stretch glyph that is + the leftmost glyph of the line. */ row->x = x - it->first_visible_x; + /* 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; } else { @@ -25305,6 +25351,24 @@ append_stretch_glyph (struct it *it, Lisp_Object object, for (g = glyph - 1; g >= it->glyph_row->glyphs[area]; g--) g[1] = *g; glyph = it->glyph_row->glyphs[area]; + + /* Decrease the width of the first glyph of the row that + begins before first_visible_x (e.g., due to hscroll). + This is so the overall width of the row becomes smaller + by the scroll amount, and the stretch glyph appended by + extend_face_to_end_of_line will be wider, to shift the + row glyphs to the right. (In L2R rows, the corresponding + left-shift effect is accomplished by setting row->x to a + negative value, which won't work with R2L rows.) + + This must leave us with a positive value of WIDTH, since + otherwise the call to move_it_in_display_line_to at the + beginning of display_line would have got past the entire + first glyph, and then it->current_x would have been + greater or equal to it->first_visible_x. */ + if (it->current_x < it->first_visible_x) + width -= it->first_visible_x - it->current_x; + eassert (width > 0); } glyph->charpos = CHARPOS (it->position); glyph->object = object; |