diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2010-05-27 11:42:50 -0400 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2010-05-27 11:42:50 -0400 |
commit | 5ca3929b197ff0bc2db24635228f07653836a3b8 (patch) | |
tree | 42ed0f3735131ede41e231402edbec515424b8d0 /src | |
parent | 4da3541bbe03a21225fd0d409c54b2fc3778c6ee (diff) | |
download | emacs-5ca3929b197ff0bc2db24635228f07653836a3b8.tar.gz |
* xdisp.c (redisplay_window): After redisplay, check if point is
still valid before setting it (Bug#6177).
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/xdisp.c | 12 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index ddf73eaf3c5..a4a9e041879 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-05-27 Chong Yidong <cyd@stupidchicken.com> + + * xdisp.c (redisplay_window): After redisplay, check if point is + still valid before setting it (Bug#6177). + 2010-05-20 enami tsugutomo <tsugutomo.enami@jp.sony.com> * s/netbsd.h: If terminfo is found, use it in preference to diff --git a/src/xdisp.c b/src/xdisp.c index 734b60bc1dd..7dcdf19431a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -13936,8 +13936,16 @@ redisplay_window (window, just_this_one_p) (*FRAME_TERMINAL (f)->redeem_scroll_bar_hook) (w); } - /* Restore current_buffer and value of point in it. */ - TEMP_SET_PT_BOTH (CHARPOS (opoint), BYTEPOS (opoint)); + /* Restore current_buffer and value of point in it. The window + update may have changed the buffer, so first make sure `opoint' + is still valid (Bug#6177). */ + if (CHARPOS (opoint) < BEGV) + TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); + else if (CHARPOS (opoint) > ZV) + TEMP_SET_PT_BOTH (Z, Z_BYTE); + else + TEMP_SET_PT_BOTH (CHARPOS (opoint), BYTEPOS (opoint)); + set_buffer_internal_1 (old); /* Avoid an abort in TEMP_SET_PT_BOTH if the buffer has become shorter. This can be caused by log truncation in *Messages*. */ |