diff options
| author | Eli Zaretskii | 2013-02-04 17:39:55 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2013-02-04 17:39:55 +0200 |
| commit | 86f7c0fe6000de85d8b282da761e65e18a73b287 (patch) | |
| tree | 348144367f435ae190b2b76a6abce081c1e5c1ed | |
| parent | 6e5c1569e941d385d28466a337ece0322bfa93e7 (diff) | |
| download | emacs-86f7c0fe6000de85d8b282da761e65e18a73b287.tar.gz emacs-86f7c0fe6000de85d8b282da761e65e18a73b287.zip | |
Fix bugs #13623 and 13626 caused by changes in 2013-02-01T07:23:18Z!dmantipov@yandex.ru.
src/xdisp.c (window_buffer_changed): region_showing can be negative,
which still means region is being displayed.
(redisplay_internal): Resurrect code that forced redisplay of the
whole window when showing region and the mark has changed. Record
the new mark position to allow redisplay optimizations.
(display_line): If it->region_beg_charpos is non-zero, set the
window's region_showing member to -1.
src/window.h (struct window) <region_showing>: Declare ptrdiff_t,
not bitfield of 1 bit.
| -rw-r--r-- | src/ChangeLog | 13 | ||||
| -rw-r--r-- | src/window.h | 8 | ||||
| -rw-r--r-- | src/xdisp.c | 17 |
3 files changed, 33 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 1c7771cb0d9..6f52f764a97 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,16 @@ | |||
| 1 | 2013-02-04 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (window_buffer_changed): region_showing can be negative, | ||
| 4 | which still means region is being displayed. | ||
| 5 | (redisplay_internal): Resurrect code that forced redisplay of the | ||
| 6 | whole window when showing region and the mark has changed. Record | ||
| 7 | the new mark position to allow redisplay optimizations. | ||
| 8 | (display_line): If it->region_beg_charpos is non-zero, set the | ||
| 9 | window's region_showing member to -1. (Bug#13623) (Bug#13626) | ||
| 10 | |||
| 11 | * window.h (struct window) <region_showing>: Declare ptrdiff_t, | ||
| 12 | not bitfield of 1 bit. | ||
| 13 | |||
| 1 | 2013-02-03 Daniel Colascione <dancol@dancol.org> | 14 | 2013-02-03 Daniel Colascione <dancol@dancol.org> |
| 2 | 15 | ||
| 3 | * emacs.c: Use execvp, not execv, when DAEMON_MUST_EXEC, so that | 16 | * emacs.c: Use execvp, not execv, when DAEMON_MUST_EXEC, so that |
diff --git a/src/window.h b/src/window.h index f28ce1424d0..0f4f242641e 100644 --- a/src/window.h +++ b/src/window.h | |||
| @@ -333,13 +333,15 @@ struct window | |||
| 333 | the frame image that window_end_pos did not get onto the frame. */ | 333 | the frame image that window_end_pos did not get onto the frame. */ |
| 334 | unsigned window_end_valid : 1; | 334 | unsigned window_end_valid : 1; |
| 335 | 335 | ||
| 336 | /* Nonzero if we have highlighted the region (or any part of it). */ | ||
| 337 | unsigned region_showing : 1; | ||
| 338 | |||
| 339 | /* Amount by which lines of this window are scrolled in | 336 | /* Amount by which lines of this window are scrolled in |
| 340 | y-direction (smooth scrolling). */ | 337 | y-direction (smooth scrolling). */ |
| 341 | int vscroll; | 338 | int vscroll; |
| 342 | 339 | ||
| 340 | /* If we have highlighted the region (or any part of it), the mark | ||
| 341 | position or -1 (the latter is used by the iterator for internal | ||
| 342 | purposes); otherwise zero. */ | ||
| 343 | ptrdiff_t region_showing; | ||
| 344 | |||
| 343 | /* Z_BYTE - buffer position of the last glyph in the current matrix of W. | 345 | /* Z_BYTE - buffer position of the last glyph in the current matrix of W. |
| 344 | Should be nonnegative, and only valid if window_end_valid is nonzero. */ | 346 | Should be nonnegative, and only valid if window_end_valid is nonzero. */ |
| 345 | ptrdiff_t window_end_bytepos; | 347 | ptrdiff_t window_end_bytepos; |
diff --git a/src/xdisp.c b/src/xdisp.c index 7b6e108d97f..a958fd51e39 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -10753,7 +10753,7 @@ window_buffer_changed (struct window *w) | |||
| 10753 | 10753 | ||
| 10754 | return (((BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)) != w->last_had_star) | 10754 | return (((BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)) != w->last_had_star) |
| 10755 | || ((!NILP (Vtransient_mark_mode) && !NILP (BVAR (b, mark_active))) | 10755 | || ((!NILP (Vtransient_mark_mode) && !NILP (BVAR (b, mark_active))) |
| 10756 | != w->region_showing)); | 10756 | != (w->region_showing != 0))); |
| 10757 | } | 10757 | } |
| 10758 | 10758 | ||
| 10759 | /* Nonzero if W has %c in its mode line and mode line should be updated. */ | 10759 | /* Nonzero if W has %c in its mode line and mode line should be updated. */ |
| @@ -13016,6 +13016,17 @@ redisplay_internal (void) | |||
| 13016 | clear_garbaged_frames (); | 13016 | clear_garbaged_frames (); |
| 13017 | } | 13017 | } |
| 13018 | 13018 | ||
| 13019 | /* If showing the region, and mark has changed, we must redisplay | ||
| 13020 | the whole window. The assignment to this_line_start_pos prevents | ||
| 13021 | the optimization directly below this if-statement. */ | ||
| 13022 | if (((!NILP (Vtransient_mark_mode) | ||
| 13023 | && !NILP (BVAR (XBUFFER (w->buffer), mark_active))) | ||
| 13024 | != (w->region_showing > 0)) | ||
| 13025 | || (w->region_showing | ||
| 13026 | && w->region_showing | ||
| 13027 | != XINT (Fmarker_position (BVAR (XBUFFER (w->buffer), mark))))) | ||
| 13028 | CHARPOS (this_line_start_pos) = 0; | ||
| 13029 | |||
| 13019 | /* Optimize the case that only the line containing the cursor in the | 13030 | /* Optimize the case that only the line containing the cursor in the |
| 13020 | selected window has changed. Variables starting with this_ are | 13031 | selected window has changed. Variables starting with this_ are |
| 13021 | set in display_line and record information about the line | 13032 | set in display_line and record information about the line |
| @@ -13228,6 +13239,8 @@ redisplay_internal (void) | |||
| 13228 | ++clear_image_cache_count; | 13239 | ++clear_image_cache_count; |
| 13229 | #endif | 13240 | #endif |
| 13230 | 13241 | ||
| 13242 | w->region_showing = XINT (Fmarker_position (BVAR (XBUFFER (w->buffer), mark))); | ||
| 13243 | |||
| 13231 | /* Build desired matrices, and update the display. If | 13244 | /* Build desired matrices, and update the display. If |
| 13232 | consider_all_windows_p is non-zero, do it for all windows on all | 13245 | consider_all_windows_p is non-zero, do it for all windows on all |
| 13233 | frames. Otherwise do it for selected_window, only. */ | 13246 | frames. Otherwise do it for selected_window, only. */ |
| @@ -19120,7 +19133,7 @@ display_line (struct it *it) | |||
| 19120 | } | 19133 | } |
| 19121 | 19134 | ||
| 19122 | /* Is IT->w showing the region? */ | 19135 | /* Is IT->w showing the region? */ |
| 19123 | it->w->region_showing = it->region_beg_charpos > 0; | 19136 | it->w->region_showing = it->region_beg_charpos > 0 ? -1 : 0; |
| 19124 | 19137 | ||
| 19125 | /* Clear the result glyph row and enable it. */ | 19138 | /* Clear the result glyph row and enable it. */ |
| 19126 | prepare_desired_row (row); | 19139 | prepare_desired_row (row); |