diff options
| author | Eli Zaretskii | 2015-12-09 20:03:54 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2015-12-09 20:03:54 +0200 |
| commit | d75849e937af0ecbcdc7bf621aa9bcd43aa75df4 (patch) | |
| tree | c642a770527754d79af2e7211aca04cb66fea3b5 | |
| parent | b227422c66f20806f406730f8ef7dea276956151 (diff) | |
| download | emacs-d75849e937af0ecbcdc7bf621aa9bcd43aa75df4.tar.gz emacs-d75849e937af0ecbcdc7bf621aa9bcd43aa75df4.zip | |
Yet another fix for when point ends up in invisible text
* src/xdisp.c (redisplay_window): When someone forced
window-start, and honoring that failed to show the cursor, try
moving out of invisible text, before falling back to the middle of
the window. (Bug#22098)
| -rw-r--r-- | src/xdisp.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 68e9cfb450c..37dc6047e58 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -16301,9 +16301,33 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) | |||
| 16301 | if (w->cursor.vpos < 0) | 16301 | if (w->cursor.vpos < 0) |
| 16302 | { | 16302 | { |
| 16303 | /* If point does not appear, try to move point so it does | 16303 | /* If point does not appear, try to move point so it does |
| 16304 | appear. The desired matrix has been built above, so we | 16304 | appear. The desired matrix has been built above, so we |
| 16305 | can use it here. */ | 16305 | can use it here. First see if point is in invisible |
| 16306 | new_vpos = window_box_height (w) / 2; | 16306 | text, and if so, move it to the first visible buffer |
| 16307 | position past that. */ | ||
| 16308 | struct glyph_row *r = NULL; | ||
| 16309 | Lisp_Object invprop = | ||
| 16310 | get_char_property_and_overlay (make_number (PT), Qinvisible, | ||
| 16311 | Qnil, NULL); | ||
| 16312 | |||
| 16313 | if (TEXT_PROP_MEANS_INVISIBLE (invprop) != 0) | ||
| 16314 | { | ||
| 16315 | ptrdiff_t alt_pt; | ||
| 16316 | Lisp_Object invprop_end = | ||
| 16317 | Fnext_single_char_property_change (make_number (PT), Qinvisible, | ||
| 16318 | Qnil, Qnil); | ||
| 16319 | |||
| 16320 | if (NATNUMP (invprop_end)) | ||
| 16321 | alt_pt = XFASTINT (invprop_end); | ||
| 16322 | else | ||
| 16323 | alt_pt = ZV; | ||
| 16324 | r = row_containing_pos (w, alt_pt, w->desired_matrix->rows, | ||
| 16325 | NULL, 0); | ||
| 16326 | } | ||
| 16327 | if (r) | ||
| 16328 | new_vpos = MATRIX_ROW_BOTTOM_Y (r); | ||
| 16329 | else /* Give up and just move to the middle of the window. */ | ||
| 16330 | new_vpos = window_box_height (w) / 2; | ||
| 16307 | } | 16331 | } |
| 16308 | 16332 | ||
| 16309 | if (!cursor_row_fully_visible_p (w, false, false)) | 16333 | if (!cursor_row_fully_visible_p (w, false, false)) |