Mercurial > hg > xemacs-beta
comparison src/redisplay.c @ 793:e38acbeb1cae
[xemacs-hg @ 2002-03-29 04:46:17 by ben]
lots o' fixes
etc/ChangeLog: New file.
Separated out all entries for etc/ into their own ChangeLog.
Includes entries for the following files:
etc/BABYL, etc/BETA, etc/CHARSETS, etc/DISTRIB, etc/Emacs.ad,
etc/FTP, etc/GNUS-NEWS, etc/GOATS, etc/HELLO, etc/INSTALL,
etc/MACHINES, etc/MAILINGLISTS, etc/MSDOS, etc/MYTHOLOGY, etc/NEWS,
etc/OXYMORONS, etc/PACKAGES, etc/README, etc/TUTORIAL,
etc/TUTORIAL.de, etc/TUTORIAL.ja, etc/TUTORIAL.ko, etc/TUTORIAL.se,
etc/aliases.ksh, etc/altrasoft-logo.xpm, etc/check_cygwin_setup.sh,
etc/custom/example-themes/europe-theme.el,
etc/custom/example-themes/ex-custom-file,
etc/custom/example-themes/example-theme.el, etc/e/eterm.ti,
etc/edt-user.doc, etc/enriched.doc, etc/etags.1, etc/gnuserv.1,
etc/gnuserv.README, etc/package-index.LATEST.gpg,
etc/package-index.LATEST.pgp, etc/photos/jan.png, etc/recycle.xpm,
etc/refcard.tex, etc/sample.Xdefaults, etc/sample.emacs,
etc/sgml/CATALOG, etc/sgml/HTML32.dtd, etc/skk/SKK.tut.E,
etc/smilies/Face_ase.xbm, etc/smilies/Face_ase2.xbm,
etc/smilies/Face_ase3.xbm, etc/smilies/Face_smile.xbm,
etc/smilies/Face_weep.xbm, etc/sounds, etc/toolbar,
etc/toolbar/workshop-cap-up.xpm, etc/xemacs-ja.1, etc/xemacs.1,
etc/yow.lines, etc\BETA, etc\NEWS, etc\README, etc\TUTORIAL,
etc\TUTORIAL.de, etc\check_cygwin_setup.sh, etc\sample.init.el,
etc\unicode\README, etc\unicode\mule-ucs\*, etc\unicode\other\*
unicode/unicode-consortium/8859-16.TXT: New file.
mule/english.el: Define this charset now, since a bug was fixed that formerly
prevented it.
mule/ethio-util.el: Fix compile errors involving Unicode `characters', which should be
integers.
Makefile.in.in: Always include gui.c, to fix compile error when TTY-only.
EmacsFrame.c, abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, bytecode.h, callint.c, callproc.c, casetab.c, casetab.h, charset.h, chartab.c, chartab.h, cmds.c, console-msw.c, console-msw.h, console-tty.c, console-x.c, console-x.h, console.c, console.h, data.c, database.c, device-gtk.c, device-msw.c, device-x.c, device.c, device.h, dialog-msw.c, doc.c, doprnt.c, dumper.c, dynarr.c, editfns.c, eldap.c, eldap.h, elhash.c, elhash.h, emacs.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-tty.c, event-unixoid.c, events.c, events.h, extents.c, extents.h, faces.c, faces.h, file-coding.c, file-coding.h, fileio.c, filelock.c, fns.c, frame-gtk.c, frame-msw.c, frame-tty.c, frame-x.c, frame.c, frame.h, free-hook.c, general-slots.h, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gtk-xemacs.c, gui-msw.c, gui-x.c, gui-x.h, gui.c, gui.h, gutter.c, gutter.h, indent.c, input-method-xlib.c, insdel.c, keymap.c, keymap.h, lisp-disunion.h, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, marker.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, mule-canna.c, mule-ccl.c, mule-charset.c, mule-wnnfns.c, native-gtk-toolbar.c, objects-msw.c, objects-tty.c, objects-x.c, objects.c, objects.h, opaque.c, opaque.h, postgresql.c, postgresql.h, print.c, process-unix.c, process.c, process.h, rangetab.c, rangetab.h, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, scrollbar-gtk.c, scrollbar-msw.c, scrollbar-x.c, scrollbar.c, scrollbar.h, search.c, select-gtk.c, select-x.c, sound.c, specifier.c, specifier.h, strftime.c, symbols.c, symeval.h, syntax.h, text.c, text.h, toolbar-common.c, toolbar-msw.c, toolbar.c, toolbar.h, tooltalk.c, tooltalk.h, ui-gtk.c, ui-gtk.h, undo.c, vm-limit.c, window.c, window.h: Eliminate XSETFOO. Replace all usages with wrap_foo().
Make symbol->name a Lisp_Object, not Lisp_String *. Eliminate
nearly all uses of Lisp_String * in favor of Lisp_Object, and
correct macros so most of them favor Lisp_Object.
Create new error-behavior ERROR_ME_DEBUG_WARN -- output warnings,
but at level `debug' (usually ignored). Use it when instantiating
specifiers, so problems can be debugged. Move
log-warning-minimum-level into C so that we can optimize
ERROR_ME_DEBUG_WARN.
Fix warning levels consistent with new definitions.
Add default_ and parent fields to char table; not yet implemented.
New fun Dynarr_verify(); use for further error checking on Dynarrs.
Rearrange code at top of lisp.h in conjunction with dynarr changes.
Fix eifree(). Use Eistrings in various places
(format_event_object(), where_is_to_char(), and callers thereof)
to avoid fixed-size strings buffers. New fun write_eistring().
Reindent and fix GPM code to follow standards.
Set default MS Windows font to Lucida Console (same size as
Courier New but less interline spacing, so more lines fit).
Increase default frame size on Windows to 50 lines. (If that's too
big for the workspace, the frame will be shrunk as necessary.)
Fix problem with text files with no newlines (). (Change
`convert-eol' coding system to use `nil' for autodetect,
consistent with make-coding-system.)
Correct compile warnings in vm-limit.c.
Fix handling of reverse-direction charsets to avoid errors when
opening (e.g.) mule-ucs/lisp/reldata/uiso8859-6.el.
Recode some object printing methods to use write_fmt_string()
instead of a fixed buffer and sprintf.
Turn on display of png comments as warnings (level `info'), now
that they're unobtrusive.
Revamped the sound documentation.
Fixed bug in redisplay w.r.t. hscroll/truncation/continuation
glyphs causing jumping up and down of the lines, since they're
bigger than the line size. (It was seen most obviously when
there's a horizontal scroll bar, e.g. do C-h a glyph or something
like that.) The problem was that the glyph-contrib-p setting on
glyphs was ignored even if it was set properly, which it wasn't
until now.
author | ben |
---|---|
date | Fri, 29 Mar 2002 04:49:13 +0000 |
parents | 943eaba38521 |
children | a5954632b187 |
comparison
equal
deleted
inserted
replaced
792:4e83fdb13eb9 | 793:e38acbeb1cae |
---|---|
89 : vertical_clip) | 89 : vertical_clip) |
90 | 90 |
91 /* The following structures are completely private to redisplay.c so | 91 /* The following structures are completely private to redisplay.c so |
92 we put them here instead of in a header file, for modularity. */ | 92 we put them here instead of in a header file, for modularity. */ |
93 | 93 |
94 /* NOTE: Bytebposs not Charbpos's in this structure. */ | 94 /* NOTE: Bytebpos's not Charbpos's in this structure. */ |
95 | 95 |
96 typedef struct position_redisplay_data_type | 96 typedef struct position_redisplay_data_type |
97 { | 97 { |
98 /* This information is normally filled in by the create_*_block | 98 /* This information is normally filled in by the create_*_block |
99 routines and is used by the add_*_rune routines. */ | 99 routines and is used by the add_*_rune routines. */ |
478 { | 478 { |
479 unsigned char charsets[NUM_LEADING_BYTES]; | 479 unsigned char charsets[NUM_LEADING_BYTES]; |
480 Lisp_Object window; | 480 Lisp_Object window; |
481 | 481 |
482 find_charsets_in_emchar_string (charsets, str, len); | 482 find_charsets_in_emchar_string (charsets, str, len); |
483 XSETWINDOW (window, w); | 483 window = wrap_window (w); |
484 ensure_face_cachel_complete (WINDOW_FACE_CACHEL (w, findex), window, | 484 ensure_face_cachel_complete (WINDOW_FACE_CACHEL (w, findex), window, |
485 charsets); | 485 charsets); |
486 return DEVMETH (XDEVICE (FRAME_DEVICE (XFRAME (WINDOW_FRAME (w)))), | 486 return DEVMETH (XDEVICE (FRAME_DEVICE (XFRAME (WINDOW_FRAME (w)))), |
487 text_width, (XFRAME (WINDOW_FRAME (w)), | 487 text_width, (XFRAME (WINDOW_FRAME (w)), |
488 WINDOW_FACE_CACHEL (w, findex), str, len)); | 488 WINDOW_FACE_CACHEL (w, findex), str, len)); |
526 nonreloc = XSTRING_DATA (reloc); | 526 nonreloc = XSTRING_DATA (reloc); |
527 convert_intbyte_string_into_emchar_dynarr (nonreloc, len, rtw_emchar_dynarr); | 527 convert_intbyte_string_into_emchar_dynarr (nonreloc, len, rtw_emchar_dynarr); |
528 find_charsets_in_intbyte_string (charsets, nonreloc, len); | 528 find_charsets_in_intbyte_string (charsets, nonreloc, len); |
529 reset_face_cachel (&cachel); | 529 reset_face_cachel (&cachel); |
530 cachel.face = face; | 530 cachel.face = face; |
531 XSETFRAME (frame, f); | 531 frame = wrap_frame (f); |
532 ensure_face_cachel_complete (&cachel, frame, charsets); | 532 ensure_face_cachel_complete (&cachel, frame, charsets); |
533 return DEVMETH (XDEVICE (FRAME_DEVICE (f)), | 533 return DEVMETH (XDEVICE (FRAME_DEVICE (f)), |
534 text_width, (f, &cachel, Dynarr_atp (rtw_emchar_dynarr, 0), | 534 text_width, (f, &cachel, Dynarr_atp (rtw_emchar_dynarr, 0), |
535 Dynarr_length (rtw_emchar_dynarr))); | 535 Dynarr_length (rtw_emchar_dynarr))); |
536 } | 536 } |
807 | 807 |
808 data->bi_start_col_enabled = 0; | 808 data->bi_start_col_enabled = 0; |
809 return retval; | 809 return retval; |
810 } | 810 } |
811 | 811 |
812 /* Adds a character rune to a display block. If there is not enough | 812 /* Adds a character rune to a display block. If there is not enough room |
813 room to fit the rune on the display block (as determined by the | 813 to fit the rune on the display block (as determined by the MAX_PIXPOS) |
814 MAX_PIXPOS) then it adds nothing and returns ADD_FAILED. */ | 814 then it adds nothing and returns ADD_FAILED. If |
815 NO_CONTRIBUTE_TO_LINE_HEIGHT is non-zero, don't allow the char's height | |
816 to affect the total line height. (See add_intbyte_string_runes()). */ | |
815 | 817 |
816 static prop_block_dynarr * | 818 static prop_block_dynarr * |
817 add_emchar_rune (pos_data *data) | 819 add_emchar_rune_1 (pos_data *data, int no_contribute_to_line_height) |
818 { | 820 { |
819 struct rune rb, *crb; | 821 struct rune rb, *crb; |
820 int width, local; | 822 int width, local; |
821 | 823 |
822 if (data->start_col) | 824 if (data->start_col) |
869 redisplay_text_width_emchar_string (XWINDOW (data->window), | 871 redisplay_text_width_emchar_string (XWINDOW (data->window), |
870 data->findex, &ch, 1); | 872 data->findex, &ch, 1); |
871 } | 873 } |
872 else | 874 else |
873 data->last_char_width = -1; | 875 data->last_char_width = -1; |
874 data->new_ascent = max (data->new_ascent, (int) fi->ascent); | 876 if (!no_contribute_to_line_height) |
875 data->new_descent = max (data->new_descent, (int) fi->descent); | 877 { |
878 data->new_ascent = max (data->new_ascent, (int) fi->ascent); | |
879 data->new_descent = max (data->new_descent, (int) fi->descent); | |
880 } | |
876 data->last_charset = charset; | 881 data->last_charset = charset; |
877 data->last_findex = data->findex; | 882 data->last_findex = data->findex; |
878 } | 883 } |
879 | 884 |
880 width = data->last_char_width; | 885 width = data->last_char_width; |
905 crb->width = width; | 910 crb->width = width; |
906 if (data->bi_charbpos) | 911 if (data->bi_charbpos) |
907 { | 912 { |
908 if (NILP (data->string)) | 913 if (NILP (data->string)) |
909 crb->charbpos = | 914 crb->charbpos = |
910 bytebpos_to_charbpos (XBUFFER (WINDOW_BUFFER (XWINDOW (data->window))), | 915 bytebpos_to_charbpos (XBUFFER (WINDOW_BUFFER |
911 data->bi_charbpos); | 916 (XWINDOW (data->window))), |
917 data->bi_charbpos); | |
912 else | 918 else |
913 crb->charbpos = | 919 crb->charbpos = |
914 XSTRING_INDEX_BYTE_TO_CHAR (data->string, data->bi_charbpos); | 920 string_index_byte_to_char (data->string, data->bi_charbpos); |
915 } | 921 } |
916 else if (data->is_modeline) | 922 else if (data->is_modeline) |
917 crb->charbpos = data->modeline_charpos; | 923 crb->charbpos = data->modeline_charpos; |
918 else | 924 else |
919 /* Text but not in buffer */ | 925 /* Text but not in buffer */ |
951 data->pixpos += width; | 957 data->pixpos += width; |
952 | 958 |
953 return NULL; | 959 return NULL; |
954 } | 960 } |
955 | 961 |
956 /* Given a string C_STRING of length C_LENGTH, call add_emchar_rune | 962 static prop_block_dynarr * |
957 for each character in the string. Propagate any left-over data | 963 add_emchar_rune (pos_data *data) |
958 unless NO_PROP is non-zero. */ | 964 { |
965 return add_emchar_rune_1 (data, 0); | |
966 } | |
967 | |
968 /* Given a string C_STRING of length C_LENGTH, call add_emchar_rune for | |
969 each character in the string. Propagate any left-over data unless | |
970 NO_PROP is non-zero. If NO_CONTRIBUTE_TO_LINE_HEIGHT is non-zero, don't | |
971 allow this character to increase the total height of the line. (This is | |
972 used when the character is part of a text glyph. In that case, the | |
973 glyph code itself adjusts the line height as necessary, depending on | |
974 whether glyph-contrib-p is true.) */ | |
959 | 975 |
960 static prop_block_dynarr * | 976 static prop_block_dynarr * |
961 add_intbyte_string_runes (pos_data *data, Intbyte *c_string, | 977 add_intbyte_string_runes (pos_data *data, Intbyte *c_string, |
962 Bytecount c_length, int no_prop) | 978 Bytecount c_length, int no_prop, |
979 int no_contribute_to_line_height) | |
963 { | 980 { |
964 Intbyte *pos, *end = c_string + c_length; | 981 Intbyte *pos, *end = c_string + c_length; |
965 prop_block_dynarr *prop; | 982 prop_block_dynarr *prop; |
966 | 983 |
967 /* #### This function is too simplistic. It needs to do the same | 984 /* #### This function is too simplistic. It needs to do the same |
974 { | 991 { |
975 Intbyte *old_pos = pos; | 992 Intbyte *old_pos = pos; |
976 | 993 |
977 data->ch = charptr_emchar (pos); | 994 data->ch = charptr_emchar (pos); |
978 | 995 |
979 prop = add_emchar_rune (data); | 996 prop = add_emchar_rune_1 (data, no_contribute_to_line_height); |
980 | 997 |
981 if (prop) | 998 if (prop) |
982 { | 999 { |
983 if (no_prop) | 1000 if (no_prop) |
984 return ADD_FAILED; | 1001 return ADD_FAILED; |
1259 if (STRINGP (entry)) | 1276 if (STRINGP (entry)) |
1260 { | 1277 { |
1261 prop = add_intbyte_string_runes (data, | 1278 prop = add_intbyte_string_runes (data, |
1262 XSTRING_DATA (entry), | 1279 XSTRING_DATA (entry), |
1263 XSTRING_LENGTH (entry), | 1280 XSTRING_LENGTH (entry), |
1264 0); | 1281 0, 0); |
1265 } | 1282 } |
1266 else if (GLYPHP (entry)) | 1283 else if (GLYPHP (entry)) |
1267 { | 1284 { |
1268 if (data->start_col) | 1285 if (data->start_col) |
1269 data->start_col--; | 1286 data->start_col--; |
1318 break; | 1335 break; |
1319 /* #### unimplemented */ | 1336 /* #### unimplemented */ |
1320 } | 1337 } |
1321 } | 1338 } |
1322 } | 1339 } |
1323 prop = add_intbyte_string_runes (data, result, dst - result, 0); | 1340 prop = add_intbyte_string_runes (data, result, dst - result, 0, 0); |
1324 } | 1341 } |
1325 } | 1342 } |
1326 | 1343 |
1327 /* Else blow it off because someone added a bad entry and we don't | 1344 /* Else blow it off because someone added a bad entry and we don't |
1328 have any safe way of signaling an error. */ | 1345 have any safe way of signaling an error. */ |
1663 findex = data->findex; | 1680 findex = data->findex; |
1664 else | 1681 else |
1665 findex = get_builtin_face_cache_index (w, face); | 1682 findex = get_builtin_face_cache_index (w, face); |
1666 | 1683 |
1667 instance = glyph_image_instance (gb->glyph, data->window, | 1684 instance = glyph_image_instance (gb->glyph, data->window, |
1668 ERROR_ME_NOT, 1); | 1685 ERROR_ME_DEBUG_WARN, 1); |
1669 if (TEXT_IMAGE_INSTANCEP (instance)) | 1686 if (TEXT_IMAGE_INSTANCEP (instance)) |
1670 { | 1687 { |
1671 Lisp_Object string = XIMAGE_INSTANCE_TEXT_STRING (instance); | 1688 Lisp_Object string = XIMAGE_INSTANCE_TEXT_STRING (instance); |
1672 face_index orig_findex = data->findex; | 1689 face_index orig_findex = data->findex; |
1673 Bytebpos orig_charbpos = data->bi_charbpos; | 1690 Bytebpos orig_charbpos = data->bi_charbpos; |
1676 data->findex = findex; | 1693 data->findex = findex; |
1677 data->bi_start_col_enabled = 0; | 1694 data->bi_start_col_enabled = 0; |
1678 if (!allow_cursor) | 1695 if (!allow_cursor) |
1679 data->bi_charbpos = 0; | 1696 data->bi_charbpos = 0; |
1680 add_intbyte_string_runes (data, XSTRING_DATA (string), | 1697 add_intbyte_string_runes (data, XSTRING_DATA (string), |
1681 XSTRING_LENGTH (string), 0); | 1698 XSTRING_LENGTH (string), 0, 1); |
1682 data->findex = orig_findex; | 1699 data->findex = orig_findex; |
1683 data->bi_charbpos = orig_charbpos; | 1700 data->bi_charbpos = orig_charbpos; |
1684 data->bi_start_col_enabled = orig_start_col_enabled; | 1701 data->bi_start_col_enabled = orig_start_col_enabled; |
1685 return NULL; | 1702 return NULL; |
1686 } | 1703 } |
1904 data.ef = extent_fragment_new (w->buffer, f); | 1921 data.ef = extent_fragment_new (w->buffer, f); |
1905 | 1922 |
1906 /* These values are used by all of the rune addition routines. We add | 1923 /* These values are used by all of the rune addition routines. We add |
1907 them to this structure for ease of passing. */ | 1924 them to this structure for ease of passing. */ |
1908 data.d = d; | 1925 data.d = d; |
1909 XSETWINDOW (data.window, w); | 1926 data.window = wrap_window (w); |
1910 data.string = Qnil; | 1927 data.string = Qnil; |
1911 data.db = db; | 1928 data.db = db; |
1912 data.dl = dl; | 1929 data.dl = dl; |
1913 | 1930 |
1914 data.bi_charbpos = bi_start_pos; | 1931 data.bi_charbpos = bi_start_pos; |
2677 return 0; | 2694 return 0; |
2678 | 2695 |
2679 xzero (data); | 2696 xzero (data); |
2680 data.ef = NULL; | 2697 data.ef = NULL; |
2681 data.d = d; | 2698 data.d = d; |
2682 XSETWINDOW (data.window, w); | 2699 data.window = wrap_window (w); |
2683 data.db = get_display_block_from_line (dl, OVERWRITE); | 2700 data.db = get_display_block_from_line (dl, OVERWRITE); |
2684 data.dl = dl; | 2701 data.dl = dl; |
2685 data.pixpos = dl->bounds.left_in; | 2702 data.pixpos = dl->bounds.left_in; |
2686 data.max_pixpos = dl->bounds.right_in; | 2703 data.max_pixpos = dl->bounds.right_in; |
2687 data.cursor_type = NO_CURSOR; | 2704 data.cursor_type = NO_CURSOR; |
2698 { | 2715 { |
2699 add_intbyte_string_runes | 2716 add_intbyte_string_runes |
2700 (&data, | 2717 (&data, |
2701 XSTRING_DATA (Voverlay_arrow_string), | 2718 XSTRING_DATA (Voverlay_arrow_string), |
2702 XSTRING_LENGTH (Voverlay_arrow_string), | 2719 XSTRING_LENGTH (Voverlay_arrow_string), |
2703 1); | 2720 1, 0); |
2704 } | 2721 } |
2705 else if (GLYPHP (Voverlay_arrow_string)) | 2722 else if (GLYPHP (Voverlay_arrow_string)) |
2706 { | 2723 { |
2707 struct glyph_block gb; | 2724 struct glyph_block gb; |
2708 | 2725 |
2854 int left_in_start = dl->bounds.left_in; | 2871 int left_in_start = dl->bounds.left_in; |
2855 int left_in_end = dl->bounds.left_in + overlay_width; | 2872 int left_in_end = dl->bounds.left_in + overlay_width; |
2856 | 2873 |
2857 struct display_block *odb, *idb; | 2874 struct display_block *odb, *idb; |
2858 | 2875 |
2859 XSETWINDOW (window, w); | 2876 window = wrap_window (w); |
2860 | 2877 |
2861 /* We have to add the glyphs to the line in the order outside, | 2878 /* We have to add the glyphs to the line in the order outside, |
2862 inside, whitespace. However the precedence dictates that we | 2879 inside, whitespace. However the precedence dictates that we |
2863 determine how many will fit in the reverse order. */ | 2880 determine how many will fit in the reverse order. */ |
2864 | 2881 |
3175 int out_start, in_out_end, in_in_start, white_out_end, white_in_end; | 3192 int out_start, in_out_end, in_in_start, white_out_end, white_in_end; |
3176 int out_cnt, in_out_cnt, in_in_cnt, white_out_cnt, white_in_cnt; | 3193 int out_cnt, in_out_cnt, in_in_cnt, white_out_cnt, white_in_cnt; |
3177 | 3194 |
3178 struct display_block *odb, *idb; | 3195 struct display_block *odb, *idb; |
3179 | 3196 |
3180 XSETWINDOW (window, w); | 3197 window = wrap_window (w); |
3181 | 3198 |
3182 /* We have to add the glyphs to the line in the order outside, | 3199 /* We have to add the glyphs to the line in the order outside, |
3183 inside, whitespace. However the precedence dictates that we | 3200 inside, whitespace. However the precedence dictates that we |
3184 determine how many will fit in the reverse order. */ | 3201 determine how many will fit in the reverse order. */ |
3185 | 3202 |
3495 data.last_charset = Qunbound; | 3512 data.last_charset = Qunbound; |
3496 data.last_findex = DEFAULT_INDEX; | 3513 data.last_findex = DEFAULT_INDEX; |
3497 data.result_str = result_str; | 3514 data.result_str = result_str; |
3498 data.is_modeline = 1; | 3515 data.is_modeline = 1; |
3499 data.string = Qnil; | 3516 data.string = Qnil; |
3500 XSETWINDOW (data.window, w); | 3517 data.window = wrap_window (w); |
3501 | 3518 |
3502 Dynarr_reset (formatted_string_extent_dynarr); | 3519 Dynarr_reset (formatted_string_extent_dynarr); |
3503 Dynarr_reset (formatted_string_extent_start_dynarr); | 3520 Dynarr_reset (formatted_string_extent_start_dynarr); |
3504 Dynarr_reset (formatted_string_extent_end_dynarr); | 3521 Dynarr_reset (formatted_string_extent_end_dynarr); |
3505 | 3522 |
3544 | 3561 |
3545 in_modeline_generation = 1; | 3562 in_modeline_generation = 1; |
3546 | 3563 |
3547 sledgehammer_check_ascii_begin (result_str); | 3564 sledgehammer_check_ascii_begin (result_str); |
3548 detach_all_extents (result_str); | 3565 detach_all_extents (result_str); |
3549 resize_string (XSTRING (result_str), -1, | 3566 resize_string (result_str, -1, |
3550 data.bytepos - XSTRING_LENGTH (result_str)); | 3567 data.bytepos - XSTRING_LENGTH (result_str)); |
3551 | 3568 |
3552 strdata = XSTRING_DATA (result_str); | 3569 strdata = XSTRING_DATA (result_str); |
3553 | 3570 |
3554 for (elt = 0, len = 0; elt < Dynarr_length (db->runes); elt++) | 3571 for (elt = 0, len = 0; elt < Dynarr_length (db->runes); elt++) |
3569 elt++) | 3586 elt++) |
3570 { | 3587 { |
3571 Lisp_Object extent = Qnil; | 3588 Lisp_Object extent = Qnil; |
3572 Lisp_Object child; | 3589 Lisp_Object child; |
3573 | 3590 |
3574 XSETEXTENT (extent, Dynarr_at (formatted_string_extent_dynarr, elt)); | 3591 extent = wrap_extent (Dynarr_at (formatted_string_extent_dynarr, elt)); |
3575 child = Fgethash (extent, buf->modeline_extent_table, Qnil); | 3592 child = Fgethash (extent, buf->modeline_extent_table, Qnil); |
3576 if (NILP (child)) | 3593 if (NILP (child)) |
3577 { | 3594 { |
3578 child = Fmake_extent (Qnil, Qnil, result_str); | 3595 child = Fmake_extent (Qnil, Qnil, result_str); |
3579 Fputhash (extent, child, buf->modeline_extent_table); | 3596 Fputhash (extent, child, buf->modeline_extent_table); |
3959 } | 3976 } |
3960 } | 3977 } |
3961 else if (GENERIC_SPECIFIERP (elt)) | 3978 else if (GENERIC_SPECIFIERP (elt)) |
3962 { | 3979 { |
3963 Lisp_Object window, tem; | 3980 Lisp_Object window, tem; |
3964 XSETWINDOW (window, w); | 3981 window = wrap_window (w); |
3965 tem = specifier_instance_no_quit (elt, Qunbound, window, | 3982 tem = specifier_instance_no_quit (elt, Qunbound, window, |
3966 ERROR_ME_NOT, 0, Qzero); | 3983 ERROR_ME_DEBUG_WARN, 0, Qzero); |
3967 if (!UNBOUNDP (tem)) | 3984 if (!UNBOUNDP (tem)) |
3968 { | 3985 { |
3969 elt = tem; | 3986 elt = tem; |
3970 goto tail_recurse; | 3987 goto tail_recurse; |
3971 } | 3988 } |
3999 | 4016 |
4000 if (SYMBOLP (car)) | 4017 if (SYMBOLP (car)) |
4001 tem = symbol_value_in_buffer (car, w->buffer); | 4018 tem = symbol_value_in_buffer (car, w->buffer); |
4002 else | 4019 else |
4003 tem = specifier_instance_no_quit (car, Qunbound, wrap_window (w), | 4020 tem = specifier_instance_no_quit (car, Qunbound, wrap_window (w), |
4004 ERROR_ME_NOT, 0, Qzero); | 4021 ERROR_ME_DEBUG_WARN, 0, Qzero); |
4005 /* elt is now the cdr, and we know it is a cons cell. | 4022 /* elt is now the cdr, and we know it is a cons cell. |
4006 Use its car if CAR has a non-nil value. */ | 4023 Use its car if CAR has a non-nil value. */ |
4007 if (!UNBOUNDP (tem) && !NILP (tem)) | 4024 if (!UNBOUNDP (tem) && !NILP (tem)) |
4008 { | 4025 { |
4009 elt = XCAR (elt); | 4026 elt = XCAR (elt); |
4285 etc), its just the buffer text that we do not use. However, it | 4302 etc), its just the buffer text that we do not use. However, it |
4286 seems to be possible for buffer to be nil sometimes so protect | 4303 seems to be possible for buffer to be nil sometimes so protect |
4287 against this case. */ | 4304 against this case. */ |
4288 struct buffer *b = BUFFERP (w->buffer) ? XBUFFER (w->buffer) : 0; | 4305 struct buffer *b = BUFFERP (w->buffer) ? XBUFFER (w->buffer) : 0; |
4289 struct device *d = XDEVICE (f->device); | 4306 struct device *d = XDEVICE (f->device); |
4290 Lisp_String* s = XSTRING (disp_string); | |
4291 | 4307 |
4292 /* we're working with these a lot so precalculate them */ | 4308 /* we're working with these a lot so precalculate them */ |
4293 Bytecount slen = XSTRING_LENGTH (disp_string); | 4309 Bytecount slen = XSTRING_LENGTH (disp_string); |
4294 Bytecount bi_string_zv = slen; | 4310 Bytecount bi_string_zv = slen; |
4295 Bytebpos bi_start_pos = string_index_char_to_byte (s, start_pos); | 4311 Bytebpos bi_start_pos = string_index_char_to_byte (disp_string, start_pos); |
4296 | 4312 |
4297 pos_data data; | 4313 pos_data data; |
4298 | 4314 |
4299 int truncate_win = b ? window_truncation_on (w) : 0; | 4315 int truncate_win = b ? window_truncation_on (w) : 0; |
4300 int end_glyph_width = 0; | 4316 int end_glyph_width = 0; |
4389 data.ef = extent_fragment_new (disp_string, f); | 4405 data.ef = extent_fragment_new (disp_string, f); |
4390 | 4406 |
4391 /* These values are used by all of the rune addition routines. We add | 4407 /* These values are used by all of the rune addition routines. We add |
4392 them to this structure for ease of passing. */ | 4408 them to this structure for ease of passing. */ |
4393 data.d = d; | 4409 data.d = d; |
4394 XSETWINDOW (data.window, w); | 4410 data.window = wrap_window (w); |
4395 data.db = db; | 4411 data.db = db; |
4396 data.dl = dl; | 4412 data.dl = dl; |
4397 | 4413 |
4398 data.bi_charbpos = bi_start_pos; | 4414 data.bi_charbpos = bi_start_pos; |
4399 data.pixpos = dl->bounds.left_in; | 4415 data.pixpos = dl->bounds.left_in; |
4467 /* Check for face changes. */ | 4483 /* Check for face changes. */ |
4468 if (initial || (!no_more_frags && data.bi_charbpos == data.ef->end)) | 4484 if (initial || (!no_more_frags && data.bi_charbpos == data.ef->end)) |
4469 { | 4485 { |
4470 /* Now compute the face and begin/end-glyph information. */ | 4486 /* Now compute the face and begin/end-glyph information. */ |
4471 data.findex = | 4487 data.findex = |
4472 /* Remember that the extent-fragment routines deal in Bytebpos's. */ | 4488 /* Remember that the extent-fragment routines deal in |
4489 Bytebpos's. */ | |
4473 extent_fragment_update (w, data.ef, data.bi_charbpos); | 4490 extent_fragment_update (w, data.ef, data.bi_charbpos); |
4474 /* This is somewhat cheesy but the alternative is to | 4491 /* This is somewhat cheesy but the alternative is to |
4475 propagate default_face into extent_fragment_update. */ | 4492 propagate default_face into extent_fragment_update. */ |
4476 if (data.findex == DEFAULT_INDEX) | 4493 if (data.findex == DEFAULT_INDEX) |
4477 data.findex = default_face; | 4494 data.findex = default_face; |
4530 data.start_col--; | 4547 data.start_col--; |
4531 | 4548 |
4532 if (data.bi_charbpos == bi_string_zv) | 4549 if (data.bi_charbpos == bi_string_zv) |
4533 goto done; | 4550 goto done; |
4534 else | 4551 else |
4535 INC_CHARBYTEBPOS (string_data (s), data.bi_charbpos); | 4552 INC_CHARBYTEBPOS (XSTRING_DATA (disp_string), data.bi_charbpos); |
4536 } | 4553 } |
4537 | 4554 |
4538 /* If there is propagation data, then it represents the current | 4555 /* If there is propagation data, then it represents the current |
4539 buffer position being displayed. Add them and advance the | 4556 buffer position being displayed. Add them and advance the |
4540 position counter. This might also add the minibuffer | 4557 position counter. This might also add the minibuffer |
4550 goto done; | 4567 goto done; |
4551 else if (data.bi_charbpos < 0) | 4568 else if (data.bi_charbpos < 0) |
4552 /* #### urk urk urk! Aborts are not very fun! Fix this please! */ | 4569 /* #### urk urk urk! Aborts are not very fun! Fix this please! */ |
4553 data.bi_charbpos = 0; | 4570 data.bi_charbpos = 0; |
4554 else | 4571 else |
4555 INC_CHARBYTEBPOS (string_data (s), data.bi_charbpos); | 4572 INC_CHARBYTEBPOS (XSTRING_DATA (disp_string), data.bi_charbpos); |
4556 } | 4573 } |
4557 | 4574 |
4558 /* If there are end glyphs, add them to the line. These are | 4575 /* If there are end glyphs, add them to the line. These are |
4559 the end glyphs for the previous run of text. We add them | 4576 the end glyphs for the previous run of text. We add them |
4560 here rather than doing them at the end of handling the | 4577 here rather than doing them at the end of handling the |
4583 | 4600 |
4584 else | 4601 else |
4585 { | 4602 { |
4586 Lisp_Object entry = Qnil; | 4603 Lisp_Object entry = Qnil; |
4587 /* Get the character at the current buffer position. */ | 4604 /* Get the character at the current buffer position. */ |
4588 data.ch = string_char (s, data.bi_charbpos); | 4605 data.ch = XSTRING_CHAR (disp_string, data.bi_charbpos); |
4589 if (!NILP (face_dt) || !NILP (window_dt)) | 4606 if (!NILP (face_dt) || !NILP (window_dt)) |
4590 entry = display_table_entry (data.ch, face_dt, window_dt); | 4607 entry = display_table_entry (data.ch, face_dt, window_dt); |
4591 | 4608 |
4592 /* If there is a display table entry for it, hand it off to | 4609 /* If there is a display table entry for it, hand it off to |
4593 add_disp_table_entry_runes and let it worry about it. */ | 4610 add_disp_table_entry_runes and let it worry about it. */ |
4698 *prop = add_emchar_rune (&data); | 4715 *prop = add_emchar_rune (&data); |
4699 if (*prop) | 4716 if (*prop) |
4700 goto done; | 4717 goto done; |
4701 } | 4718 } |
4702 | 4719 |
4703 INC_CHARBYTEBPOS (string_data (s), data.bi_charbpos); | 4720 INC_CHARBYTEBPOS (XSTRING_DATA (disp_string), data.bi_charbpos); |
4704 } | 4721 } |
4705 } | 4722 } |
4706 | 4723 |
4707 done: | 4724 done: |
4708 | 4725 |
4721 /* The common case is that the line ended because we hit a newline. | 4738 /* The common case is that the line ended because we hit a newline. |
4722 In that case, the next character is just the next buffer | 4739 In that case, the next character is just the next buffer |
4723 position. */ | 4740 position. */ |
4724 if (data.ch == '\n') | 4741 if (data.ch == '\n') |
4725 { | 4742 { |
4726 INC_CHARBYTEBPOS (string_data (s), data.bi_charbpos); | 4743 INC_CHARBYTEBPOS (XSTRING_DATA (disp_string), data.bi_charbpos); |
4727 } | 4744 } |
4728 | 4745 |
4729 /* Otherwise we have a buffer line which cannot fit on one display | 4746 /* Otherwise we have a buffer line which cannot fit on one display |
4730 line. */ | 4747 line. */ |
4731 else | 4748 else |
4744 if (truncate_win) | 4761 if (truncate_win) |
4745 { | 4762 { |
4746 Bytebpos bi_pos; | 4763 Bytebpos bi_pos; |
4747 | 4764 |
4748 /* Now find the start of the next line. */ | 4765 /* Now find the start of the next line. */ |
4749 bi_pos = bi_find_next_emchar_in_string (s, '\n', data.bi_charbpos, 1); | 4766 bi_pos = bi_find_next_emchar_in_string (disp_string, '\n', |
4767 data.bi_charbpos, 1); | |
4750 | 4768 |
4751 data.cursor_type = NO_CURSOR; | 4769 data.cursor_type = NO_CURSOR; |
4752 data.bi_charbpos = bi_pos; | 4770 data.bi_charbpos = bi_pos; |
4753 gb.glyph = Vtruncation_glyph; | 4771 gb.glyph = Vtruncation_glyph; |
4754 cachel = GLYPH_CACHEL (w, TRUN_GLYPH_INDEX); | 4772 cachel = GLYPH_CACHEL (w, TRUN_GLYPH_INDEX); |
4768 if (end_glyph_width) | 4786 if (end_glyph_width) |
4769 add_glyph_rune (&data, &gb, BEGIN_GLYPHS, 0, cachel); | 4787 add_glyph_rune (&data, &gb, BEGIN_GLYPHS, 0, cachel); |
4770 | 4788 |
4771 if (truncate_win && data.bi_charbpos == bi_string_zv) | 4789 if (truncate_win && data.bi_charbpos == bi_string_zv) |
4772 { | 4790 { |
4773 const Intbyte* endb = charptr_n_addr (string_data (s), bi_string_zv); | 4791 const Intbyte *endb = charptr_n_addr (XSTRING_DATA (disp_string), |
4792 bi_string_zv); | |
4774 DEC_CHARPTR (endb); | 4793 DEC_CHARPTR (endb); |
4775 if (charptr_emchar (endb) != '\n') | 4794 if (charptr_emchar (endb) != '\n') |
4776 { | 4795 { |
4777 /* #### Damn this losing shit. */ | 4796 /* #### Damn this losing shit. */ |
4778 data.bi_charbpos++; | 4797 data.bi_charbpos++; |
4882 } | 4901 } |
4883 | 4902 |
4884 dl->cursor_elt = data.cursor_x; | 4903 dl->cursor_elt = data.cursor_x; |
4885 /* #### lossage lossage lossage! Fix this shit! */ | 4904 /* #### lossage lossage lossage! Fix this shit! */ |
4886 if (data.bi_charbpos > bi_string_zv) | 4905 if (data.bi_charbpos > bi_string_zv) |
4887 dl->end_charbpos = buffer_or_string_bytebpos_to_charbpos (disp_string, bi_string_zv); | 4906 dl->end_charbpos = buffer_or_string_bytebpos_to_charbpos (disp_string, |
4907 bi_string_zv); | |
4888 else | 4908 else |
4889 dl->end_charbpos = buffer_or_string_bytebpos_to_charbpos (disp_string, data.bi_charbpos) - 1; | 4909 dl->end_charbpos = |
4910 buffer_or_string_bytebpos_to_charbpos (disp_string, | |
4911 data.bi_charbpos) - 1; | |
4890 if (truncate_win) | 4912 if (truncate_win) |
4891 data.dl->num_chars = | 4913 data.dl->num_chars = |
4892 string_column_at_point (s, dl->end_charbpos, b ? XINT (b->tab_width) : 8); | 4914 string_column_at_point (disp_string, dl->end_charbpos, |
4915 b ? XINT (b->tab_width) : 8); | |
4893 else | 4916 else |
4894 /* This doesn't correctly take into account tabs and control | 4917 /* This doesn't correctly take into account tabs and control |
4895 characters but if the window isn't being truncated then this | 4918 characters but if the window isn't being truncated then this |
4896 value isn't going to end up being used anyhow. */ | 4919 value isn't going to end up being used anyhow. */ |
4897 data.dl->num_chars = dl->end_charbpos - dl->charbpos; | 4920 data.dl->num_chars = dl->end_charbpos - dl->charbpos; |
4916 it so that regenerate_window will exit properly. This is bogus. | 4939 it so that regenerate_window will exit properly. This is bogus. |
4917 The main loop should get fixed so that it isn't necessary to call | 4940 The main loop should get fixed so that it isn't necessary to call |
4918 this function if we are already at EOB. */ | 4941 this function if we are already at EOB. */ |
4919 | 4942 |
4920 if (data.bi_charbpos == bi_string_zv && bi_start_pos == bi_string_zv) | 4943 if (data.bi_charbpos == bi_string_zv && bi_start_pos == bi_string_zv) |
4921 return string_index_byte_to_char (s, data.bi_charbpos) + 1; /* Yuck! */ | 4944 return string_index_byte_to_char (disp_string, |
4945 data.bi_charbpos) + 1; /* Yuck! */ | |
4922 else | 4946 else |
4923 return string_index_byte_to_char (s, data.bi_charbpos); | 4947 return string_index_byte_to_char (disp_string, data.bi_charbpos); |
4924 } | 4948 } |
4925 | 4949 |
4926 /* Given a display line and a starting position, ensure that the | 4950 /* Given a display line and a starting position, ensure that the |
4927 contents of the display line accurately represent the visual | 4951 contents of the display line accurately represent the visual |
4928 representation of the buffer contents starting from the given | 4952 representation of the buffer contents starting from the given |
6264 return 0; | 6288 return 0; |
6265 } | 6289 } |
6266 | 6290 |
6267 if (lrpos >= pos) | 6291 if (lrpos >= pos) |
6268 { | 6292 { |
6269 Lisp_Object window; | 6293 Lisp_Object window = wrap_window (w); |
6270 XSETWINDOW (window, w); | 6294 |
6271 va_run_hook_with_args_in_buffer (XBUFFER (w->buffer), | 6295 va_run_hook_with_args_in_buffer (XBUFFER (w->buffer), |
6272 Qredisplay_end_trigger_functions, | 6296 Qredisplay_end_trigger_functions, |
6273 2, window, | 6297 2, window, |
6274 w->redisplay_end_trigger); | 6298 w->redisplay_end_trigger); |
6275 w->redisplay_end_trigger = Qnil; | 6299 w->redisplay_end_trigger = Qnil; |
6303 { | 6327 { |
6304 Lisp_Object frame; | 6328 Lisp_Object frame; |
6305 | 6329 |
6306 f->old_buffer_alist = Freplace_list (f->old_buffer_alist, | 6330 f->old_buffer_alist = Freplace_list (f->old_buffer_alist, |
6307 f->buffer_alist); | 6331 f->buffer_alist); |
6308 XSETFRAME (frame, f); | 6332 frame = wrap_frame (f); |
6309 va_run_hook_with_args (Qbuffer_list_changed_hook, 1, frame); | 6333 va_run_hook_with_args (Qbuffer_list_changed_hook, 1, frame); |
6310 } | 6334 } |
6311 | 6335 |
6312 /* Before we put a hold on frame size changes, attempt to process | 6336 /* Before we put a hold on frame size changes, attempt to process |
6313 any which are already pending. */ | 6337 any which are already pending. */ |
7771 int adjustment = | 7795 int adjustment = |
7772 (cur_elt + new_line) - Dynarr_length (w->line_start_cache) + 1; | 7796 (cur_elt + new_line) - Dynarr_length (w->line_start_cache) + 1; |
7773 Lisp_Object window; | 7797 Lisp_Object window; |
7774 int defheight; | 7798 int defheight; |
7775 | 7799 |
7776 XSETWINDOW (window, w); | 7800 window = wrap_window (w); |
7777 default_face_height_and_width (window, &defheight, 0); | 7801 default_face_height_and_width (window, &defheight, 0); |
7778 | 7802 |
7779 cur_elt = Dynarr_length (w->line_start_cache) - 1; | 7803 cur_elt = Dynarr_length (w->line_start_cache) - 1; |
7780 | 7804 |
7781 pixpos -= (adjustment * defheight); | 7805 pixpos -= (adjustment * defheight); |
8077 display_line_dynarr *dla = window_display_lines (w, CURRENT_DISP); | 8101 display_line_dynarr *dla = window_display_lines (w, CURRENT_DISP); |
8078 int num_disp_lines, modeline; | 8102 int num_disp_lines, modeline; |
8079 Lisp_Object window; | 8103 Lisp_Object window; |
8080 int defheight, defwidth; | 8104 int defheight, defwidth; |
8081 | 8105 |
8082 XSETWINDOW (window, w); | 8106 window = wrap_window (w); |
8083 default_face_height_and_width (window, &defheight, &defwidth); | 8107 default_face_height_and_width (window, &defheight, &defwidth); |
8084 | 8108 |
8085 /* If we get a bogus value indicating somewhere above or to the left of | 8109 /* If we get a bogus value indicating somewhere above or to the left of |
8086 the window, use the first window line or character position | 8110 the window, use the first window line or character position |
8087 instead. */ | 8111 instead. */ |
8750 struct display_line *dl = Dynarr_atp (dla, bot_elt); | 8774 struct display_line *dl = Dynarr_atp (dla, bot_elt); |
8751 int adj_area = y_coord - (dl->ypos + dl->descent); | 8775 int adj_area = y_coord - (dl->ypos + dl->descent); |
8752 Lisp_Object lwin; | 8776 Lisp_Object lwin; |
8753 int defheight; | 8777 int defheight; |
8754 | 8778 |
8755 XSETWINDOW (lwin, *w); | 8779 lwin = wrap_window (*w); |
8756 default_face_height_and_width (lwin, 0, &defheight); | 8780 default_face_height_and_width (lwin, 0, &defheight); |
8757 | 8781 |
8758 *row += (adj_area / defheight); | 8782 *row += (adj_area / defheight); |
8759 } | 8783 } |
8760 } | 8784 } |