aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-09-21 10:48:19 -0700
committerPaul Eggert2011-09-21 10:48:19 -0700
commit4c0078d4ab7fa8c234fa8098ec3a9686199edbff (patch)
tree94584f6a647d7d9ab5da97842dcc37e75d6c03fe /src
parentd311d28c3f8a3c43e6ef33d68b852c5ea7f13239 (diff)
parente233ce558d12fdf9e0e69ea30c4558ec7477fea4 (diff)
downloademacs-4c0078d4ab7fa8c234fa8098ec3a9686199edbff.tar.gz
emacs-4c0078d4ab7fa8c234fa8098ec3a9686199edbff.zip
Merge from trunk.
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit70
-rw-r--r--src/ChangeLog95
-rw-r--r--src/bidi.c20
-rw-r--r--src/dispextern.h16
-rw-r--r--src/fileio.c5
-rw-r--r--src/lread.c2
-rw-r--r--src/search.c4
-rw-r--r--src/xdisp.c199
-rw-r--r--src/xfns.c2
-rw-r--r--src/xmenu.c2
10 files changed, 325 insertions, 90 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index 0f51a00ea76..b908ef005d6 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -483,83 +483,83 @@ end
483define pgx 483define pgx
484 set $g = $arg0 484 set $g = $arg0
485 # CHAR_GLYPH 485 # CHAR_GLYPH
486 if ($g->type == 0) 486 if ($g.type == 0)
487 if ($g->u.ch >= ' ' && $g->u.ch < 127) 487 if ($g.u.ch >= ' ' && $g.u.ch < 127)
488 printf "CHAR[%c]", $g->u.ch 488 printf "CHAR[%c]", $g.u.ch
489 else 489 else
490 printf "CHAR[0x%x]", $g->u.ch 490 printf "CHAR[0x%x]", $g.u.ch
491 end 491 end
492 end 492 end
493 # COMPOSITE_GLYPH 493 # COMPOSITE_GLYPH
494 if ($g->type == 1) 494 if ($g.type == 1)
495 printf "COMP[%d (%d..%d)]", $g->u.cmp.id, $g->slice.cmp.from, $g->slice.cmp.to 495 printf "COMP[%d (%d..%d)]", $g.u.cmp.id, $g.slice.cmp.from, $g.slice.cmp.to
496 end 496 end
497 # GLYPHLESS_GLYPH 497 # GLYPHLESS_GLYPH
498 if ($g->type == 2) 498 if ($g.type == 2)
499 printf "GLYPHLESS[" 499 printf "GLYPHLESS["
500 if ($g->u.glyphless.method == 0) 500 if ($g.u.glyphless.method == 0)
501 printf "THIN]" 501 printf "THIN]"
502 end 502 end
503 if ($g->u.glyphless.method == 1) 503 if ($g.u.glyphless.method == 1)
504 printf "EMPTY]" 504 printf "EMPTY]"
505 end 505 end
506 if ($g->u.glyphless.method == 2) 506 if ($g.u.glyphless.method == 2)
507 printf "ACRO]" 507 printf "ACRO]"
508 end 508 end
509 if ($g->u.glyphless.method == 3) 509 if ($g.u.glyphless.method == 3)
510 printf "HEX]" 510 printf "HEX]"
511 end 511 end
512 end 512 end
513 # IMAGE_GLYPH 513 # IMAGE_GLYPH
514 if ($g->type == 3) 514 if ($g.type == 3)
515 printf "IMAGE[%d]", $g->u.img_id 515 printf "IMAGE[%d]", $g.u.img_id
516 end 516 end
517 # STRETCH_GLYPH 517 # STRETCH_GLYPH
518 if ($g->type == 4) 518 if ($g.type == 4)
519 printf "STRETCH[%d+%d]", $g->u.stretch.height, $g->u.stretch.ascent 519 printf "STRETCH[%d+%d]", $g.u.stretch.height, $g.u.stretch.ascent
520 end 520 end
521 xgettype ($g->object) 521 xgettype ($g.object)
522 if ($type == Lisp_String) 522 if ($type == Lisp_String)
523 printf " str=%x[%d]", $g->object, $g->charpos 523 printf " str=%x[%d]", $g.object, $g.charpos
524 else 524 else
525 printf " pos=%d", $g->charpos 525 printf " pos=%d", $g.charpos
526 end 526 end
527 # For characters, print their resolved level and bidi type 527 # For characters, print their resolved level and bidi type
528 if ($g->type == 0) 528 if ($g.type == 0)
529 printf " blev=%d,btyp=", $g->resolved_level 529 printf " blev=%d,btyp=", $g.resolved_level
530 pbiditype $g->bidi_type 530 pbiditype $g.bidi_type
531 end 531 end
532 printf " w=%d a+d=%d+%d", $g->pixel_width, $g->ascent, $g->descent 532 printf " w=%d a+d=%d+%d", $g.pixel_width, $g.ascent, $g.descent
533 # If not DEFAULT_FACE_ID 533 # If not DEFAULT_FACE_ID
534 if ($g->face_id != 0) 534 if ($g.face_id != 0)
535 printf " face=%d", $g->face_id 535 printf " face=%d", $g.face_id
536 end 536 end
537 if ($g->voffset) 537 if ($g.voffset)
538 printf " vof=%d", $g->voffset 538 printf " vof=%d", $g.voffset
539 end 539 end
540 if ($g->multibyte_p) 540 if ($g.multibyte_p)
541 printf " MB" 541 printf " MB"
542 end 542 end
543 if ($g->padding_p) 543 if ($g.padding_p)
544 printf " PAD" 544 printf " PAD"
545 end 545 end
546 if ($g->glyph_not_available_p) 546 if ($g.glyph_not_available_p)
547 printf " N/A" 547 printf " N/A"
548 end 548 end
549 if ($g->overlaps_vertically_p) 549 if ($g.overlaps_vertically_p)
550 printf " OVL" 550 printf " OVL"
551 end 551 end
552 if ($g->avoid_cursor_p) 552 if ($g.avoid_cursor_p)
553 printf " AVOID" 553 printf " AVOID"
554 end 554 end
555 if ($g->left_box_line_p) 555 if ($g.left_box_line_p)
556 printf " [" 556 printf " ["
557 end 557 end
558 if ($g->right_box_line_p) 558 if ($g.right_box_line_p)
559 printf " ]" 559 printf " ]"
560 end 560 end
561 if ($g->slice.img.x || $g->slice.img.y || $g->slice.img.width || $g->slice.img.height) 561 if ($g.slice.img.x || $g.slice.img.y || $g.slice.img.width || $g.slice.img.height)
562 printf " slice=%d,%d,%d,%d" ,$g->slice.img.x, $g->slice.img.y, $g->slice.img.width, $g->slice.img.height 562 printf " slice=%d,%d,%d,%d" ,$g.slice.img.x, $g.slice.img.y, $g.slice.img.width, $g.slice.img.height
563 end 563 end
564 printf "\n" 564 printf "\n"
565end 565end
diff --git a/src/ChangeLog b/src/ChangeLog
index 1f8fd4f6b50..de618a225e3 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -744,6 +744,99 @@
744 rather than rolling our own approximation. 744 rather than rolling our own approximation.
745 (SCROLL_BAR_VEC_SIZE): Remove; not used. 745 (SCROLL_BAR_VEC_SIZE): Remove; not used.
746 746
7472011-09-21 Eli Zaretskii <eliz@gnu.org>
748
749 * xdisp.c (pop_it): Allow it->object that is a cons cell to pass
750 the xassert test.
751
752 * dispextern.h (struct it): Update the comment documenting what
753 can it->OBJECT be.
754
7552011-09-20 Eli Zaretskii <eliz@gnu.org>
756
757 * xdisp.c (set_cursor_from_row): If the row ends in a newline from
758 a display string, extend search for cursor position to end of row.
759 (find_row_edges): If the row ends in a newline from a display
760 string, increment its MATRIX_ROW_END_CHARPOS by one. (Bug#9549)
761 Handle the case of a display string with multiple newlines.
762 (Fcurrent_bidi_paragraph_direction): Fix search for previous
763 non-empty line. Fixes confusing cursor motion with arrow keys at
764 the beginning of a line that starts with whitespace.
765
7662011-09-19 Lars Magne Ingebrigtsen <larsi@gnus.org>
767
768 * lread.c (Fread_from_string): Document what FINAL-STRING-INDEX is
769 (bug#9493).
770
7712011-09-18 Chong Yidong <cyd@stupidchicken.com>
772
773 * xfns.c (Fx_create_frame): Handle the bitmapIcon resource as
774 boolean (Bug#9154).
775
7762011-09-18 Eli Zaretskii <eliz@gnu.org>
777
778 * xdisp.c (display_line): Record maximum and minimum buffer
779 positions even if no glyphs were produced (e.g., by a zero-width
780 stretch). Fixes bug#9530 on a TTY. Under word-wrap, don't record
781 buffer positions that will be removed from the glyph row because
782 they don't fit.
783 (produce_stretch_glyph): Fix a bug in :align-to on a TTY when the
784 column is beyond frame width: don't subtract 1 "pixel" when
785 computing width of the stretch.
786 (reseat_at_next_visible_line_start): Undo the change made on
787 2011-09-17 that saved paragraph information and restored it after
788 the call to `reseat'. (Bug#9545)
789
7902011-09-18 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
791
792 * xdisp.c (expose_window): Save original value of phys_cursor_on_p
793 and turn window cursor on if cleared (Bug#9415).
794
7952011-09-18 Andreas Schwab <schwab@linux-m68k.org>
796
797 * search.c (boyer_moore): Take unibyte characters from pattern
798 literally. (Bug#9458)
799
8002011-09-18 Eli Zaretskii <eliz@gnu.org>
801
802 * xdisp.c (reseat_at_next_visible_line_start): Fix last change.
803
8042011-09-18 Paul Eggert <eggert@cs.ucla.edu>
805
806 Fix minor problem found by static checking.
807 * xdisp.c (reseat_at_next_visible_line_start): Mark locals as
808 initialized, to pacify gcc -Wuninitialized.
809
810 * fileio.c: Report proper errno when syscall falls.
811 (Finsert_file_contents): Save and restore errno,
812 so that report_file_error outputs the correct diagnostic.
813 (Fwrite_region) [CLASH_DETECTION]: Likewise.
814
8152011-09-18 Eli Zaretskii <eliz@gnu.org>
816
817 * .gdbinit (pgx): Fix references to fields of `struct glyph'.
818
8192011-09-17 Eli Zaretskii <eliz@gnu.org>
820
821 * xdisp.c (produce_stretch_glyph): Another fix for changes made on
822 2011-08-30T17:32:44Z!eliz@gnu.org. (Bug#9530)
823
8242011-09-17 Eli Zaretskii <eliz@gnu.org>
825
826 * xdisp.c (reseat_at_next_visible_line_start): Keep information
827 about the current paragraph and restore it after the call to
828 reseat.
829
830 * bidi.c (MAX_PARAGRAPH_SEARCH): New macro.
831 (bidi_find_paragraph_start): Search back for paragraph beginning
832 at most MAX_PARAGRAPH_SEARCH lines; if not found, return BEGV_BYTE.
833 (bidi_move_to_visually_next): Only trigger paragraph-related
834 computations when the last character is a newline or at EOB, not
835 just any NEUTRAL_B. (Bug#9470)
836
837 * xdisp.c (set_cursor_from_row): Don't invoke special treatment of
838 truncated lines if point is covered by a display string. (Bug#9524)
839
7472011-09-16 Paul Eggert <eggert@cs.ucla.edu> 8402011-09-16 Paul Eggert <eggert@cs.ucla.edu>
748 841
749 * xselect.c: Relax test for outgoing X longs (Bug#9498). 842 * xselect.c: Relax test for outgoing X longs (Bug#9498).
@@ -2044,7 +2137,7 @@
2044 underline, overline, and strike-through. 2137 underline, overline, and strike-through.
2045 (ns_dumpglyphs_image, ns_dumpglyphs_stretch): Add call to 2138 (ns_dumpglyphs_image, ns_dumpglyphs_stretch): Add call to
2046 ns_draw_text_decoration. Change treatment of cursor drawing to 2139 ns_draw_text_decoration. Change treatment of cursor drawing to
2047 accomodate underlining, etc. 2140 accommodate underlining, etc.
2048 2141
20492011-07-28 Eli Zaretskii <eliz@gnu.org> 21422011-07-28 Eli Zaretskii <eliz@gnu.org>
2050 2143
diff --git a/src/bidi.c b/src/bidi.c
index 11013edc70d..cac12854f33 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -1071,15 +1071,25 @@ bidi_at_paragraph_end (ptrdiff_t charpos, ptrdiff_t bytepos)
1071 return val; 1071 return val;
1072} 1072}
1073 1073
1074/* On my 2005-vintage machine, searching back for paragraph start
1075 takes ~1 ms per line. And bidi_paragraph_init is called 4 times
1076 when user types C-p. The number below limits each call to
1077 bidi_paragraph_init to about 10 ms. */
1078#define MAX_PARAGRAPH_SEARCH 7500
1079
1074/* Find the beginning of this paragraph by looking back in the buffer. 1080/* Find the beginning of this paragraph by looking back in the buffer.
1075 Value is the byte position of the paragraph's beginning. */ 1081 Value is the byte position of the paragraph's beginning, or
1082 BEGV_BYTE if paragraph_start_re is still not found after looking
1083 back MAX_PARAGRAPH_SEARCH lines in the buffer. */
1076static ptrdiff_t 1084static ptrdiff_t
1077bidi_find_paragraph_start (ptrdiff_t pos, ptrdiff_t pos_byte) 1085bidi_find_paragraph_start (ptrdiff_t pos, ptrdiff_t pos_byte)
1078{ 1086{
1079 Lisp_Object re = paragraph_start_re; 1087 Lisp_Object re = paragraph_start_re;
1080 ptrdiff_t limit = ZV, limit_byte = ZV_BYTE; 1088 ptrdiff_t limit = ZV, limit_byte = ZV_BYTE;
1089 ptrdiff_t n = 0;
1081 1090
1082 while (pos_byte > BEGV_BYTE 1091 while (pos_byte > BEGV_BYTE
1092 && n++ < MAX_PARAGRAPH_SEARCH
1083 && fast_looking_at (re, pos, pos_byte, limit, limit_byte, Qnil) < 0) 1093 && fast_looking_at (re, pos, pos_byte, limit, limit_byte, Qnil) < 0)
1084 { 1094 {
1085 /* FIXME: What if the paragraph beginning is covered by a 1095 /* FIXME: What if the paragraph beginning is covered by a
@@ -1089,6 +1099,8 @@ bidi_find_paragraph_start (ptrdiff_t pos, ptrdiff_t pos_byte)
1089 pos = find_next_newline_no_quit (pos - 1, -1); 1099 pos = find_next_newline_no_quit (pos - 1, -1);
1090 pos_byte = CHAR_TO_BYTE (pos); 1100 pos_byte = CHAR_TO_BYTE (pos);
1091 } 1101 }
1102 if (n >= MAX_PARAGRAPH_SEARCH)
1103 pos_byte = BEGV_BYTE;
1092 return pos_byte; 1104 return pos_byte;
1093} 1105}
1094 1106
@@ -2239,7 +2251,8 @@ bidi_move_to_visually_next (struct bidi_it *bidi_it)
2239 GCPRO1 (bidi_it->string.lstring); 2251 GCPRO1 (bidi_it->string.lstring);
2240 2252
2241 /* If we just passed a newline, initialize for the next line. */ 2253 /* If we just passed a newline, initialize for the next line. */
2242 if (!bidi_it->first_elt && bidi_it->orig_type == NEUTRAL_B) 2254 if (!bidi_it->first_elt
2255 && (bidi_it->ch == '\n' || bidi_it->ch == BIDI_EOB))
2243 bidi_line_init (bidi_it); 2256 bidi_line_init (bidi_it);
2244 2257
2245 /* Prepare the sentinel iterator state, and cache it. When we bump 2258 /* Prepare the sentinel iterator state, and cache it. When we bump
@@ -2320,7 +2333,8 @@ bidi_move_to_visually_next (struct bidi_it *bidi_it)
2320 reordering, whereas we _must_ know the paragraph base direction 2333 reordering, whereas we _must_ know the paragraph base direction
2321 _before_ we process the paragraph's text, since the base 2334 _before_ we process the paragraph's text, since the base
2322 direction affects the reordering. */ 2335 direction affects the reordering. */
2323 if (bidi_it->scan_dir == 1 && bidi_it->orig_type == NEUTRAL_B) 2336 if (bidi_it->scan_dir == 1
2337 && (bidi_it->ch == '\n' || bidi_it->ch == BIDI_EOB))
2324 { 2338 {
2325 /* The paragraph direction of the entire string, once 2339 /* The paragraph direction of the entire string, once
2326 determined, is in effect for the entire string. Setting the 2340 determined, is in effect for the entire string. Setting the
diff --git a/src/dispextern.h b/src/dispextern.h
index 76f3686c37a..dfef2884297 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2398,9 +2398,19 @@ struct it
2398 Lisp_Object font_height; 2398 Lisp_Object font_height;
2399 2399
2400 /* Object and position where the current display element came from. 2400 /* Object and position where the current display element came from.
2401 Object can be a Lisp string in case the current display element 2401 Object is normally the buffer which is being rendered, but it can
2402 comes from an overlay string, or it is buffer. It may also be nil 2402 also be a Lisp string in case the current display element comes
2403 during mode-line update. Position is a position in object. */ 2403 from an overlay string or from a display string (before- or
2404 after-string). It may also be nil when a C string is being
2405 rendered, e.g., during mode-line or header-line update. It can
2406 also be a cons cell of the form `(space ...)', when we produce a
2407 stretch glyph from a `display' specification. Finally, it can be
2408 a zero-valued Lisp integer, but only temporarily, when we are
2409 producing special glyphs for display purposes, like truncation
2410 and continuation glyphs, or blanks that extend each line to the
2411 edge of the window on a TTY.
2412
2413 Position is the current iterator position in object. */
2404 Lisp_Object object; 2414 Lisp_Object object;
2405 struct text_pos position; 2415 struct text_pos position;
2406 2416
diff --git a/src/fileio.c b/src/fileio.c
index 486c3d4c175..110977b3a60 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3189,6 +3189,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3189 Lisp_Object p; 3189 Lisp_Object p;
3190 ptrdiff_t total = 0; 3190 ptrdiff_t total = 0;
3191 int not_regular = 0; 3191 int not_regular = 0;
3192 int save_errno = 0;
3192 char read_buf[READ_BUF_SIZE]; 3193 char read_buf[READ_BUF_SIZE];
3193 struct coding_system coding; 3194 struct coding_system coding;
3194 char buffer[1 << 14]; 3195 char buffer[1 << 14];
@@ -3253,6 +3254,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3253#endif /* WINDOWSNT */ 3254#endif /* WINDOWSNT */
3254 { 3255 {
3255 badopen: 3256 badopen:
3257 save_errno = errno;
3256 if (NILP (visit)) 3258 if (NILP (visit))
3257 report_file_error ("Opening input file", Fcons (orig_filename, Qnil)); 3259 report_file_error ("Opening input file", Fcons (orig_filename, Qnil));
3258 st.st_mtime = -1; 3260 st.st_mtime = -1;
@@ -4288,6 +4290,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4288 && current_buffer->modtime == -1) 4290 && current_buffer->modtime == -1)
4289 { 4291 {
4290 /* If visiting nonexistent file, return nil. */ 4292 /* If visiting nonexistent file, return nil. */
4293 errno = save_errno;
4291 report_file_error ("Opening input file", Fcons (orig_filename, Qnil)); 4294 report_file_error ("Opening input file", Fcons (orig_filename, Qnil));
4292 } 4295 }
4293 4296
@@ -4625,7 +4628,9 @@ This calls `write-region-annotate-functions' at the start, and
4625 if (ret < 0) 4628 if (ret < 0)
4626 { 4629 {
4627#ifdef CLASH_DETECTION 4630#ifdef CLASH_DETECTION
4631 save_errno = errno;
4628 if (!auto_saving) unlock_file (lockname); 4632 if (!auto_saving) unlock_file (lockname);
4633 errno = save_errno;
4629#endif /* CLASH_DETECTION */ 4634#endif /* CLASH_DETECTION */
4630 UNGCPRO; 4635 UNGCPRO;
4631 report_file_error ("Lseek error", Fcons (filename, Qnil)); 4636 report_file_error ("Lseek error", Fcons (filename, Qnil));
diff --git a/src/lread.c b/src/lread.c
index 3a1b3f0c9c5..7b3e0df5e8a 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1967,6 +1967,8 @@ STREAM or the value of `standard-input' may be:
1967DEFUN ("read-from-string", Fread_from_string, Sread_from_string, 1, 3, 0, 1967DEFUN ("read-from-string", Fread_from_string, Sread_from_string, 1, 3, 0,
1968 doc: /* Read one Lisp expression which is represented as text by STRING. 1968 doc: /* Read one Lisp expression which is represented as text by STRING.
1969Returns a cons: (OBJECT-READ . FINAL-STRING-INDEX). 1969Returns a cons: (OBJECT-READ . FINAL-STRING-INDEX).
1970FINAL-STRING-INDEX is an integer giving the position of the next
1971 remaining chararacter in STRING.
1970START and END optionally delimit a substring of STRING from which to read; 1972START and END optionally delimit a substring of STRING from which to read;
1971 they default to 0 and (length STRING) respectively. */) 1973 they default to 0 and (length STRING) respectively. */)
1972 (Lisp_Object string, Lisp_Object start, Lisp_Object end) 1974 (Lisp_Object string, Lisp_Object start, Lisp_Object end)
diff --git a/src/search.c b/src/search.c
index 7dc88268c76..dc76998d000 100644
--- a/src/search.c
+++ b/src/search.c
@@ -1761,7 +1761,7 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat,
1761 ch = -1; 1761 ch = -1;
1762 } 1762 }
1763 1763
1764 if (ch >= 0200) 1764 if (ch >= 0200 && multibyte)
1765 j = (ch & 0x3F) | 0200; 1765 j = (ch & 0x3F) | 0200;
1766 else 1766 else
1767 j = *ptr; 1767 j = *ptr;
@@ -1780,7 +1780,7 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat,
1780 while (1) 1780 while (1)
1781 { 1781 {
1782 TRANSLATE (ch, inverse_trt, ch); 1782 TRANSLATE (ch, inverse_trt, ch);
1783 if (ch >= 0200) 1783 if (ch >= 0200 && multibyte)
1784 j = (ch & 0x3F) | 0200; 1784 j = (ch & 0x3F) | 0200;
1785 else 1785 else
1786 j = ch; 1786 j = ch;
diff --git a/src/xdisp.c b/src/xdisp.c
index 763862cd0e3..49c4b74c828 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -5467,7 +5467,8 @@ pop_it (struct it *it)
5467 && IT_BYTEPOS (*it) == it->bidi_it.bytepos) 5467 && IT_BYTEPOS (*it) == it->bidi_it.bytepos)
5468 || (STRINGP (it->object) 5468 || (STRINGP (it->object)
5469 && IT_STRING_CHARPOS (*it) == it->bidi_it.charpos 5469 && IT_STRING_CHARPOS (*it) == it->bidi_it.charpos
5470 && IT_STRING_BYTEPOS (*it) == it->bidi_it.bytepos)); 5470 && IT_STRING_BYTEPOS (*it) == it->bidi_it.bytepos)
5471 || (CONSP (it->object) && it->method == GET_FROM_STRETCH));
5471 } 5472 }
5472} 5473}
5473 5474
@@ -13644,15 +13645,17 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
13644 /* A truncated row may not include PT among its 13645 /* A truncated row may not include PT among its
13645 character positions. Setting the cursor inside the 13646 character positions. Setting the cursor inside the
13646 scroll margin will trigger recalculation of hscroll 13647 scroll margin will trigger recalculation of hscroll
13647 in hscroll_window_tree. */ 13648 in hscroll_window_tree. But if a display string
13648 || (row->truncated_on_left_p && pt_old < bpos_min) 13649 covers point, defer to the string-handling code
13649 || (row->truncated_on_right_p && pt_old > bpos_max) 13650 below to figure this out. */
13650 /* Zero-width characters produce no glyphs. */
13651 || (!string_seen 13651 || (!string_seen
13652 && !empty_line_p 13652 && ((row->truncated_on_left_p && pt_old < bpos_min)
13653 && (row->reversed_p 13653 || (row->truncated_on_right_p && pt_old > bpos_max)
13654 ? glyph_after > glyphs_end 13654 /* Zero-width characters produce no glyphs. */
13655 : glyph_after < glyphs_end))) 13655 || (!empty_line_p
13656 && (row->reversed_p
13657 ? glyph_after > glyphs_end
13658 : glyph_after < glyphs_end)))))
13656 { 13659 {
13657 cursor = glyph_after; 13660 cursor = glyph_after;
13658 x = -1; 13661 x = -1;
@@ -13671,6 +13674,17 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
13671 13674
13672 x = -1; 13675 x = -1;
13673 13676
13677 /* If the row ends in a newline from a display string,
13678 reordering could have moved the glyphs belonging to the
13679 string out of the [GLYPH_BEFORE..GLYPH_AFTER] range. So
13680 in this case we extend the search to the last glyph in
13681 the row that was not inserted by redisplay. */
13682 if (row->ends_in_newline_from_string_p)
13683 {
13684 glyph_after = end;
13685 pos_after = MATRIX_ROW_END_CHARPOS (row) + delta;
13686 }
13687
13674 /* GLYPH_BEFORE and GLYPH_AFTER are the glyphs that 13688 /* GLYPH_BEFORE and GLYPH_AFTER are the glyphs that
13675 correspond to POS_BEFORE and POS_AFTER, respectively. We 13689 correspond to POS_BEFORE and POS_AFTER, respectively. We
13676 need START and STOP in the order that corresponds to the 13690 need START and STOP in the order that corresponds to the
@@ -18346,7 +18360,8 @@ find_row_edges (struct it *it, struct glyph_row *row,
18346 Line ends in a newline from buffer eol_pos + 1 18360 Line ends in a newline from buffer eol_pos + 1
18347 Line is continued from buffer max_pos + 1 18361 Line is continued from buffer max_pos + 1
18348 Line is truncated on right it->current.pos 18362 Line is truncated on right it->current.pos
18349 Line ends in a newline from string max_pos 18363 Line ends in a newline from string max_pos + 1(*)
18364 (*) + 1 only when line ends in a forward scan
18350 Line is continued from string max_pos 18365 Line is continued from string max_pos
18351 Line is continued from display vector max_pos 18366 Line is continued from display vector max_pos
18352 Line is entirely from a string min_pos == max_pos 18367 Line is entirely from a string min_pos == max_pos
@@ -18359,8 +18374,76 @@ find_row_edges (struct it *it, struct glyph_row *row,
18359 row->maxpos = it->current.pos; 18374 row->maxpos = it->current.pos;
18360 else if (row->used[TEXT_AREA]) 18375 else if (row->used[TEXT_AREA])
18361 { 18376 {
18362 if (row->ends_in_newline_from_string_p) 18377 int seen_this_string = 0;
18363 SET_TEXT_POS (row->maxpos, max_pos, max_bpos); 18378 struct glyph_row *r1 = row - 1;
18379
18380 /* Did we see the same display string on the previous row? */
18381 if (STRINGP (it->object)
18382 /* this is not the first row */
18383 && row > it->w->desired_matrix->rows
18384 /* previous row is not the header line */
18385 && !r1->mode_line_p
18386 /* previous row also ends in a newline from a string */
18387 && r1->ends_in_newline_from_string_p)
18388 {
18389 struct glyph *start, *end;
18390
18391 /* Search for the last glyph of the previous row that came
18392 from buffer or string. Depending on whether the row is
18393 L2R or R2L, we need to process it front to back or the
18394 other way round. */
18395 if (!r1->reversed_p)
18396 {
18397 start = r1->glyphs[TEXT_AREA];
18398 end = start + r1->used[TEXT_AREA];
18399 /* Glyphs inserted by redisplay have an integer (zero)
18400 as their object. */
18401 while (end > start
18402 && INTEGERP ((end - 1)->object)
18403 && (end - 1)->charpos <= 0)
18404 --end;
18405 if (end > start)
18406 {
18407 if (EQ ((end - 1)->object, it->object))
18408 seen_this_string = 1;
18409 }
18410 else
18411 abort ();
18412 }
18413 else
18414 {
18415 end = r1->glyphs[TEXT_AREA] - 1;
18416 start = end + r1->used[TEXT_AREA];
18417 while (end < start
18418 && INTEGERP ((end + 1)->object)
18419 && (end + 1)->charpos <= 0)
18420 ++end;
18421 if (end < start)
18422 {
18423 if (EQ ((end + 1)->object, it->object))
18424 seen_this_string = 1;
18425 }
18426 else
18427 abort ();
18428 }
18429 }
18430 /* Take note of each display string that covers a newline only
18431 once, the first time we see it. This is for when a display
18432 string includes more than one newline in it. */
18433 if (row->ends_in_newline_from_string_p && !seen_this_string)
18434 {
18435 /* If we were scanning the buffer forward when we displayed
18436 the string, we want to account for at least one buffer
18437 position that belongs to this row (position covered by
18438 the display string), so that cursor positioning will
18439 consider this row as a candidate when point is at the end
18440 of the visual line represented by this row. This is not
18441 required when scanning back, because max_pos will already
18442 have a much larger value. */
18443 if (CHARPOS (row->end.pos) > max_pos)
18444 INC_BOTH (max_pos, max_bpos);
18445 SET_TEXT_POS (row->maxpos, max_pos, max_bpos);
18446 }
18364 else if (CHARPOS (it->eol_pos) > 0) 18447 else if (CHARPOS (it->eol_pos) > 0)
18365 SET_TEXT_POS (row->maxpos, 18448 SET_TEXT_POS (row->maxpos,
18366 CHARPOS (it->eol_pos) + 1, BYTEPOS (it->eol_pos) + 1); 18449 CHARPOS (it->eol_pos) + 1, BYTEPOS (it->eol_pos) + 1);
@@ -18668,11 +18751,6 @@ display_line (struct it *it)
18668 it->current_x = new_x; 18751 it->current_x = new_x;
18669 it->continuation_lines_width += new_x; 18752 it->continuation_lines_width += new_x;
18670 ++it->hpos; 18753 ++it->hpos;
18671 /* Record the maximum and minimum buffer
18672 positions seen so far in glyphs that will be
18673 displayed by this row. */
18674 if (it->bidi_p)
18675 RECORD_MAX_MIN_POS (it);
18676 if (i == nglyphs - 1) 18754 if (i == nglyphs - 1)
18677 { 18755 {
18678 /* If line-wrap is on, check if a previous 18756 /* If line-wrap is on, check if a previous
@@ -18687,6 +18765,11 @@ display_line (struct it *it)
18687 || IT_DISPLAYING_WHITESPACE (it))) 18765 || IT_DISPLAYING_WHITESPACE (it)))
18688 goto back_to_wrap; 18766 goto back_to_wrap;
18689 18767
18768 /* Record the maximum and minimum buffer
18769 positions seen so far in glyphs that will be
18770 displayed by this row. */
18771 if (it->bidi_p)
18772 RECORD_MAX_MIN_POS (it);
18690 set_iterator_to_next (it, 1); 18773 set_iterator_to_next (it, 1);
18691 if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) 18774 if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
18692 { 18775 {
@@ -18704,6 +18787,8 @@ display_line (struct it *it)
18704 } 18787 }
18705 } 18788 }
18706 } 18789 }
18790 else if (it->bidi_p)
18791 RECORD_MAX_MIN_POS (it);
18707 } 18792 }
18708 else if (CHAR_GLYPH_PADDING_P (*glyph) 18793 else if (CHAR_GLYPH_PADDING_P (*glyph)
18709 && !FRAME_WINDOW_P (it->f)) 18794 && !FRAME_WINDOW_P (it->f))
@@ -18834,6 +18919,10 @@ display_line (struct it *it)
18834 xassert (it->first_visible_x <= it->last_visible_x); 18919 xassert (it->first_visible_x <= it->last_visible_x);
18835 } 18920 }
18836 } 18921 }
18922 /* Even if this display element produced no glyphs at all,
18923 we want to record its position. */
18924 if (it->bidi_p && nglyphs == 0)
18925 RECORD_MAX_MIN_POS (it);
18837 18926
18838 row->ascent = max (row->ascent, it->max_ascent); 18927 row->ascent = max (row->ascent, it->max_ascent);
18839 row->height = max (row->height, it->max_ascent + it->max_descent); 18928 row->height = max (row->height, it->max_ascent + it->max_descent);
@@ -19124,6 +19213,7 @@ See also `bidi-paragraph-direction'. */)
19124 ptrdiff_t pos = BUF_PT (buf); 19213 ptrdiff_t pos = BUF_PT (buf);
19125 ptrdiff_t bytepos = BUF_PT_BYTE (buf); 19214 ptrdiff_t bytepos = BUF_PT_BYTE (buf);
19126 int c; 19215 int c;
19216 void *itb_data = bidi_shelve_cache ();
19127 19217
19128 set_buffer_temp (buf); 19218 set_buffer_temp (buf);
19129 /* bidi_paragraph_init finds the base direction of the paragraph 19219 /* bidi_paragraph_init finds the base direction of the paragraph
@@ -19136,27 +19226,27 @@ See also `bidi-paragraph-direction'. */)
19136 pos--; 19226 pos--;
19137 bytepos = CHAR_TO_BYTE (pos); 19227 bytepos = CHAR_TO_BYTE (pos);
19138 } 19228 }
19139 while ((c = FETCH_BYTE (bytepos)) == '\n' 19229 if (fast_looking_at (build_string ("[\f\t ]*\n"),
19140 || c == ' ' || c == '\t' || c == '\f') 19230 pos, bytepos, ZV, ZV_BYTE, Qnil) > 0)
19141 { 19231 {
19142 if (bytepos <= BEGV_BYTE) 19232 while ((c = FETCH_BYTE (bytepos)) == '\n'
19143 break; 19233 || c == ' ' || c == '\t' || c == '\f')
19144 bytepos--; 19234 {
19145 pos--; 19235 if (bytepos <= BEGV_BYTE)
19236 break;
19237 bytepos--;
19238 pos--;
19239 }
19240 while (!CHAR_HEAD_P (FETCH_BYTE (bytepos)))
19241 bytepos--;
19146 } 19242 }
19147 while (!CHAR_HEAD_P (FETCH_BYTE (bytepos))) 19243 bidi_init_it (pos, bytepos, FRAME_WINDOW_P (SELECTED_FRAME ()), &itb);
19148 bytepos--;
19149 itb.charpos = pos;
19150 itb.bytepos = bytepos;
19151 itb.nchars = -1;
19152 itb.string.s = NULL; 19244 itb.string.s = NULL;
19153 itb.string.lstring = Qnil; 19245 itb.string.lstring = Qnil;
19154 itb.frame_window_p = FRAME_WINDOW_P (SELECTED_FRAME ()); /* guesswork */ 19246 itb.string.bufpos = 0;
19155 itb.first_elt = 1; 19247 itb.string.unibyte = 0;
19156 itb.separator_limit = -1;
19157 itb.paragraph_dir = NEUTRAL_DIR;
19158
19159 bidi_paragraph_init (NEUTRAL_DIR, &itb, 1); 19248 bidi_paragraph_init (NEUTRAL_DIR, &itb, 1);
19249 bidi_unshelve_cache (itb_data, 0);
19160 set_buffer_temp (old); 19250 set_buffer_temp (old);
19161 switch (itb.paragraph_dir) 19251 switch (itb.paragraph_dir)
19162 { 19252 {
@@ -23251,7 +23341,14 @@ produce_stretch_glyph (struct it *it)
23251 23341
23252 if (width > 0 && it->line_wrap != TRUNCATE 23342 if (width > 0 && it->line_wrap != TRUNCATE
23253 && it->current_x + width > it->last_visible_x) 23343 && it->current_x + width > it->last_visible_x)
23254 width = it->last_visible_x - it->current_x - 1; 23344 {
23345 width = it->last_visible_x - it->current_x;
23346#ifdef HAVE_WINDOW_SYSTEM
23347 /* Subtact one more pixel from the stretch width, but only on
23348 GUI frames, since on a TTY each glyph is one "pixel" wide. */
23349 width -= FRAME_WINDOW_P (it->f);
23350#endif
23351 }
23255 23352
23256 if (width > 0 && height > 0 && it->glyph_row) 23353 if (width > 0 && height > 0 && it->glyph_row)
23257 { 23354 {
@@ -23263,14 +23360,7 @@ produce_stretch_glyph (struct it *it)
23263 object = it->w->buffer; 23360 object = it->w->buffer;
23264#ifdef HAVE_WINDOW_SYSTEM 23361#ifdef HAVE_WINDOW_SYSTEM
23265 if (FRAME_WINDOW_P (it->f)) 23362 if (FRAME_WINDOW_P (it->f))
23266 { 23363 append_stretch_glyph (it, object, width, height, ascent);
23267 append_stretch_glyph (it, object, width, height, ascent);
23268 it->pixel_width = width;
23269 it->ascent = it->phys_ascent = ascent;
23270 it->descent = it->phys_descent = height - it->ascent;
23271 it->nglyphs = width > 0 && height > 0 ? 1 : 0;
23272 take_vertical_position_into_account (it);
23273 }
23274 else 23364 else
23275#endif 23365#endif
23276 { 23366 {
@@ -23282,6 +23372,19 @@ produce_stretch_glyph (struct it *it)
23282 it->object = o_object; 23372 it->object = o_object;
23283 } 23373 }
23284 } 23374 }
23375
23376 it->pixel_width = width;
23377#ifdef HAVE_WINDOW_SYSTEM
23378 if (FRAME_WINDOW_P (it->f))
23379 {
23380 it->ascent = it->phys_ascent = ascent;
23381 it->descent = it->phys_descent = height - it->ascent;
23382 it->nglyphs = width > 0 && height > 0 ? 1 : 0;
23383 take_vertical_position_into_account (it);
23384 }
23385 else
23386#endif
23387 it->nglyphs = width;
23285} 23388}
23286 23389
23287#ifdef HAVE_WINDOW_SYSTEM 23390#ifdef HAVE_WINDOW_SYSTEM
@@ -27219,7 +27322,7 @@ expose_window (struct window *w, XRectangle *fr)
27219 { 27322 {
27220 int yb = window_text_bottom_y (w); 27323 int yb = window_text_bottom_y (w);
27221 struct glyph_row *row; 27324 struct glyph_row *row;
27222 int cursor_cleared_p; 27325 int cursor_cleared_p, phys_cursor_on_p;
27223 struct glyph_row *first_overlapping_row, *last_overlapping_row; 27326 struct glyph_row *first_overlapping_row, *last_overlapping_row;
27224 27327
27225 TRACE ((stderr, "expose_window (%d, %d, %d, %d)\n", 27328 TRACE ((stderr, "expose_window (%d, %d, %d, %d)\n",
@@ -27239,6 +27342,13 @@ expose_window (struct window *w, XRectangle *fr)
27239 else 27342 else
27240 cursor_cleared_p = 0; 27343 cursor_cleared_p = 0;
27241 27344
27345 /* If the row containing the cursor extends face to end of line,
27346 then expose_area might overwrite the cursor outside the
27347 rectangle and thus notice_overwritten_cursor might clear
27348 w->phys_cursor_on_p. We remember the original value and
27349 check later if it is changed. */
27350 phys_cursor_on_p = w->phys_cursor_on_p;
27351
27242 /* Update lines intersecting rectangle R. */ 27352 /* Update lines intersecting rectangle R. */
27243 first_overlapping_row = last_overlapping_row = NULL; 27353 first_overlapping_row = last_overlapping_row = NULL;
27244 for (row = w->current_matrix->rows; 27354 for (row = w->current_matrix->rows;
@@ -27305,7 +27415,8 @@ expose_window (struct window *w, XRectangle *fr)
27305 x_draw_vertical_border (w); 27415 x_draw_vertical_border (w);
27306 27416
27307 /* Turn the cursor on again. */ 27417 /* Turn the cursor on again. */
27308 if (cursor_cleared_p) 27418 if (cursor_cleared_p
27419 || (phys_cursor_on_p && !w->phys_cursor_on_p))
27309 update_window_cursor (w, 1); 27420 update_window_cursor (w, 1);
27310 } 27421 }
27311 } 27422 }
diff --git a/src/xfns.c b/src/xfns.c
index 4a7c17e1152..ba73bdba70b 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -3369,7 +3369,7 @@ This function is an internal primitive--use `make-frame' instead. */)
3369 /* We need to do this after creating the X window, so that the 3369 /* We need to do this after creating the X window, so that the
3370 icon-creation functions can say whose icon they're describing. */ 3370 icon-creation functions can say whose icon they're describing. */
3371 x_default_parameter (f, parms, Qicon_type, Qt, 3371 x_default_parameter (f, parms, Qicon_type, Qt,
3372 "bitmapIcon", "BitmapIcon", RES_TYPE_SYMBOL); 3372 "bitmapIcon", "BitmapIcon", RES_TYPE_BOOLEAN);
3373 3373
3374 x_default_parameter (f, parms, Qauto_raise, Qnil, 3374 x_default_parameter (f, parms, Qauto_raise, Qnil,
3375 "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN); 3375 "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN);
diff --git a/src/xmenu.c b/src/xmenu.c
index f7497955e93..eab25d709f6 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -742,7 +742,7 @@ menu_highlight_callback (GtkWidget *widget, gpointer call_data)
742 /* If popup_activated_flag is greater than 1 we are in a popup menu. 742 /* If popup_activated_flag is greater than 1 we are in a popup menu.
743 Don't pass the frame to show_help_event for those. 743 Don't pass the frame to show_help_event for those.
744 Passing frame creates an Emacs event. As we are looping in 744 Passing frame creates an Emacs event. As we are looping in
745 popup_widget_loop, it won't be handeled. Passing NULL shows the tip 745 popup_widget_loop, it won't be handled. Passing NULL shows the tip
746 directly without using an Emacs event. This is what the Lucid code 746 directly without using an Emacs event. This is what the Lucid code
747 does below. */ 747 does below. */
748 show_help_event (popup_activated_flag <= 1 ? cb_data->cl_data->f : NULL, 748 show_help_event (popup_activated_flag <= 1 ? cb_data->cl_data->f : NULL,