1. 23 Jul, 2011 1 commit
    • Eli Zaretskii's avatar
      Fix pos-visible-in-window-p under bidi redisplay when lines are truncated. · c1734fbd
      Eli Zaretskii authored
       src/xdisp.c (move_it_in_display_line_to): Record the best matching
       position for TO_CHARPOS while scanning the line, and restore it on
       exit if none of the characters scanned was an exact match.  Fixes
       vertical-motion and pos-visible-in-window-p when exact match is
       impossible due to invisible text, and the lines are truncated.
  2. 22 Jul, 2011 2 commits
  3. 19 Jul, 2011 1 commit
    • Eli Zaretskii's avatar
      Speed up cursor motion in large fontified buffers. · e8c17b88
      Eli Zaretskii authored
       src/xdisp.c (reseat): Don't look for prev_stop, as that could mean a
       very long run.
       (next_element_from_buffer): When iterator oversteps prev_pos
       backwards, don't search for a new prev_stop more than 1000
       characters back.
       (handle_stop_backwards): Don't assume that CHARPOS is necessarily
       a stop_pos.
       (compute_display_string_pos): Check also BUF_OVERLAY_MODIFF for a
       match, when testing the cached display string position for
  4. 18 Jul, 2011 1 commit
  5. 16 Jul, 2011 1 commit
  6. 15 Jul, 2011 1 commit
  7. 14 Jul, 2011 1 commit
  8. 12 Jul, 2011 1 commit
  9. 11 Jul, 2011 1 commit
  10. 10 Jul, 2011 2 commits
    • Johan Bockgård's avatar
    • Andreas Schwab's avatar
      Protoize · 1dae0f0a
      Andreas Schwab authored
      * src/buffer.c (mmap_init, mmap_find, mmap_free_1, mmap_enlarge)
      (mmap_set_vars, mmap_alloc, mmap_free, mmap_realloc): Protoize.
      * src/data.c (fmod): Likewise.
      * src/dispnew.c (swap_glyphs_in_rows): Likewise.
      * src/emacs.c (memory_warning_signal): Likewise.
      * src/floatfns.c (float_error): Likewise.
      * src/font.c (check_gstring, check_otf_features, otf_tag_symbol)
      (otf_open, font_otf_capability, generate_otf_features)
      (font_otf_DeviceTable, font_otf_ValueRecord, font_otf_Anchor):
      * src/image.c (pbm_read_file): Likewise.
      * src/indent.c (string_display_width): Likewise.
      * src/intervals.c (check_for_interval, search_for_interval)
      (inc_interval_count, count_intervals, root_interval)
      (adjust_intervals_for_insertion, make_new_interval): Likewise.
      * src/lread.c (defalias): Likewise.
      * src/regex.c (set_image_of_range_1, set_image_of_range)
      (regex_grow_registers): Likewise.
      * src/sysdep.c (strerror): Likewise.
      * src/termcap.c (valid_filename_p, tprint, main): Likewise.
      * src/tparam.c (main): Likewise.
      * src/unexhp9k800.c (run_time_remap, save_data_space)
      (update_file_ptrs, read_header, write_header, calculate_checksum)
      (copy_file, copy_rest, display_header): Likewise.
      * src/widget.c (mark_shell_size_user_specified, create_frame_gcs):
      * src/xdisp.c (check_it): Likewise.
      * src/xfaces.c (register_color, unregister_color, unregister_colors):
      * src/xfns.c (print_fontset_result): Likewise.
      * src/xrdb.c (member, fatal, main): Likewise.
  11. 09 Jul, 2011 1 commit
    • Eli Zaretskii's avatar
      Fix various problems with cursor positioning around display properties. · 38556355
      Eli Zaretskii authored
       src/xdisp.c (move_it_in_display_line_to): Record prev_method and
       prev_pos immediately before the call to set_iterator_to_next.
       Fixes cursor motion in bidi-reordered lines with stretch glyphs
       and strings displayed in margins.  (Bug#8133)  (Bug#8867)
       Return MOVE_POS_MATCH_OR_ZV only if iterator position is past
       (pos_visible_p): Support positions in bidi-reordered lines.  Save
       and restore bidi cache.
       (move_it_in_display_line_to): If iterator ended up at
       EOL, but we never saw any buffer positions smaller than
       to_charpos, return MOVE_POS_MATCH_OR_ZV.  Fixes vertical cursor
       motion in bidi-reordered lines.
  12. 07 Jul, 2011 2 commits
  13. 05 Jul, 2011 1 commit
    • Eli Zaretskii's avatar
      Empty the bidi cache "stack" when it->sp is zeroed. · 57b3e30b
      Eli Zaretskii authored
      Solves crashes due to overflow of bidi cache stack.
      Make sure cache is saved and restored around all temporary iterations.
       src/dispnew.c (buffer_posn_from_coords): Save and restore the bidi
       cache around display iteration.
       src/window.c (Fwindow_end, window_scroll_pixel_based)
       (displayed_window_lines, Frecenter): Save and restore the bidi
       cache around display iteration.
       src/bidi.c (bidi_unshelve_cache): Ensure we have enough space before
       restoring the shelved cache.
       (bidi_cache_ensure_space): Don't assume the required size is just
       one BIDI_CACHE_CHUNK away.
       src/xdisp.c (back_to_previous_visible_line_start, reseat_1)
       (init_iterator): Empty the bidi cache "stack".
  14. 03 Jul, 2011 1 commit
    • Eli Zaretskii's avatar
      Save and restore bidi cache when saving and restoring the iterator. · ed94e6d7
      Eli Zaretskii authored
      Not tested, just compiled.
       src/bidi.c (bidi_shelve_cache, bidi_unshelve_cache): New functions.
       src/dispextern.h (bidi_shelve_cache, bidi_unshelve_cache): Declare
       src/xdisp.c (SAVE_IT, RESTORE_IT): New macros.
       (pos_visible_p, face_before_or_after_it_pos)
       (move_it_in_display_line_to, move_it_in_display_line)
       (move_it_to, move_it_vertically_backward, move_it_by_lines)
       (try_scrolling, redisplay_window, display_line): Use them when
       saving a temporary copy of the iterator and restoring it back.
  15. 02 Jul, 2011 2 commits
    • Eli Zaretskii's avatar
      Start fixing cursor motion around invisible text. · 6eec7596
      Eli Zaretskii authored
      Hit a MAJOR design problem in pushing and popping bidi iterator state.
       src/xdisp.c (reseat_1): Call bidi_init_it to resync the bidi
       iterator with IT's position.
       (handle_stop, back_to_previous_visible_line_start, reseat_1):
       Reset the from_disp_prop_p flag.
       src/bidi.c (bidi_cache_search): Don't assume bidi_cache_last_idx is
       always valid if bidi_cache_idx is valid.
       (bidi_cache_find_level_change): xassert that bidi_cache_last_idx
       is valid if it's going to be used.
    • Eli Zaretskii's avatar
      Fix the use case of popping from display property. · a2eaa31d
      Eli Zaretskii authored
       src/dispextern.h (struct iterator_stack_entry, struct it): New
       member from_disp_prop_p.
       src/xdisp.c (push_it, pop_it): Save and restore from_disp_prop_p.
       (handle_single_display_spec, push_display_prop): Set the
       from_disp_prop_p flag.
       (get_overlay_strings_1): Reset the from_disp_prop_p flag.
       (pop_it): Call iterate_out_of_display_property only if we are
       popping after iteration over a string that came from a display
       property.  Fix a typo in popping stretch info.  Add an assertion
       for verifying that the iterator position is in sync with the bidi
       (handle_single_display_spec, get_overlay_strings_1)
       (push_display_prop): Fix initialization of paragraph direction for
       string when that of the parent object is not yet determined.
  16. 01 Jul, 2011 1 commit
    • Eli Zaretskii's avatar
      Support bidi reordering of unibyte strings. Fix crash displaying "All" in... · f3014ef5
      Eli Zaretskii authored
      Support bidi reordering of unibyte strings.  Fix crash displaying "All" in mode line of an empty buffer.
       src/dispextern.h (struct bidi_string_data): New member `unibyte'.
       src/xdisp.c (handle_single_display_spec, next_overlay_string)
       (get_overlay_strings_1, reseat_1, reseat_to_string)
       (push_display_prop): Set up the `unibyte' member of bidi_it.string
       correctly.  Don't assume unibyte strings are not bidi-reordered.
       (compute_display_string_end): Fix handling the case of C string.
       src/bidi.c (bidi_count_bytes, bidi_char_at_pos): Accept an
       additional argument UNIBYTE, and support unibyte strings.  All
       callers changed.
       (bidi_fetch_char): Support unibyte strings.
  17. 25 Jun, 2011 2 commits
    • Eli Zaretskii's avatar
      Initial version of display/overlay strings is working. · a1344e7d
      Eli Zaretskii authored
       src/xdisp.c (set_iterator_to_next, get_visually_first_element): Use
       it->bidi_it.string.schars rather than it->string_nchars when
       testing whether we're beyond string end, because string_nchars is
       zero for strings that come from overlays and display properties.
       src/bidi.c (bidi_cache_iterator_state): Fix a bug with testing
       character positions against the cached range, when we use a
       stacked cache.
       src/dispextern.h (struct iterator_stack_entry): New member
       src/xdisp.c (push_it, pop_it): Save and restore it.
    • Eli Zaretskii's avatar
      Set up the bidi iterator for iterating display strings and overlay strings. · 0c22566f
      Eli Zaretskii authored
      Not tested yet, just compiled.
       src/xdisp.c (handle_single_display_spec, next_overlay_string)
       (get_overlay_strings_1, push_display_prop): Set up the bidi
       iterator for displaying display or overlay strings.
       (forward_to_next_line_start): Don't use the shortcut if
       (back_to_previous_visible_line_start): If handle_display_prop
       pushed the iterator stack, restore the internal state of the bidi
       iterator by calling bidi_pop_it same number of times.
       (reseat_at_next_visible_line_start): If ON_NEWLINE_P is non-zero,
       and we are bidi-iterating, don't decrement the iterator position;
       instead, set the first_elt flag in the bidi iterator, to produce
       the same effect.
       (reseat_1): Remove redundant setting of string_from_display_prop_p.
       (push_display_prop): xassert that we are iterating a buffer.
       (push_it, pop_it): Save and restore the state of the
       bidi iterator.  Save and restore the bidi_p flag.
       (pop_it): Iterate out of display property for string iteration as
       (iterate_out_of_display_property): Support iteration over strings.
       (handle_single_display_spec): Set up it->bidi_it for iteration
       over a display string, and call bidi_init_it.
       src/bidi.c (bidi_cache_start_stack, bidi_push_it): Use IT_STACK_SIZE.
       src/dispextern.h (struct iterator_stack_entry): New member bidi_p.
       (struct it): Member bidi_p is now a bit field 1 bit wide.
  18. 24 Jun, 2011 1 commit
  19. 22 Jun, 2011 1 commit
    • Paul Eggert's avatar
      GLYPH_DEBUG fixes · 85fece3e
      Paul Eggert authored
      The following patches are for when GLYPH_DEBUG && !XASSERT.
      * dispextern.h (trace_redisplay_p, dump_glyph_string):
      * dispnew.c (flush_stdout):
      * xdisp.c (dump_glyph_row, dump_glyph_matrix, dump_glyph):
      Mark as externally visible.
      * dispnew.c (check_window_matrix_pointers): Now static.
      * dispnew.c (window_to_frame_vpos):
      * xfns.c (unwind_create_frame):
      * xterm.c (x_check_font): Remove unused local.
      * scroll.c (CHECK_BOUNDS):
      * xfaces.c (cache_fache): Rename local to avoid shadowing.
      * xfns.c, w32fns.c (image_cache_refcount, dpyinfo_refcount): Now static.
      * xdisp.c (check_window_end): Now a no-op if !XASSERTS.
      (debug_first_unchanged_at_end_vpos, debug_last_unchanged_at_beg_vpos)
      (debug_dvpos, debug_dy, debug_delta, debug_delta_bytes, debug_end_vpos):
      Now static.
      (debug_method_add): Use va_list and vsprintf rather than relying
      on undefined behavior with wrong number of arguments.
      (dump_glyph, dump_glyph_row, Fdump_glyph_matrix):
      Don't assume ptrdiff_t and EMACS_INT are the same width as int.
      In this code, it's OK to assume C99 behavior for ptrdiff_t formats
      since we're not interested in debugging glyphs with old libraries.
      * xfaces.c (cache_face): Move debugging code earlier; this pacifies
      GCC 4.6.0's static checking.
  20. 21 Jun, 2011 3 commits
  21. 18 Jun, 2011 6 commits
    • Eli Zaretskii's avatar
      Add comments for forced L2R directions of menu bar and tool bar. · acb28818
      Eli Zaretskii authored
      GCPRO Lisp string inside bidi.c.
      Force L2R direction in buffer menu buffer.
       src/xdisp.c (tool_bar_lines_needed, redisplay_tool_bar)
       (display_menu_bar): Force left-to-right direction.  Add a FIXME
       comment for making that be controlled by a user option.
       src/bidi.c (bidi_move_to_visually_next): GCPRO the Lisp string we
       are iterating.
       lisp/buff-menu.el (Buffer-menu-mode, list-buffers-noselect): Force
       left-to-right paragraph direction.
    • Chong Yidong's avatar
      Fixes for GLYPH_DEBUG. · 7d7d0045
      Chong Yidong authored
      * dispnew.c (add_window_display_history): Use BVAR.
      * xdisp.c (debug_method_add): Use BVAR.
      (check_window_end, dump_glyph_matrix, dump_glyph)
      (dump_glyph_row, dump_glyph_string): Convert arglist to ANSI C.
      * xfaces.c (check_lface_attrs, check_lface, dump_realized_face):
      * xfns.c (Fx_create_frame, x_create_tip_frame): Delay image cache
      check till after the cache is created in init_frame_faces.
    • Eli Zaretskii's avatar
      Tried and abandoned idea of displaying mode line and tool/menu-bars R2L. · cc7245e4
      Eli Zaretskii authored
      Added those features to etc/TODO wishlist.
      Fixed src/.gdbinit for changes in Lisp vector structures.
       src/.gdbinit (xvectype, xvector, xcompiled, xchartable, xboolvector)
       (xpr, xfont, xbacktrace): Use "header.size" when accessing vectors
       and vector-like objects.
    • Eli Zaretskii's avatar
      Refactor getting the first element into a separate function. · 1ace7267
      Eli Zaretskii authored
       src/xdisp.c (get_visually_first_element): New function, refactored
       from common parts of next_element_from_buffer, next_element_from_string,
       and next_element_from_c_string.
    • Eli Zaretskii's avatar
      Fix box face decision for BEFORE_P case. · 4d3a8bb4
      Eli Zaretskii authored
       src/xdisp.c (face_before_or_after_it_pos): Support bidi iteration.
    • Eli Zaretskii's avatar
      Fix the decision about box_face in mode line for reordered text. · 40eb66c4
      Eli Zaretskii authored
      This fixes display of composed characters in buffer name on mode line.
       src/xdisp.c (face_before_or_after_it_pos): Support bidi iteration
       when BEFORE_P is zero.
       (next_element_from_c_string): Handle the case of the first string
       character that is not the first one in the visual order.
  22. 17 Jun, 2011 2 commits
  23. 16 Jun, 2011 1 commit
    • Eli Zaretskii's avatar
      Fix display of R2L strings in mode line. · 578b494e
      Eli Zaretskii authored
      Composed characters still don't work.
       src/xdisp.c (init_iterator): Don't initialize it->bidi_p for strings
       (reseat_to_string): Initialize it->bidi_p for strings here.
       (next_element_from_string, next_element_from_c_string)
       (next_element_from_buffer): Add xassert's for correspondence
       between IT's object being iterated and it->bidi_it.string
       src/bidi.c (bidi_level_of_next_char): Fix the logic for looking up
       the sentinel state in the cache.
  24. 14 Jun, 2011 1 commit
    • Paul Eggert's avatar
      Variadic C functions now count arguments with ptrdiff_t. · f66c7cf8
      Paul Eggert authored
      This partly undoes my 2011-03-30 change, which replaced int with size_t.
      Back then I didn't know that the Emacs coding style prefers signed int.
      Also, in the meantime I found a few more instances where arguments
      were being counted with int, which may truncate counts on 64-bit
      machines, or EMACS_INT, which may be unnecessarily wide.
      * lisp.h (struct Lisp_Subr.function.aMANY)
      (DEFUN_ARGS_MANY, internal_condition_case_n, safe_call):
      Arg counts are now ptrdiff_t, not size_t.
      All variadic functions and their callers changed accordingly.
      (struct gcpro.nvars): Now size_t, not size_t.  All uses changed.
      * bytecode.c (exec_byte_code): Check maxdepth for overflow,
      to avoid potential buffer overrun.  Don't assume arg counts fit in 'int'.
      * callint.c (Fcall_interactively): Check arg count for overflow,
      to avoid potential buffer overrun.  Use signed char, not 'int',
      for 'varies' array, so that we needn't bother to check its size
      calculation for overflow.
      * editfns.c (Fformat): Use ptrdiff_t, not EMACS_INT, to count args.
      * eval.c (apply_lambda):
      * fns.c (Fmapconcat): Use XFASTINT, not XINT, to get args length.
      (struct textprop_rec.argnum): Now ptrdiff_t, not int.  All uses changed.
      (mapconcat): Use ptrdiff_t, not int and EMACS_INT, to count args.
  25. 13 Jun, 2011 3 commits
    • Eli Zaretskii's avatar
      Fix string handling to avoid data relocation gotcha. · 9f257352
      Eli Zaretskii authored
      Bugs in mode-line display still there.
       src/xdisp.c (compute_display_string_pos)
       (compute_display_string_end, reseat_to_string): Don't assume
       it->bidi_it.string.s always points to string.lstring's data.
       src/bidi.c (bidi_fetch_char, bidi_paragraph_init)
       (bidi_resolve_explicit_1, bidi_resolve_explicit)
       (bidi_resolve_weak, bidi_level_of_next_char): Don't assume
       string.s always points to string.lstring's data.
    • Paul Eggert's avatar
      GLYPH_CODE_FACE returns EMACS_INT, not int. · 9910e595
      Paul Eggert authored
      * dispextern.h (merge_faces):
      * xfaces.c (merge_faces):
      * xdisp.c (get_next_display_element):
      (next_element_from_display_vector): Don't assume EMACS_INT fits in int.
    • Paul Eggert's avatar
      * character.h (CHAR_VALID_P): Remove unused parameter. · 2638320e
      Paul Eggert authored
      * fontset.c, lisp.h, xdisp.c: All uses changed.