diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 34 | ||||
| -rw-r--r-- | src/syntax.c | 36 | ||||
| -rw-r--r-- | src/w32.c | 1 | ||||
| -rw-r--r-- | src/window.c | 26 | ||||
| -rw-r--r-- | src/xdisp.c | 40 |
5 files changed, 121 insertions, 16 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 4c4ca3a5e00..ba56edda715 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,37 @@ +2014-07-09 Eli Zaretskii <eliz@gnu.org> + + * xdisp.c (move_it_to): Adjust calculation of line_start_x to what + x_produce_glyphs does when it generates a stretch glyph that + represents a TAB. (Bug#17969) + + * xdisp.c (pos_visible_p): If CHARPOS is at beginning of window, + and there is a display property at that position, don't call + move_it_to to move to a position before window start. (Bug#17942) + Fix condition for finding CHARPOS by the first call to move_it_to. + (Bug#17944) + +2014-07-09 Stefan Monnier <monnier@iro.umontreal.ca> + + * syntax.c (find_defun_start): Try the cache even + if !open_paren_in_column_0_is_defun_start. + (back_comment): If find_defun_start was pessimistic, use the + scan_sexps_forward result to improve the cache (bug#16526). + +2014-07-09 Eli Zaretskii <eliz@gnu.org> + + * xdisp.c (redisplay_window): If redisplay of a window ends up + with point in a partially visible line at end of the window, make + sure the amended position of point actually has smaller Y + coordinate; if not, give up and scroll the display. (Bug#17905) + + * window.c (window_scroll_pixel_based): When point ends up at the + last fully visible line, don't let move_it_to stop at the left + edge of the line and dupe us into thinking point is inside the + scroll margin. + + * w32.c (network_interface_info): Make sure the argument is a + Lisp string. + 2014-07-08 Paul Eggert <eggert@cs.ucla.edu> * process.c (read_and_dispose_of_process_output): Fix typo diff --git a/src/syntax.c b/src/syntax.c index f2451332b19..0ee48bb3725 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -530,17 +530,6 @@ find_defun_start (ptrdiff_t pos, ptrdiff_t pos_byte) { ptrdiff_t opoint = PT, opoint_byte = PT_BYTE; - if (!open_paren_in_column_0_is_defun_start) - { - find_start_value = BEGV; - find_start_value_byte = BEGV_BYTE; - find_start_buffer = current_buffer; - find_start_modiff = MODIFF; - find_start_begv = BEGV; - find_start_pos = pos; - return BEGV; - } - /* Use previous finding, if it's valid and applies to this inquiry. */ if (current_buffer == find_start_buffer /* Reuse the defun-start even if POS is a little farther on. @@ -552,6 +541,13 @@ find_defun_start (ptrdiff_t pos, ptrdiff_t pos_byte) && MODIFF == find_start_modiff) return find_start_value; + if (!open_paren_in_column_0_is_defun_start) + { + find_start_value = BEGV; + find_start_value_byte = BEGV_BYTE; + goto found; + } + /* Back up to start of line. */ scan_newline (pos, pos_byte, BEGV, BEGV_BYTE, -1, 1); @@ -582,13 +578,14 @@ find_defun_start (ptrdiff_t pos, ptrdiff_t pos_byte) /* Record what we found, for the next try. */ find_start_value = PT; find_start_value_byte = PT_BYTE; + TEMP_SET_PT_BOTH (opoint, opoint_byte); + + found: find_start_buffer = current_buffer; find_start_modiff = MODIFF; find_start_begv = BEGV; find_start_pos = pos; - TEMP_SET_PT_BOTH (opoint, opoint_byte); - return find_start_value; } @@ -841,7 +838,9 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, else { struct lisp_parse_state state; + bool adjusted; lossage: + adjusted = true; /* We had two kinds of string delimiters mixed up together. Decode this going forwards. Scan fwd from a known safe place (beginning-of-defun) @@ -852,6 +851,7 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, { defun_start = find_defun_start (comment_end, comment_end_byte); defun_start_byte = find_start_value_byte; + adjusted = (defun_start > BEGV); } do { @@ -860,6 +860,16 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, comment_end, TYPE_MINIMUM (EMACS_INT), 0, Qnil, 0); defun_start = comment_end; + if (!adjusted) + { + adjusted = true; + find_start_value + = CONSP (state.levelstarts) ? XINT (XCAR (state.levelstarts)) + : state.thislevelstart >= 0 ? state.thislevelstart + : find_start_value; + find_start_value_byte = CHAR_TO_BYTE (find_start_value); + } + if (state.incomment == (comnested ? 1 : -1) && state.comstyle == comstyle) from = state.comstr_start; diff --git a/src/w32.c b/src/w32.c index 4643fc7fbec..c5d4aa0fe8e 100644 --- a/src/w32.c +++ b/src/w32.c @@ -8612,6 +8612,7 @@ network_interface_list (void) Lisp_Object network_interface_info (Lisp_Object ifname) { + CHECK_STRING (ifname); return network_interface_get_info (ifname); } diff --git a/src/window.c b/src/window.c index 8a608433ed7..6afe7454149 100644 --- a/src/window.c +++ b/src/window.c @@ -5161,6 +5161,32 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror) charpos = IT_CHARPOS (it); bytepos = IT_BYTEPOS (it); + /* If PT is in the screen line at the last fully visible line, + move_it_to will stop at X = 0 in that line, because the + required Y coordinate is reached there. See if we can get to + PT without descending lower in Y, and if we can, it means we + reached PT before the scroll margin. */ + if (charpos != PT) + { + struct it it2; + void *it_data; + + it2 = it; + it_data = bidi_shelve_cache (); + move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); + if (IT_CHARPOS (it) == PT && it.current_y == it2.current_y) + { + charpos = IT_CHARPOS (it); + bytepos = IT_BYTEPOS (it); + bidi_unshelve_cache (it_data, 1); + } + else + { + it = it2; + bidi_unshelve_cache (it_data, 0); + } + } + /* See if point is on a partially visible line at the end. */ if (it.what == IT_EOB) partial_p = it.current_y + it.ascent + it.descent > it.last_visible_y; diff --git a/src/xdisp.c b/src/xdisp.c index 6cec0bf1925..6b2fa4be846 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -1436,7 +1436,7 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, (charpos >= 0 ? MOVE_TO_POS : 0) | MOVE_TO_Y); if (charpos >= 0 - && (((!it.bidi_p || it.bidi_it.scan_dir == 1) + && (((!it.bidi_p || it.bidi_it.scan_dir != -1) && IT_CHARPOS (it) >= charpos) /* When scanning backwards under bidi iteration, move_it_to stops at or _before_ CHARPOS, because it stops at or to @@ -1585,7 +1585,8 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, /* Move to the last buffer position before the display property. */ start_display (&it3, w, top); - move_it_to (&it3, start - 1, -1, -1, -1, MOVE_TO_POS); + if (start > CHARPOS (top)) + move_it_to (&it3, start - 1, -1, -1, -1, MOVE_TO_POS); /* Move forward one more line if the position before the display string is a newline or if it is the rightmost character on a line that is @@ -1688,7 +1689,9 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, } else { - /* We were asked to provide info about WINDOW_END. */ + /* Either we were asked to provide info about WINDOW_END, or + CHARPOS is in the partially visible glyph row at end of + window. */ struct it it2; void *it2data = NULL; @@ -9247,6 +9250,25 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos { line_start_x = it->current_x + it->pixel_width - it->last_visible_x; + if (FRAME_WINDOW_P (it->f)) + { + struct face *face = FACE_FROM_ID (it->f, it->face_id); + struct font *face_font = face->font; + + /* When display_line produces a continued line + that ends in a TAB, it skips a tab stop that + is closer than the font's space character + width (see x_produce_glyphs where it produces + the stretch glyph which represents a TAB). + We need to reproduce the same logic here. */ + eassert (face_font); + if (face_font) + { + if (line_start_x < face_font->space_width) + line_start_x + += it->tab_width * face_font->space_width; + } + } set_iterator_to_next (it, 0); } } @@ -16088,6 +16110,18 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) /* Point does appear, but on a line partly visible at end of window. Move it back to a fully-visible line. */ new_vpos = window_box_height (w); + /* But if window_box_height suggests a Y coordinate that is + not less than we already have, that line will clearly not + be fully visible, so give up and scroll the display. + This can happen when the default face uses a font whose + dimensions are different from the frame's default + font. */ + if (new_vpos >= w->cursor.y) + { + w->cursor.vpos = -1; + clear_glyph_matrix (w->desired_matrix); + goto try_to_scroll; + } } else if (w->cursor.vpos >= 0) { |
