aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2011-09-20 20:42:16 +0300
committerEli Zaretskii2011-09-20 20:42:16 +0300
commitfd317ddfc9ff0628af84aa1e9d298cea6a208d19 (patch)
treeef279dd6dfc11f1bd66b8cdc862fcbed16ebec04
parent8c203dbf33f77e12b6833d26bb2b86e836ceef8e (diff)
downloademacs-fd317ddfc9ff0628af84aa1e9d298cea6a208d19.tar.gz
emacs-fd317ddfc9ff0628af84aa1e9d298cea6a208d19.zip
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.
-rw-r--r--src/ChangeLog3
-rw-r--r--src/xdisp.c33
2 files changed, 20 insertions, 16 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f0b1ecc3caa..17b53216e83 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -5,6 +5,9 @@
5 (find_row_edges): If the row ends in a newline from a display 5 (find_row_edges): If the row ends in a newline from a display
6 string, increment its MATRIX_ROW_END_CHARPOS by one. (Bug#9549) 6 string, increment its MATRIX_ROW_END_CHARPOS by one. (Bug#9549)
7 Handle the case of a display string with multiple newlines. 7 Handle the case of a display string with multiple newlines.
8 (Fcurrent_bidi_paragraph_direction): Fix search for previous
9 non-empty line. Fixes confusing cursor motion with arrow keys at
10 the beginning of a line that starts with whitespace.
8 11
92011-09-19 Lars Magne Ingebrigtsen <larsi@gnus.org> 122011-09-19 Lars Magne Ingebrigtsen <larsi@gnus.org>
10 13
diff --git a/src/xdisp.c b/src/xdisp.c
index 81cba29206a..3505d18d502 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -19205,6 +19205,7 @@ See also `bidi-paragraph-direction'. */)
19205 EMACS_INT pos = BUF_PT (buf); 19205 EMACS_INT pos = BUF_PT (buf);
19206 EMACS_INT bytepos = BUF_PT_BYTE (buf); 19206 EMACS_INT bytepos = BUF_PT_BYTE (buf);
19207 int c; 19207 int c;
19208 void *itb_data = bidi_shelve_cache ();
19208 19209
19209 set_buffer_temp (buf); 19210 set_buffer_temp (buf);
19210 /* bidi_paragraph_init finds the base direction of the paragraph 19211 /* bidi_paragraph_init finds the base direction of the paragraph
@@ -19217,27 +19218,27 @@ See also `bidi-paragraph-direction'. */)
19217 pos--; 19218 pos--;
19218 bytepos = CHAR_TO_BYTE (pos); 19219 bytepos = CHAR_TO_BYTE (pos);
19219 } 19220 }
19220 while ((c = FETCH_BYTE (bytepos)) == '\n' 19221 if (fast_looking_at (build_string ("[\f\t ]*\n"),
19221 || c == ' ' || c == '\t' || c == '\f') 19222 pos, bytepos, ZV, ZV_BYTE, Qnil) > 0)
19222 { 19223 {
19223 if (bytepos <= BEGV_BYTE) 19224 while ((c = FETCH_BYTE (bytepos)) == '\n'
19224 break; 19225 || c == ' ' || c == '\t' || c == '\f')
19225 bytepos--; 19226 {
19226 pos--; 19227 if (bytepos <= BEGV_BYTE)
19228 break;
19229 bytepos--;
19230 pos--;
19231 }
19232 while (!CHAR_HEAD_P (FETCH_BYTE (bytepos)))
19233 bytepos--;
19227 } 19234 }
19228 while (!CHAR_HEAD_P (FETCH_BYTE (bytepos))) 19235 bidi_init_it (pos, bytepos, FRAME_WINDOW_P (SELECTED_FRAME ()), &itb);
19229 bytepos--;
19230 itb.charpos = pos;
19231 itb.bytepos = bytepos;
19232 itb.nchars = -1;
19233 itb.string.s = NULL; 19236 itb.string.s = NULL;
19234 itb.string.lstring = Qnil; 19237 itb.string.lstring = Qnil;
19235 itb.frame_window_p = FRAME_WINDOW_P (SELECTED_FRAME ()); /* guesswork */ 19238 itb.string.bufpos = 0;
19236 itb.first_elt = 1; 19239 itb.string.unibyte = 0;
19237 itb.separator_limit = -1;
19238 itb.paragraph_dir = NEUTRAL_DIR;
19239
19240 bidi_paragraph_init (NEUTRAL_DIR, &itb, 1); 19240 bidi_paragraph_init (NEUTRAL_DIR, &itb, 1);
19241 bidi_unshelve_cache (itb_data, 0);
19241 set_buffer_temp (old); 19242 set_buffer_temp (old);
19242 switch (itb.paragraph_dir) 19243 switch (itb.paragraph_dir)
19243 { 19244 {