aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit70
-rw-r--r--src/ChangeLog93
-rw-r--r--src/bidi.c20
-rw-r--r--src/eval.c8
-rw-r--r--src/fileio.c5
-rw-r--r--src/image.c15
-rw-r--r--src/lread.c2
-rw-r--r--src/search.c4
-rw-r--r--src/xdisp.c77
-rw-r--r--src/xfns.c2
-rw-r--r--src/xmenu.c2
-rw-r--r--src/xselect.c39
12 files changed, 257 insertions, 80 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 15281f47438..12a45918e87 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,94 @@
12011-09-19 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * lread.c (Fread_from_string): Document what FINAL-STRING-INDEX is
4 (bug#9493).
5
62011-09-18 Chong Yidong <cyd@stupidchicken.com>
7
8 * xfns.c (Fx_create_frame): Handle the bitmapIcon resource as
9 boolean (Bug#9154).
10
112011-09-18 Eli Zaretskii <eliz@gnu.org>
12
13 * xdisp.c (display_line): Record maximum and minimum buffer
14 positions even if no glyphs were produced (e.g., by a zero-width
15 stretch). Fixes bug#9530 on a TTY. Under word-wrap, don't record
16 buffer positions that will be removed from the glyph row because
17 they don't fit.
18 (produce_stretch_glyph): Fix a bug in :align-to on a TTY when the
19 column is beyond frame width: don't subtract 1 "pixel" when
20 computing width of the stretch.
21 (reseat_at_next_visible_line_start): Undo the change made on
22 2011-09-17 that saved paragraph information and restored it after
23 the call to `reseat'. (Bug#9545)
24
252011-09-18 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
26
27 * xdisp.c (expose_window): Save original value of phys_cursor_on_p
28 and turn window cursor on if cleared (Bug#9415).
29
302011-09-18 Andreas Schwab <schwab@linux-m68k.org>
31
32 * search.c (boyer_moore): Take unibyte characters from pattern
33 literally. (Bug#9458)
34
352011-09-18 Eli Zaretskii <eliz@gnu.org>
36
37 * xdisp.c (reseat_at_next_visible_line_start): Fix last change.
38
392011-09-18 Paul Eggert <eggert@cs.ucla.edu>
40
41 Fix minor problem found by static checking.
42 * xdisp.c (reseat_at_next_visible_line_start): Mark locals as
43 initialized, to pacify gcc -Wuninitialized.
44
45 * fileio.c: Report proper errno when syscall falls.
46 (Finsert_file_contents): Save and restore errno,
47 so that report_file_error outputs the correct diagnostic.
48 (Fwrite_region) [CLASH_DETECTION]: Likewise.
49
502011-09-18 Eli Zaretskii <eliz@gnu.org>
51
52 * .gdbinit (pgx): Fix references to fields of `struct glyph'.
53
542011-09-17 Eli Zaretskii <eliz@gnu.org>
55
56 * xdisp.c (produce_stretch_glyph): Another fix for changes made on
57 2011-08-30T17:32:44Z!eliz@gnu.org. (Bug#9530)
58
592011-09-17 Eli Zaretskii <eliz@gnu.org>
60
61 * xdisp.c (reseat_at_next_visible_line_start): Keep information
62 about the current paragraph and restore it after the call to
63 reseat.
64
65 * bidi.c (MAX_PARAGRAPH_SEARCH): New macro.
66 (bidi_find_paragraph_start): Search back for paragraph beginning
67 at most MAX_PARAGRAPH_SEARCH lines; if not found, return BEGV_BYTE.
68 (bidi_move_to_visually_next): Only trigger paragraph-related
69 computations when the last character is a newline or at EOB, not
70 just any NEUTRAL_B. (Bug#9470)
71
72 * xdisp.c (set_cursor_from_row): Don't invoke special treatment of
73 truncated lines if point is covered by a display string. (Bug#9524)
74
752011-09-16 Paul Eggert <eggert@cs.ucla.edu>
76
77 * xselect.c: Relax test for outgoing X longs (Bug#9498).
78 (cons_to_x_long): New function.
79 (lisp_data_to_selection_data): Use it. Correct the test for
80 short-versus-long data; it was negated. Break out of vector
81 loop, for efficiency, when a long datum is discovered.
82
832011-09-16 Stefan Monnier <monnier@iro.umontreal.ca>
84
85 * eval.c (Fquote): Document its non-consing behavior (bug#9482).
86
872011-09-16 Eli Zaretskii <eliz@gnu.org>
88
89 * image.c (tiff_handler): Work around a bug in MinGW GCC 3.x (see
90 GCC PR/17406) by declaring this function with external scope.
91
12011-09-15 Paul Eggert <eggert@cs.ucla.edu> 922011-09-15 Paul Eggert <eggert@cs.ucla.edu>
2 93
3 * editfns.c (Fformat): Fix bug in text-property fix (Bug#9514). 94 * editfns.c (Fformat): Fix bug in text-property fix (Bug#9514).
@@ -1281,7 +1372,7 @@
1281 underline, overline, and strike-through. 1372 underline, overline, and strike-through.
1282 (ns_dumpglyphs_image, ns_dumpglyphs_stretch): Add call to 1373 (ns_dumpglyphs_image, ns_dumpglyphs_stretch): Add call to
1283 ns_draw_text_decoration. Change treatment of cursor drawing to 1374 ns_draw_text_decoration. Change treatment of cursor drawing to
1284 accomodate underlining, etc. 1375 accommodate underlining, etc.
1285 1376
12862011-07-28 Eli Zaretskii <eliz@gnu.org> 13772011-07-28 Eli Zaretskii <eliz@gnu.org>
1287 1378
diff --git a/src/bidi.c b/src/bidi.c
index bb29647ea88..3efdc1590df 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -1071,15 +1071,25 @@ bidi_at_paragraph_end (EMACS_INT charpos, EMACS_INT 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 EMACS_INT 1084static EMACS_INT
1077bidi_find_paragraph_start (EMACS_INT pos, EMACS_INT pos_byte) 1085bidi_find_paragraph_start (EMACS_INT pos, EMACS_INT pos_byte)
1078{ 1086{
1079 Lisp_Object re = paragraph_start_re; 1087 Lisp_Object re = paragraph_start_re;
1080 EMACS_INT limit = ZV, limit_byte = ZV_BYTE; 1088 EMACS_INT limit = ZV, limit_byte = ZV_BYTE;
1089 EMACS_INT 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 (EMACS_INT pos, EMACS_INT 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/eval.c b/src/eval.c
index 57a273cd4aa..32b9d366fc3 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -475,6 +475,14 @@ usage: (setq [SYM VAL]...) */)
475 475
476DEFUN ("quote", Fquote, Squote, 1, UNEVALLED, 0, 476DEFUN ("quote", Fquote, Squote, 1, UNEVALLED, 0,
477 doc: /* Return the argument, without evaluating it. `(quote x)' yields `x'. 477 doc: /* Return the argument, without evaluating it. `(quote x)' yields `x'.
478Warning: `quote' does not construct its return value, but just returns
479the value that was pre-constructed by the Lisp reader (see info node
480`(elisp)Printed Representation').
481This means that '(a . b) is not identical to (cons 'a 'b): the former
482does not cons. Quoting should be reserved for constants that will
483never be modified by side-effects, unless you like self-modifying code.
484See the common pitfall in info node `(elisp)Rearrangement' for an example
485of unexpected results when a quoted object is modified.
478usage: (quote ARG) */) 486usage: (quote ARG) */)
479 (Lisp_Object args) 487 (Lisp_Object args)
480{ 488{
diff --git a/src/fileio.c b/src/fileio.c
index 08be41f9fe4..e335dcf027f 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3187,6 +3187,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3187 Lisp_Object p; 3187 Lisp_Object p;
3188 EMACS_INT total = 0; 3188 EMACS_INT total = 0;
3189 int not_regular = 0; 3189 int not_regular = 0;
3190 int save_errno = 0;
3190 char read_buf[READ_BUF_SIZE]; 3191 char read_buf[READ_BUF_SIZE];
3191 struct coding_system coding; 3192 struct coding_system coding;
3192 char buffer[1 << 14]; 3193 char buffer[1 << 14];
@@ -3250,6 +3251,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3250#endif /* WINDOWSNT */ 3251#endif /* WINDOWSNT */
3251 { 3252 {
3252 badopen: 3253 badopen:
3254 save_errno = errno;
3253 if (NILP (visit)) 3255 if (NILP (visit))
3254 report_file_error ("Opening input file", Fcons (orig_filename, Qnil)); 3256 report_file_error ("Opening input file", Fcons (orig_filename, Qnil));
3255 st.st_mtime = -1; 3257 st.st_mtime = -1;
@@ -4281,6 +4283,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4281 && current_buffer->modtime == -1) 4283 && current_buffer->modtime == -1)
4282 { 4284 {
4283 /* If visiting nonexistent file, return nil. */ 4285 /* If visiting nonexistent file, return nil. */
4286 errno = save_errno;
4284 report_file_error ("Opening input file", Fcons (orig_filename, Qnil)); 4287 report_file_error ("Opening input file", Fcons (orig_filename, Qnil));
4285 } 4288 }
4286 4289
@@ -4618,7 +4621,9 @@ This calls `write-region-annotate-functions' at the start, and
4618 if (ret < 0) 4621 if (ret < 0)
4619 { 4622 {
4620#ifdef CLASH_DETECTION 4623#ifdef CLASH_DETECTION
4624 save_errno = errno;
4621 if (!auto_saving) unlock_file (lockname); 4625 if (!auto_saving) unlock_file (lockname);
4626 errno = save_errno;
4622#endif /* CLASH_DETECTION */ 4627#endif /* CLASH_DETECTION */
4623 UNGCPRO; 4628 UNGCPRO;
4624 report_file_error ("Lseek error", Fcons (filename, Qnil)); 4629 report_file_error ("Lseek error", Fcons (filename, Qnil));
diff --git a/src/image.c b/src/image.c
index db201d5a831..ef72745a72f 100644
--- a/src/image.c
+++ b/src/image.c
@@ -6745,10 +6745,20 @@ tiff_size_of_memory (thandle_t data)
6745 return ((tiff_memory_source *) data)->len; 6745 return ((tiff_memory_source *) data)->len;
6746} 6746}
6747 6747
6748/* GCC 3.x on x86 Windows targets has a bug that triggers an internal
6749 compiler error compiling tiff_handler, see Bugzilla bug #17406
6750 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17406). Declaring
6751 this function as external works around that problem. */
6752#if defined (__MINGW32__) && __GNUC__ == 3
6753# define MINGW_STATIC
6754#else
6755# define MINGW_STATIC static
6756#endif
6748 6757
6749static void tiff_handler (const char *, const char *, const char *, va_list) 6758MINGW_STATIC void
6759tiff_handler (const char *, const char *, const char *, va_list)
6750 ATTRIBUTE_FORMAT_PRINTF (3, 0); 6760 ATTRIBUTE_FORMAT_PRINTF (3, 0);
6751static void 6761MINGW_STATIC void
6752tiff_handler (const char *log_format, const char *title, 6762tiff_handler (const char *log_format, const char *title,
6753 const char *format, va_list ap) 6763 const char *format, va_list ap)
6754{ 6764{
@@ -6762,6 +6772,7 @@ tiff_handler (const char *log_format, const char *title,
6762 add_to_log (log_format, build_string (title), 6772 add_to_log (log_format, build_string (title),
6763 make_string (buf, max (0, min (len, sizeof buf - 1)))); 6773 make_string (buf, max (0, min (len, sizeof buf - 1))));
6764} 6774}
6775#undef MINGW_STATIC
6765 6776
6766static void tiff_error_handler (const char *, const char *, va_list) 6777static void tiff_error_handler (const char *, const char *, va_list)
6767 ATTRIBUTE_FORMAT_PRINTF (2, 0); 6778 ATTRIBUTE_FORMAT_PRINTF (2, 0);
diff --git a/src/lread.c b/src/lread.c
index 11c4cf8c8f4..2b1b49ab2fe 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1965,6 +1965,8 @@ STREAM or the value of `standard-input' may be:
1965DEFUN ("read-from-string", Fread_from_string, Sread_from_string, 1, 3, 0, 1965DEFUN ("read-from-string", Fread_from_string, Sread_from_string, 1, 3, 0,
1966 doc: /* Read one Lisp expression which is represented as text by STRING. 1966 doc: /* Read one Lisp expression which is represented as text by STRING.
1967Returns a cons: (OBJECT-READ . FINAL-STRING-INDEX). 1967Returns a cons: (OBJECT-READ . FINAL-STRING-INDEX).
1968FINAL-STRING-INDEX is an integer giving the position of the next
1969 remaining chararacter in STRING.
1968START and END optionally delimit a substring of STRING from which to read; 1970START and END optionally delimit a substring of STRING from which to read;
1969 they default to 0 and (length STRING) respectively. */) 1971 they default to 0 and (length STRING) respectively. */)
1970 (Lisp_Object string, Lisp_Object start, Lisp_Object end) 1972 (Lisp_Object string, Lisp_Object start, Lisp_Object end)
diff --git a/src/search.c b/src/search.c
index b3d67e6c431..a3b4e1dcbce 100644
--- a/src/search.c
+++ b/src/search.c
@@ -1760,7 +1760,7 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat,
1760 ch = -1; 1760 ch = -1;
1761 } 1761 }
1762 1762
1763 if (ch >= 0200) 1763 if (ch >= 0200 && multibyte)
1764 j = (ch & 0x3F) | 0200; 1764 j = (ch & 0x3F) | 0200;
1765 else 1765 else
1766 j = *ptr; 1766 j = *ptr;
@@ -1779,7 +1779,7 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat,
1779 while (1) 1779 while (1)
1780 { 1780 {
1781 TRANSLATE (ch, inverse_trt, ch); 1781 TRANSLATE (ch, inverse_trt, ch);
1782 if (ch >= 0200) 1782 if (ch >= 0200 && multibyte)
1783 j = (ch & 0x3F) | 0200; 1783 j = (ch & 0x3F) | 0200;
1784 else 1784 else
1785 j = ch; 1785 j = ch;
diff --git a/src/xdisp.c b/src/xdisp.c
index ddbbcbb1278..e83ad96b6c8 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -13698,15 +13698,17 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
13698 /* A truncated row may not include PT among its 13698 /* A truncated row may not include PT among its
13699 character positions. Setting the cursor inside the 13699 character positions. Setting the cursor inside the
13700 scroll margin will trigger recalculation of hscroll 13700 scroll margin will trigger recalculation of hscroll
13701 in hscroll_window_tree. */ 13701 in hscroll_window_tree. But if a display string
13702 || (row->truncated_on_left_p && pt_old < bpos_min) 13702 covers point, defer to the string-handling code
13703 || (row->truncated_on_right_p && pt_old > bpos_max) 13703 below to figure this out. */
13704 /* Zero-width characters produce no glyphs. */
13705 || (!string_seen 13704 || (!string_seen
13706 && !empty_line_p 13705 && ((row->truncated_on_left_p && pt_old < bpos_min)
13707 && (row->reversed_p 13706 || (row->truncated_on_right_p && pt_old > bpos_max)
13708 ? glyph_after > glyphs_end 13707 /* Zero-width characters produce no glyphs. */
13709 : glyph_after < glyphs_end))) 13708 || (!empty_line_p
13709 && (row->reversed_p
13710 ? glyph_after > glyphs_end
13711 : glyph_after < glyphs_end)))))
13710 { 13712 {
13711 cursor = glyph_after; 13713 cursor = glyph_after;
13712 x = -1; 13714 x = -1;
@@ -18766,11 +18768,6 @@ display_line (struct it *it)
18766 it->current_x = new_x; 18768 it->current_x = new_x;
18767 it->continuation_lines_width += new_x; 18769 it->continuation_lines_width += new_x;
18768 ++it->hpos; 18770 ++it->hpos;
18769 /* Record the maximum and minimum buffer
18770 positions seen so far in glyphs that will be
18771 displayed by this row. */
18772 if (it->bidi_p)
18773 RECORD_MAX_MIN_POS (it);
18774 if (i == nglyphs - 1) 18771 if (i == nglyphs - 1)
18775 { 18772 {
18776 /* If line-wrap is on, check if a previous 18773 /* If line-wrap is on, check if a previous
@@ -18785,6 +18782,11 @@ display_line (struct it *it)
18785 || IT_DISPLAYING_WHITESPACE (it))) 18782 || IT_DISPLAYING_WHITESPACE (it)))
18786 goto back_to_wrap; 18783 goto back_to_wrap;
18787 18784
18785 /* Record the maximum and minimum buffer
18786 positions seen so far in glyphs that will be
18787 displayed by this row. */
18788 if (it->bidi_p)
18789 RECORD_MAX_MIN_POS (it);
18788 set_iterator_to_next (it, 1); 18790 set_iterator_to_next (it, 1);
18789 if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) 18791 if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
18790 { 18792 {
@@ -18802,6 +18804,8 @@ display_line (struct it *it)
18802 } 18804 }
18803 } 18805 }
18804 } 18806 }
18807 else if (it->bidi_p)
18808 RECORD_MAX_MIN_POS (it);
18805 } 18809 }
18806 else if (CHAR_GLYPH_PADDING_P (*glyph) 18810 else if (CHAR_GLYPH_PADDING_P (*glyph)
18807 && !FRAME_WINDOW_P (it->f)) 18811 && !FRAME_WINDOW_P (it->f))
@@ -18932,6 +18936,10 @@ display_line (struct it *it)
18932 xassert (it->first_visible_x <= it->last_visible_x); 18936 xassert (it->first_visible_x <= it->last_visible_x);
18933 } 18937 }
18934 } 18938 }
18939 /* Even if this display element produced no glyphs at all,
18940 we want to record its position. */
18941 if (it->bidi_p && nglyphs == 0)
18942 RECORD_MAX_MIN_POS (it);
18935 18943
18936 row->ascent = max (row->ascent, it->max_ascent); 18944 row->ascent = max (row->ascent, it->max_ascent);
18937 row->height = max (row->height, it->max_ascent + it->max_descent); 18945 row->height = max (row->height, it->max_ascent + it->max_descent);
@@ -23472,7 +23480,14 @@ produce_stretch_glyph (struct it *it)
23472 23480
23473 if (width > 0 && it->line_wrap != TRUNCATE 23481 if (width > 0 && it->line_wrap != TRUNCATE
23474 && it->current_x + width > it->last_visible_x) 23482 && it->current_x + width > it->last_visible_x)
23475 width = it->last_visible_x - it->current_x - 1; 23483 {
23484 width = it->last_visible_x - it->current_x;
23485#ifdef HAVE_WINDOW_SYSTEM
23486 /* Subtact one more pixel from the stretch width, but only on
23487 GUI frames, since on a TTY each glyph is one "pixel" wide. */
23488 width -= FRAME_WINDOW_P (it->f);
23489#endif
23490 }
23476 23491
23477 if (width > 0 && height > 0 && it->glyph_row) 23492 if (width > 0 && height > 0 && it->glyph_row)
23478 { 23493 {
@@ -23484,14 +23499,7 @@ produce_stretch_glyph (struct it *it)
23484 object = it->w->buffer; 23499 object = it->w->buffer;
23485#ifdef HAVE_WINDOW_SYSTEM 23500#ifdef HAVE_WINDOW_SYSTEM
23486 if (FRAME_WINDOW_P (it->f)) 23501 if (FRAME_WINDOW_P (it->f))
23487 { 23502 append_stretch_glyph (it, object, width, height, ascent);
23488 append_stretch_glyph (it, object, width, height, ascent);
23489 it->pixel_width = width;
23490 it->ascent = it->phys_ascent = ascent;
23491 it->descent = it->phys_descent = height - it->ascent;
23492 it->nglyphs = width > 0 && height > 0 ? 1 : 0;
23493 take_vertical_position_into_account (it);
23494 }
23495 else 23503 else
23496#endif 23504#endif
23497 { 23505 {
@@ -23503,6 +23511,19 @@ produce_stretch_glyph (struct it *it)
23503 it->object = o_object; 23511 it->object = o_object;
23504 } 23512 }
23505 } 23513 }
23514
23515 it->pixel_width = width;
23516#ifdef HAVE_WINDOW_SYSTEM
23517 if (FRAME_WINDOW_P (it->f))
23518 {
23519 it->ascent = it->phys_ascent = ascent;
23520 it->descent = it->phys_descent = height - it->ascent;
23521 it->nglyphs = width > 0 && height > 0 ? 1 : 0;
23522 take_vertical_position_into_account (it);
23523 }
23524 else
23525#endif
23526 it->nglyphs = width;
23506} 23527}
23507 23528
23508#ifdef HAVE_WINDOW_SYSTEM 23529#ifdef HAVE_WINDOW_SYSTEM
@@ -27450,7 +27471,7 @@ expose_window (struct window *w, XRectangle *fr)
27450 { 27471 {
27451 int yb = window_text_bottom_y (w); 27472 int yb = window_text_bottom_y (w);
27452 struct glyph_row *row; 27473 struct glyph_row *row;
27453 int cursor_cleared_p; 27474 int cursor_cleared_p, phys_cursor_on_p;
27454 struct glyph_row *first_overlapping_row, *last_overlapping_row; 27475 struct glyph_row *first_overlapping_row, *last_overlapping_row;
27455 27476
27456 TRACE ((stderr, "expose_window (%d, %d, %d, %d)\n", 27477 TRACE ((stderr, "expose_window (%d, %d, %d, %d)\n",
@@ -27470,6 +27491,13 @@ expose_window (struct window *w, XRectangle *fr)
27470 else 27491 else
27471 cursor_cleared_p = 0; 27492 cursor_cleared_p = 0;
27472 27493
27494 /* If the row containing the cursor extends face to end of line,
27495 then expose_area might overwrite the cursor outside the
27496 rectangle and thus notice_overwritten_cursor might clear
27497 w->phys_cursor_on_p. We remember the original value and
27498 check later if it is changed. */
27499 phys_cursor_on_p = w->phys_cursor_on_p;
27500
27473 /* Update lines intersecting rectangle R. */ 27501 /* Update lines intersecting rectangle R. */
27474 first_overlapping_row = last_overlapping_row = NULL; 27502 first_overlapping_row = last_overlapping_row = NULL;
27475 for (row = w->current_matrix->rows; 27503 for (row = w->current_matrix->rows;
@@ -27536,7 +27564,8 @@ expose_window (struct window *w, XRectangle *fr)
27536 x_draw_vertical_border (w); 27564 x_draw_vertical_border (w);
27537 27565
27538 /* Turn the cursor on again. */ 27566 /* Turn the cursor on again. */
27539 if (cursor_cleared_p) 27567 if (cursor_cleared_p
27568 || (phys_cursor_on_p && !w->phys_cursor_on_p))
27540 update_window_cursor (w, 1); 27569 update_window_cursor (w, 1);
27541 } 27570 }
27542 } 27571 }
diff --git a/src/xfns.c b/src/xfns.c
index 998c803a7ad..913cde75d91 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 cf58e85af10..7fcd2ad3724 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,
diff --git a/src/xselect.c b/src/xselect.c
index 29e8552bb9c..adee1872dba 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -116,6 +116,7 @@ static Lisp_Object Qx_lost_selection_functions, Qx_sent_selection_functions;
116#define X_SHRT_MIN (-1 - X_SHRT_MAX) 116#define X_SHRT_MIN (-1 - X_SHRT_MAX)
117#define X_LONG_MAX 0x7fffffff 117#define X_LONG_MAX 0x7fffffff
118#define X_LONG_MIN (-1 - X_LONG_MAX) 118#define X_LONG_MIN (-1 - X_LONG_MAX)
119#define X_ULONG_MAX 0xffffffffUL
119 120
120/* If this is a smaller number than the max-request-size of the display, 121/* If this is a smaller number than the max-request-size of the display,
121 emacs will use INCR selection transfer when the selection is larger 122 emacs will use INCR selection transfer when the selection is larger
@@ -378,7 +379,8 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value,
378 379
379/* Given a selection-name and desired type, look up our local copy of 380/* Given a selection-name and desired type, look up our local copy of
380 the selection value and convert it to the type. 381 the selection value and convert it to the type.
381 The value is nil or a string. 382 Return nil, a string, a vector, a symbol, an integer, or a cons
383 that CONS_TO_INTEGER could plausibly handle.
382 This function is used both for remote requests (LOCAL_REQUEST is zero) 384 This function is used both for remote requests (LOCAL_REQUEST is zero)
383 and for local x-get-selection-internal (LOCAL_REQUEST is nonzero). 385 and for local x-get-selection-internal (LOCAL_REQUEST is nonzero).
384 386
@@ -1718,6 +1720,21 @@ selection_data_to_lisp_data (Display *display, const unsigned char *data,
1718 } 1720 }
1719} 1721}
1720 1722
1723/* Convert OBJ to an X long value, and return it as unsigned long.
1724 OBJ should be an integer or a cons representing an integer.
1725 Treat values in the range X_LONG_MAX + 1 .. X_ULONG_MAX as X
1726 unsigned long values: in theory these values are supposed to be
1727 signed but in practice unsigned 32-bit data are communicated via X
1728 selections and we need to support that. */
1729static unsigned long
1730cons_to_x_long (Lisp_Object obj)
1731{
1732 if (X_ULONG_MAX <= INTMAX_MAX
1733 || XINT (INTEGERP (obj) ? obj : XCAR (obj)) < 0)
1734 return cons_to_signed (obj, X_LONG_MIN, min (X_ULONG_MAX, INTMAX_MAX));
1735 else
1736 return cons_to_unsigned (obj, X_ULONG_MAX);
1737}
1721 1738
1722/* Use xfree, not XFree, to free the data obtained with this function. */ 1739/* Use xfree, not XFree, to free the data obtained with this function. */
1723 1740
@@ -1783,11 +1800,11 @@ lisp_data_to_selection_data (Display *display, Lisp_Object obj,
1783 || (CONSP (XCDR (obj)) 1800 || (CONSP (XCDR (obj))
1784 && INTEGERP (XCAR (XCDR (obj))))))) 1801 && INTEGERP (XCAR (XCDR (obj)))))))
1785 { 1802 {
1786 *data_ret = (unsigned char *) xmalloc (sizeof (long) + 1); 1803 *data_ret = (unsigned char *) xmalloc (sizeof (unsigned long) + 1);
1787 *format_ret = 32; 1804 *format_ret = 32;
1788 *size_ret = 1; 1805 *size_ret = 1;
1789 (*data_ret) [sizeof (long)] = 0; 1806 (*data_ret) [sizeof (unsigned long)] = 0;
1790 (*(long **) data_ret) [0] = cons_to_signed (obj, X_LONG_MIN, X_LONG_MAX); 1807 (*(unsigned long **) data_ret) [0] = cons_to_x_long (obj);
1791 if (NILP (type)) type = QINTEGER; 1808 if (NILP (type)) type = QINTEGER;
1792 } 1809 }
1793 else if (VECTORP (obj)) 1810 else if (VECTORP (obj))
@@ -1822,15 +1839,15 @@ lisp_data_to_selection_data (Display *display, Lisp_Object obj,
1822 if (NILP (type)) type = QINTEGER; 1839 if (NILP (type)) type = QINTEGER;
1823 for (i = 0; i < size; i++) 1840 for (i = 0; i < size; i++)
1824 { 1841 {
1825 intmax_t v = cons_to_signed (XVECTOR (obj)->contents[i], 1842 if (! RANGED_INTEGERP (X_SHRT_MIN, XVECTOR (obj)->contents[i],
1826 X_LONG_MIN, X_LONG_MAX); 1843 X_SHRT_MAX))
1827 if (X_SHRT_MIN <= v && v <= X_SHRT_MAX)
1828 { 1844 {
1829 /* Use sizeof (long) even if it is more than 32 bits. 1845 /* Use sizeof (long) even if it is more than 32 bits.
1830 See comment in x_get_window_property and 1846 See comment in x_get_window_property and
1831 x_fill_property_data. */ 1847 x_fill_property_data. */
1832 data_size = sizeof (long); 1848 data_size = sizeof (long);
1833 format = 32; 1849 format = 32;
1850 break;
1834 } 1851 }
1835 } 1852 }
1836 *data_ret = xnmalloc (size, data_size); 1853 *data_ret = xnmalloc (size, data_size);
@@ -1838,12 +1855,12 @@ lisp_data_to_selection_data (Display *display, Lisp_Object obj,
1838 *size_ret = size; 1855 *size_ret = size;
1839 for (i = 0; i < size; i++) 1856 for (i = 0; i < size; i++)
1840 { 1857 {
1841 long v = cons_to_signed (XVECTOR (obj)->contents[i],
1842 X_LONG_MIN, X_LONG_MAX);
1843 if (format == 32) 1858 if (format == 32)
1844 (*((long **) data_ret)) [i] = v; 1859 (*((unsigned long **) data_ret)) [i] =
1860 cons_to_x_long (XVECTOR (obj)->contents[i]);
1845 else 1861 else
1846 (*((short **) data_ret)) [i] = v; 1862 (*((short **) data_ret)) [i] =
1863 XINT (XVECTOR (obj)->contents[i]);
1847 } 1864 }
1848 } 1865 }
1849 } 1866 }