emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r105857: Fix bidi-aware cursor motion


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105857: Fix bidi-aware cursor motion inside indentation.
Date: Tue, 20 Sep 2011 20:42:16 +0300
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105857
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Tue 2011-09-20 20:42:16 +0300
message:
  Fix bidi-aware cursor motion inside indentation.
  
   src/xdisp.c (Fcurrent_bidi_paragraph_direction): Fix search for previous
   non-empty line.  Fixes confusing cursor motion with arrow keys at
   the beginning of a line that starts with whitespace.
modified:
  src/ChangeLog
  src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-09-20 17:13:45 +0000
+++ b/src/ChangeLog     2011-09-20 17:42:16 +0000
@@ -5,6 +5,9 @@
        (find_row_edges): If the row ends in a newline from a display
        string, increment its MATRIX_ROW_END_CHARPOS by one.  (Bug#9549)
        Handle the case of a display string with multiple newlines.
+       (Fcurrent_bidi_paragraph_direction): Fix search for previous
+       non-empty line.  Fixes confusing cursor motion with arrow keys at
+       the beginning of a line that starts with whitespace.
 
 2011-09-19  Lars Magne Ingebrigtsen  <address@hidden>
 

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2011-09-20 17:13:45 +0000
+++ b/src/xdisp.c       2011-09-20 17:42:16 +0000
@@ -19205,6 +19205,7 @@
       EMACS_INT pos = BUF_PT (buf);
       EMACS_INT bytepos = BUF_PT_BYTE (buf);
       int c;
+      void *itb_data = bidi_shelve_cache ();
 
       set_buffer_temp (buf);
       /* bidi_paragraph_init finds the base direction of the paragraph
@@ -19217,27 +19218,27 @@
          pos--;
          bytepos = CHAR_TO_BYTE (pos);
        }
-      while ((c = FETCH_BYTE (bytepos)) == '\n'
-            || c == ' ' || c == '\t' || c == '\f')
+      if (fast_looking_at (build_string ("[\f\t ]*\n"),
+                          pos, bytepos, ZV, ZV_BYTE, Qnil) > 0)
        {
-         if (bytepos <= BEGV_BYTE)
-           break;
-         bytepos--;
-         pos--;
+         while ((c = FETCH_BYTE (bytepos)) == '\n'
+                || c == ' ' || c == '\t' || c == '\f')
+           {
+             if (bytepos <= BEGV_BYTE)
+               break;
+             bytepos--;
+             pos--;
+           }
+         while (!CHAR_HEAD_P (FETCH_BYTE (bytepos)))
+           bytepos--;
        }
-      while (!CHAR_HEAD_P (FETCH_BYTE (bytepos)))
-       bytepos--;
-      itb.charpos = pos;
-      itb.bytepos = bytepos;
-      itb.nchars = -1;
+      bidi_init_it (pos, bytepos, FRAME_WINDOW_P (SELECTED_FRAME ()), &itb);
       itb.string.s = NULL;
       itb.string.lstring = Qnil;
-      itb.frame_window_p = FRAME_WINDOW_P (SELECTED_FRAME ()); /* guesswork */
-      itb.first_elt = 1;
-      itb.separator_limit = -1;
-      itb.paragraph_dir = NEUTRAL_DIR;
-
+      itb.string.bufpos = 0;
+      itb.string.unibyte = 0;
       bidi_paragraph_init (NEUTRAL_DIR, &itb, 1);
+      bidi_unshelve_cache (itb_data, 0);
       set_buffer_temp (old);
       switch (itb.paragraph_dir)
        {


reply via email to

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