emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-24 c0ba590: Fix vertical-motion and posn-at-point wh


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-24 c0ba590: Fix vertical-motion and posn-at-point when word-wrap is on (Bug#19769)
Date: Thu, 05 Feb 2015 17:09:45 +0000

branch: emacs-24
commit c0ba5908b117170995df36e839a087af7c5f79db
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    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.
---
 src/ChangeLog |    7 +++++++
 src/xdisp.c   |   32 ++++++++++++++++++++++++++++++--
 2 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 8e7ab93..135f28f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+2015-02-05  Eli Zaretskii  <address@hidden>
+
+       * 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.
+       (Bug#19769)
+
 2015-02-03  Eli Zaretskii  <address@hidden>
 
        * xdisp.c (handle_stop, handle_single_display_spec)
diff --git a/src/xdisp.c b/src/xdisp.c
index 5e552ca..8cb4353 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -8798,7 +8798,16 @@ move_it_in_display_line_to (struct it *it,
                          if (BUFFER_POS_REACHED_P ())
                            {
                              if (it->line_wrap != WORD_WRAP
-                                 || wrap_it.sp < 0)
+                                 || wrap_it.sp < 0
+                                 /* If we've just found whitespace to
+                                    wrap, effectively ignore the
+                                    previous wrap point -- it is no
+                                    longer relevant, but we won't
+                                    have an opportunity to update it,
+                                    since we've reached the edge of
+                                    this screen line.  */
+                                 || (may_wrap
+                                     && IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)))
                                {
                                  it->hpos = hpos_before_this_char;
                                  it->current_x = x_before_this_char;
@@ -8862,7 +8871,26 @@ move_it_in_display_line_to (struct it *it,
                  else
                    IT_RESET_X_ASCENT_DESCENT (it);
 
-                 if (wrap_it.sp >= 0)
+                 /* If the screen line ends with whitespace, and we
+                    are under word-wrap, don't use wrap_it: it is no
+                    longer relevant, but we won't have an opportunity
+                    to update it, since we are done with this screen
+                    line.  */
+                 if (may_wrap && IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
+                   {
+                     /* If we've found TO_X, go back there, as we now
+                        know the last word fits on this screen line.  */
+                     if ((op & MOVE_TO_X) && new_x == it->last_visible_x
+                         && atx_it.sp >= 0)
+                       {
+                         RESTORE_IT (it, &atx_it, atx_data);
+                         atpos_it.sp = -1;
+                         atx_it.sp = -1;
+                         result = MOVE_X_REACHED;
+                         break;
+                       }
+                   }
+                 else if (wrap_it.sp >= 0)
                    {
                      RESTORE_IT (it, &wrap_it, wrap_data);
                      atpos_it.sp = -1;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]