aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2010-04-10 19:28:30 +0300
committerEli Zaretskii2010-04-10 19:28:30 +0300
commitf951a50681995aa58a427f0be801c682df6e5baa (patch)
tree69f31a04e8f3ad5bd98b15703999200332ebc718 /src
parent2204f4de61e2b10832e13748f36d705854f7bd56 (diff)
downloademacs-f951a50681995aa58a427f0be801c682df6e5baa.tar.gz
emacs-f951a50681995aa58a427f0be801c682df6e5baa.zip
Implement cursor on the left fringe for R2L lines.
xdisp.c (IT_OVERFLOW_NEWLINE_INTO_FRINGE): For R2L lines, consider the left fringe, not the right one. (set_cursor_from_row): Don't reverse pos_before and pos_after for reversed glyph rows. Set cursor.x to negative value when the cursor might be on the left fringe. (extend_face_to_end_of_line): Append the stretch glyph only if its width is positive. (notice_overwritten_cursor, draw_phys_cursor_glyph) (erase_phys_cursor): For reversed cursor_row, support cursor on the left fringe. w32term.c (w32_draw_window_cursor): For reversed glyph rows, draw cursor on the left fringe. xterm.c (x_draw_window_cursor): For reversed glyph rows, draw cursor on the left fringe. fringe.c (draw_fringe_bitmap): For reversed glyph rows, allow cursor on the left fringe. dispnew.c (update_text_area): Handle reversed desired rows when the cursor is on the left fringe. (set_window_cursor_after_update): Limit cursor's hpos by -1 from below, not by 0, for when the cursor is on the left fringe.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog25
-rw-r--r--src/dispnew.c6
-rw-r--r--src/fringe.c4
-rw-r--r--src/w32term.c6
-rw-r--r--src/xdisp.c65
-rw-r--r--src/xterm.c44
6 files changed, 96 insertions, 54 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 268a245caf3..e6faa0a4c9e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -2,6 +2,31 @@
2 2
3 Implement display of R2L paragraphs in GUI sessions. 3 Implement display of R2L paragraphs in GUI sessions.
4 4
5 * xdisp.c (IT_OVERFLOW_NEWLINE_INTO_FRINGE): For R2L lines,
6 consider the left fringe, not the right one.
7 (set_cursor_from_row): Don't reverse pos_before and pos_after for
8 reversed glyph rows. Set cursor.x to negative value when the
9 cursor might be on the left fringe.
10 (extend_face_to_end_of_line): Append the stretch glyph only if its
11 width is positive.
12 (notice_overwritten_cursor, draw_phys_cursor_glyph)
13 (erase_phys_cursor): For reversed cursor_row, support cursor on
14 the left fringe.
15
16 * w32term.c (w32_draw_window_cursor): For reversed glyph rows,
17 draw cursor on the left fringe.
18
19 * xterm.c (x_draw_window_cursor): For reversed glyph rows, draw
20 cursor on the left fringe.
21
22 * fringe.c (draw_fringe_bitmap): For reversed glyph rows, allow
23 cursor on the left fringe.
24
25 * dispnew.c (update_text_area): Handle reversed desired rows when
26 the cursor is on the left fringe.
27 (set_window_cursor_after_update): Limit cursor's hpos by -1 from
28 below, not by 0, for when the cursor is on the left fringe.
29
5 * xdisp.c [HAVE_WINDOW_SYSTEM]: Add prototype for 30 * xdisp.c [HAVE_WINDOW_SYSTEM]: Add prototype for
6 append_stretch_glyph. 31 append_stretch_glyph.
7 (set_cursor_from_row) <cursor_x>: Remove unused variable. Fix 32 (set_cursor_from_row) <cursor_x>: Remove unused variable. Fix
diff --git a/src/dispnew.c b/src/dispnew.c
index 2be00c9c3b0..7ab2bf35811 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -4251,7 +4251,9 @@ update_text_area (w, vpos)
4251 doesn't work with lbearing/rbearing), so we must do it 4251 doesn't work with lbearing/rbearing), so we must do it
4252 this way. */ 4252 this way. */
4253 if (vpos == w->phys_cursor.vpos 4253 if (vpos == w->phys_cursor.vpos
4254 && w->phys_cursor.hpos >= desired_row->used[TEXT_AREA]) 4254 && (desired_row->reversed_p
4255 ? (w->phys_cursor.hpos < 0)
4256 : (w->phys_cursor.hpos >= desired_row->used[TEXT_AREA])))
4255 { 4257 {
4256 w->phys_cursor_on_p = 0; 4258 w->phys_cursor_on_p = 0;
4257 x = -1; 4259 x = -1;
@@ -4415,7 +4417,7 @@ set_window_cursor_after_update (w)
4415 } 4417 }
4416 4418
4417 /* Window cursor can be out of sync for horizontally split windows. */ 4419 /* Window cursor can be out of sync for horizontally split windows. */
4418 hpos = max (0, hpos); 4420 hpos = max (-1, hpos); /* -1 is for when cursor is on the left fringe */
4419 hpos = min (w->current_matrix->matrix_w - 1, hpos); 4421 hpos = min (w->current_matrix->matrix_w - 1, hpos);
4420 vpos = max (0, vpos); 4422 vpos = max (0, vpos);
4421 vpos = min (w->current_matrix->nrows - 1, vpos); 4423 vpos = min (w->current_matrix->nrows - 1, vpos);
diff --git a/src/fringe.c b/src/fringe.c
index 952e95a5517..335dde03c8a 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -825,7 +825,7 @@ draw_fringe_bitmap (w, row, left_p)
825{ 825{
826 int overlay = 0; 826 int overlay = 0;
827 827
828 if (!left_p && row->cursor_in_fringe_p) 828 if (left_p == row->reversed_p && row->cursor_in_fringe_p)
829 { 829 {
830 Lisp_Object cursor = Qnil; 830 Lisp_Object cursor = Qnil;
831 831
@@ -857,7 +857,7 @@ draw_fringe_bitmap (w, row, left_p)
857 int bm = get_logical_cursor_bitmap (w, cursor); 857 int bm = get_logical_cursor_bitmap (w, cursor);
858 if (bm != NO_FRINGE_BITMAP) 858 if (bm != NO_FRINGE_BITMAP)
859 { 859 {
860 draw_fringe_bitmap_1 (w, row, 0, 2, bm); 860 draw_fringe_bitmap_1 (w, row, left_p, 2, bm);
861 overlay = EQ (cursor, Qbox) ? 3 : 1; 861 overlay = EQ (cursor, Qbox) ? 3 : 1;
862 } 862 }
863 } 863 }
diff --git a/src/w32term.c b/src/w32term.c
index 7222e26efd2..0b71b7e02b7 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -5136,10 +5136,12 @@ w32_draw_window_cursor (w, glyph_row, x, y, cursor_type, cursor_width, on_p, act
5136 } 5136 }
5137 5137
5138 if (glyph_row->exact_window_width_line_p 5138 if (glyph_row->exact_window_width_line_p
5139 && w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA]) 5139 && (glyph_row->reversed_p
5140 ? (w->phys_cursor.hpos < 0)
5141 : (w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA])))
5140 { 5142 {
5141 glyph_row->cursor_in_fringe_p = 1; 5143 glyph_row->cursor_in_fringe_p = 1;
5142 draw_fringe_bitmap (w, glyph_row, 0); 5144 draw_fringe_bitmap (w, glyph_row, glyph_row->reversed_p);
5143 return; 5145 return;
5144 } 5146 }
5145 5147
diff --git a/src/xdisp.c b/src/xdisp.c
index f93ed533c28..1320b8a7380 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -326,12 +326,14 @@ extern Lisp_Object Voverflow_newline_into_fringe;
326/* Test if overflow newline into fringe. Called with iterator IT 326/* Test if overflow newline into fringe. Called with iterator IT
327 at or past right window margin, and with IT->current_x set. */ 327 at or past right window margin, and with IT->current_x set. */
328 328
329#define IT_OVERFLOW_NEWLINE_INTO_FRINGE(it) \ 329#define IT_OVERFLOW_NEWLINE_INTO_FRINGE(IT) \
330 (!NILP (Voverflow_newline_into_fringe) \ 330 (!NILP (Voverflow_newline_into_fringe) \
331 && FRAME_WINDOW_P (it->f) \ 331 && FRAME_WINDOW_P ((IT)->f) \
332 && WINDOW_RIGHT_FRINGE_WIDTH (it->w) > 0 \ 332 && ((IT)->bidi_it.paragraph_dir == R2L \
333 && it->current_x == it->last_visible_x \ 333 ? (WINDOW_LEFT_FRINGE_WIDTH ((IT)->w) > 0) \
334 && it->line_wrap != WORD_WRAP) 334 : (WINDOW_RIGHT_FRINGE_WIDTH ((IT)->w) > 0)) \
335 && (IT)->current_x == (IT)->last_visible_x \
336 && (IT)->line_wrap != WORD_WRAP)
335 337
336#else /* !HAVE_WINDOW_SYSTEM */ 338#else /* !HAVE_WINDOW_SYSTEM */
337#define IT_OVERFLOW_NEWLINE_INTO_FRINGE(it) 0 339#define IT_OVERFLOW_NEWLINE_INTO_FRINGE(it) 0
@@ -12600,9 +12602,6 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
12600 to front, so swap the edge pointers. */ 12602 to front, so swap the edge pointers. */
12601 glyphs_end = end = glyph - 1; 12603 glyphs_end = end = glyph - 1;
12602 glyph += row->used[TEXT_AREA] - 1; 12604 glyph += row->used[TEXT_AREA] - 1;
12603 /* Reverse the known positions in the row. */
12604 last_pos = pos_after = MATRIX_ROW_START_CHARPOS (row) + delta;
12605 pos_before = MATRIX_ROW_END_CHARPOS (row) + delta;
12606 12605
12607 while (glyph > end + 1 12606 while (glyph > end + 1
12608 && INTEGERP (glyph->object) 12607 && INTEGERP (glyph->object)
@@ -12768,7 +12767,10 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
12768 } 12767 }
12769 --glyph; 12768 --glyph;
12770 if (glyph == glyphs_end) /* don't dereference outside TEXT_AREA */ 12769 if (glyph == glyphs_end) /* don't dereference outside TEXT_AREA */
12771 break; 12770 {
12771 x--; /* can't use any pixel_width */
12772 break;
12773 }
12772 x -= glyph->pixel_width; 12774 x -= glyph->pixel_width;
12773 } 12775 }
12774 12776
@@ -16851,20 +16853,23 @@ extend_face_to_end_of_line (it)
16851 - WINDOW_BOX_LEFT_EDGE_X(it->w) 16853 - WINDOW_BOX_LEFT_EDGE_X(it->w)
16852 - WINDOW_TOTAL_FRINGE_WIDTH(it->w) 16854 - WINDOW_TOTAL_FRINGE_WIDTH(it->w)
16853 - row_width; 16855 - row_width;
16854 stretch_ascent = 16856 if (stretch_width > 0)
16855 (((it->ascent + it->descent) 16857 {
16856 * FONT_BASE (font)) / FONT_HEIGHT (font)); 16858 stretch_ascent =
16857 saved_pos = it->position; 16859 (((it->ascent + it->descent)
16858 saved_avoid_cursor = it->avoid_cursor_p; 16860 * FONT_BASE (font)) / FONT_HEIGHT (font));
16859 saved_face_id = it->face_id; 16861 saved_pos = it->position;
16860 bzero (&it->position, sizeof it->position); 16862 saved_avoid_cursor = it->avoid_cursor_p;
16861 it->avoid_cursor_p = 1; 16863 saved_face_id = it->face_id;
16862 it->face_id = face->id; 16864 bzero (&it->position, sizeof it->position);
16863 append_stretch_glyph (it, make_number (0), stretch_width, 16865 it->avoid_cursor_p = 1;
16864 it->ascent + it->descent, stretch_ascent); 16866 it->face_id = face->id;
16865 it->position = saved_pos; 16867 append_stretch_glyph (it, make_number (0), stretch_width,
16866 it->avoid_cursor_p = saved_avoid_cursor; 16868 it->ascent + it->descent, stretch_ascent);
16867 it->face_id = saved_face_id; 16869 it->position = saved_pos;
16870 it->avoid_cursor_p = saved_avoid_cursor;
16871 it->face_id = saved_face_id;
16872 }
16868 } 16873 }
16869#endif /* HAVE_WINDOW_SYSTEM */ 16874#endif /* HAVE_WINDOW_SYSTEM */
16870 } 16875 }
@@ -23221,7 +23226,7 @@ notice_overwritten_cursor (w, area, x0, x1, y0, y1)
23221 if (row->cursor_in_fringe_p) 23226 if (row->cursor_in_fringe_p)
23222 { 23227 {
23223 row->cursor_in_fringe_p = 0; 23228 row->cursor_in_fringe_p = 0;
23224 draw_fringe_bitmap (w, row, 0); 23229 draw_fringe_bitmap (w, row, row->reversed_p);
23225 w->phys_cursor_on_p = 0; 23230 w->phys_cursor_on_p = 0;
23226 return; 23231 return;
23227 } 23232 }
@@ -23322,7 +23327,9 @@ draw_phys_cursor_glyph (w, row, hl)
23322 /* If cursor hpos is out of bounds, don't draw garbage. This can 23327 /* If cursor hpos is out of bounds, don't draw garbage. This can
23323 happen in mini-buffer windows when switching between echo area 23328 happen in mini-buffer windows when switching between echo area
23324 glyphs and mini-buffer. */ 23329 glyphs and mini-buffer. */
23325 if (w->phys_cursor.hpos < row->used[TEXT_AREA]) 23330 if ((row->reversed_p
23331 ? (w->phys_cursor.hpos >= 0)
23332 : (w->phys_cursor.hpos < row->used[TEXT_AREA])))
23326 { 23333 {
23327 int on_p = w->phys_cursor_on_p; 23334 int on_p = w->phys_cursor_on_p;
23328 int x1; 23335 int x1;
@@ -23402,7 +23409,7 @@ erase_phys_cursor (w)
23402 if (cursor_row->cursor_in_fringe_p) 23409 if (cursor_row->cursor_in_fringe_p)
23403 { 23410 {
23404 cursor_row->cursor_in_fringe_p = 0; 23411 cursor_row->cursor_in_fringe_p = 0;
23405 draw_fringe_bitmap (w, cursor_row, 0); 23412 draw_fringe_bitmap (w, cursor_row, cursor_row->reversed_p);
23406 goto mark_cursor_off; 23413 goto mark_cursor_off;
23407 } 23414 }
23408 23415
@@ -23411,7 +23418,9 @@ erase_phys_cursor (w)
23411 should have cleared the cursor. Note that we wouldn't be 23418 should have cleared the cursor. Note that we wouldn't be
23412 able to erase the cursor in this case because we don't have a 23419 able to erase the cursor in this case because we don't have a
23413 cursor glyph at hand. */ 23420 cursor glyph at hand. */
23414 if (w->phys_cursor.hpos >= cursor_row->used[TEXT_AREA]) 23421 if ((cursor_row->reversed_p
23422 ? (w->phys_cursor.hpos < 0)
23423 : (w->phys_cursor.hpos >= cursor_row->used[TEXT_AREA])))
23415 goto mark_cursor_off; 23424 goto mark_cursor_off;
23416 23425
23417 /* If the cursor is in the mouse face area, redisplay that when 23426 /* If the cursor is in the mouse face area, redisplay that when
diff --git a/src/xterm.c b/src/xterm.c
index 29ed5bb865c..712d4aaa162 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -7492,36 +7492,40 @@ x_draw_window_cursor (w, glyph_row, x, y, cursor_type, cursor_width, on_p, activ
7492 w->phys_cursor_on_p = 1; 7492 w->phys_cursor_on_p = 1;
7493 7493
7494 if (glyph_row->exact_window_width_line_p 7494 if (glyph_row->exact_window_width_line_p
7495 && w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA]) 7495 && (glyph_row->reversed_p
7496 ? (w->phys_cursor.hpos < 0)
7497 : (w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA])))
7496 { 7498 {
7497 glyph_row->cursor_in_fringe_p = 1; 7499 glyph_row->cursor_in_fringe_p = 1;
7498 draw_fringe_bitmap (w, glyph_row, 0); 7500 draw_fringe_bitmap (w, glyph_row, glyph_row->reversed_p);
7499 } 7501 }
7500 else 7502 else
7501 switch (cursor_type)
7502 { 7503 {
7503 case HOLLOW_BOX_CURSOR: 7504 switch (cursor_type)
7504 x_draw_hollow_cursor (w, glyph_row); 7505 {
7505 break; 7506 case HOLLOW_BOX_CURSOR:
7507 x_draw_hollow_cursor (w, glyph_row);
7508 break;
7506 7509
7507 case FILLED_BOX_CURSOR: 7510 case FILLED_BOX_CURSOR:
7508 draw_phys_cursor_glyph (w, glyph_row, DRAW_CURSOR); 7511 draw_phys_cursor_glyph (w, glyph_row, DRAW_CURSOR);
7509 break; 7512 break;
7510 7513
7511 case BAR_CURSOR: 7514 case BAR_CURSOR:
7512 x_draw_bar_cursor (w, glyph_row, cursor_width, BAR_CURSOR); 7515 x_draw_bar_cursor (w, glyph_row, cursor_width, BAR_CURSOR);
7513 break; 7516 break;
7514 7517
7515 case HBAR_CURSOR: 7518 case HBAR_CURSOR:
7516 x_draw_bar_cursor (w, glyph_row, cursor_width, HBAR_CURSOR); 7519 x_draw_bar_cursor (w, glyph_row, cursor_width, HBAR_CURSOR);
7517 break; 7520 break;
7518 7521
7519 case NO_CURSOR: 7522 case NO_CURSOR:
7520 w->phys_cursor_width = 0; 7523 w->phys_cursor_width = 0;
7521 break; 7524 break;
7522 7525
7523 default: 7526 default:
7524 abort (); 7527 abort ();
7528 }
7525 } 7529 }
7526 7530
7527#ifdef HAVE_X_I18N 7531#ifdef HAVE_X_I18N