diff options
| author | Eli Zaretskii | 2015-02-05 19:07:15 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2015-02-05 19:07:15 +0200 |
| commit | c0ba5908b117170995df36e839a087af7c5f79db (patch) | |
| tree | b610585c4266f90f45a4b614f304cf39e24f1798 /src | |
| parent | a323b93d466c403cbef96184d510b134549c7806 (diff) | |
| download | emacs-c0ba5908b117170995df36e839a087af7c5f79db.tar.gz emacs-c0ba5908b117170995df36e839a087af7c5f79db.zip | |
Fix vertical-motion and posn-at-point when word-wrap is on (Bug#19769)
src/xdisp.c (move_it_in_display_line_to): Handle the case where the
last character of a screen line is whitespace, and we are under
word-wrap with overflow-newline-into-fringe turned on.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/xdisp.c | 32 |
2 files changed, 37 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 8e7ab9363f6..135f28fb20f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2015-02-05 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (move_it_in_display_line_to): Handle the case where the | ||
| 4 | last character of a screen line is whitespace, and we are under | ||
| 5 | word-wrap with overflow-newline-into-fringe turned on. | ||
| 6 | (Bug#19769) | ||
| 7 | |||
| 1 | 2015-02-03 Eli Zaretskii <eliz@gnu.org> | 8 | 2015-02-03 Eli Zaretskii <eliz@gnu.org> |
| 2 | 9 | ||
| 3 | * xdisp.c (handle_stop, handle_single_display_spec) | 10 | * xdisp.c (handle_stop, handle_single_display_spec) |
diff --git a/src/xdisp.c b/src/xdisp.c index 5e552ca2fdb..8cb43538dcc 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -8798,7 +8798,16 @@ move_it_in_display_line_to (struct it *it, | |||
| 8798 | if (BUFFER_POS_REACHED_P ()) | 8798 | if (BUFFER_POS_REACHED_P ()) |
| 8799 | { | 8799 | { |
| 8800 | if (it->line_wrap != WORD_WRAP | 8800 | if (it->line_wrap != WORD_WRAP |
| 8801 | || wrap_it.sp < 0) | 8801 | || wrap_it.sp < 0 |
| 8802 | /* If we've just found whitespace to | ||
| 8803 | wrap, effectively ignore the | ||
| 8804 | previous wrap point -- it is no | ||
| 8805 | longer relevant, but we won't | ||
| 8806 | have an opportunity to update it, | ||
| 8807 | since we've reached the edge of | ||
| 8808 | this screen line. */ | ||
| 8809 | || (may_wrap | ||
| 8810 | && IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))) | ||
| 8802 | { | 8811 | { |
| 8803 | it->hpos = hpos_before_this_char; | 8812 | it->hpos = hpos_before_this_char; |
| 8804 | it->current_x = x_before_this_char; | 8813 | it->current_x = x_before_this_char; |
| @@ -8862,7 +8871,26 @@ move_it_in_display_line_to (struct it *it, | |||
| 8862 | else | 8871 | else |
| 8863 | IT_RESET_X_ASCENT_DESCENT (it); | 8872 | IT_RESET_X_ASCENT_DESCENT (it); |
| 8864 | 8873 | ||
| 8865 | if (wrap_it.sp >= 0) | 8874 | /* If the screen line ends with whitespace, and we |
| 8875 | are under word-wrap, don't use wrap_it: it is no | ||
| 8876 | longer relevant, but we won't have an opportunity | ||
| 8877 | to update it, since we are done with this screen | ||
| 8878 | line. */ | ||
| 8879 | if (may_wrap && IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) | ||
| 8880 | { | ||
| 8881 | /* If we've found TO_X, go back there, as we now | ||
| 8882 | know the last word fits on this screen line. */ | ||
| 8883 | if ((op & MOVE_TO_X) && new_x == it->last_visible_x | ||
| 8884 | && atx_it.sp >= 0) | ||
| 8885 | { | ||
| 8886 | RESTORE_IT (it, &atx_it, atx_data); | ||
| 8887 | atpos_it.sp = -1; | ||
| 8888 | atx_it.sp = -1; | ||
| 8889 | result = MOVE_X_REACHED; | ||
| 8890 | break; | ||
| 8891 | } | ||
| 8892 | } | ||
| 8893 | else if (wrap_it.sp >= 0) | ||
| 8866 | { | 8894 | { |
| 8867 | RESTORE_IT (it, &wrap_it, wrap_data); | 8895 | RESTORE_IT (it, &wrap_it, wrap_data); |
| 8868 | atpos_it.sp = -1; | 8896 | atpos_it.sp = -1; |