diff options
| author | Chong Yidong | 2008-06-24 18:00:20 +0000 |
|---|---|---|
| committer | Chong Yidong | 2008-06-24 18:00:20 +0000 |
| commit | 6de3804e94bf180ff8449552fc8563a7c31503a3 (patch) | |
| tree | 9d074d4cc095285cadbc3004f8dd2f9276c1f806 /src | |
| parent | 81b6a6652625aab2207d2a3468d2553ae37f0a71 (diff) | |
| download | emacs-6de3804e94bf180ff8449552fc8563a7c31503a3.tar.gz emacs-6de3804e94bf180ff8449552fc8563a7c31503a3.zip | |
(Vtruncate_partial_width_windows): New Lisp_Object, replacing
truncate_partial_width_windows.
(init_iterator): If Vtruncate_partial_width_windows is an integer,
truncate only if the window width is below that integer.
(start_display. resize_mini_window, produce_stretch_glyph)
(display_string, move_it_in_display_line_to): Use line_wrap.
(back_to_previous_visible_line_start, reseat_1): Reset
string_from_display_prop_p.
(display_line): Extend default face to end of line when wrapping.
(display_line, move_it_in_display_line_to): Add ability
to wrap continued lines at word boundaries.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 253 |
1 files changed, 198 insertions, 55 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 18f176e2c06..eefccefc05e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -420,7 +420,7 @@ static struct buffer *this_line_buffer; | |||
| 420 | /* Nonzero means truncate lines in all windows less wide than the | 420 | /* Nonzero means truncate lines in all windows less wide than the |
| 421 | frame. */ | 421 | frame. */ |
| 422 | 422 | ||
| 423 | int truncate_partial_width_windows; | 423 | Lisp_Object Vtruncate_partial_width_windows; |
| 424 | 424 | ||
| 425 | /* A flag to control how to display unibyte 8-bit character. */ | 425 | /* A flag to control how to display unibyte 8-bit character. */ |
| 426 | 426 | ||
| @@ -2634,19 +2634,27 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id) | |||
| 2634 | it->tab_width = 8; | 2634 | it->tab_width = 8; |
| 2635 | 2635 | ||
| 2636 | /* Are lines in the display truncated? */ | 2636 | /* Are lines in the display truncated? */ |
| 2637 | it->truncate_lines_p | 2637 | if (base_face_id != DEFAULT_FACE_ID |
| 2638 | = (base_face_id != DEFAULT_FACE_ID | 2638 | || XINT (it->w->hscroll) |
| 2639 | || XINT (it->w->hscroll) | 2639 | || (! WINDOW_FULL_WIDTH_P (it->w) |
| 2640 | || (truncate_partial_width_windows | 2640 | && ((!NILP (Vtruncate_partial_width_windows) |
| 2641 | && !WINDOW_FULL_WIDTH_P (it->w)) | 2641 | && !INTEGERP (Vtruncate_partial_width_windows)) |
| 2642 | || !NILP (current_buffer->truncate_lines)); | 2642 | || (INTEGERP (Vtruncate_partial_width_windows) |
| 2643 | && (WINDOW_TOTAL_COLS (it->w) | ||
| 2644 | < XINT (Vtruncate_partial_width_windows)))))) | ||
| 2645 | it->line_wrap = TRUNCATE; | ||
| 2646 | else if (NILP (current_buffer->truncate_lines)) | ||
| 2647 | it->line_wrap = NILP (current_buffer->word_wrap) | ||
| 2648 | ? WINDOW_WRAP : WORD_WRAP; | ||
| 2649 | else | ||
| 2650 | it->line_wrap = TRUNCATE; | ||
| 2643 | 2651 | ||
| 2644 | /* Get dimensions of truncation and continuation glyphs. These are | 2652 | /* Get dimensions of truncation and continuation glyphs. These are |
| 2645 | displayed as fringe bitmaps under X, so we don't need them for such | 2653 | displayed as fringe bitmaps under X, so we don't need them for such |
| 2646 | frames. */ | 2654 | frames. */ |
| 2647 | if (!FRAME_WINDOW_P (it->f)) | 2655 | if (!FRAME_WINDOW_P (it->f)) |
| 2648 | { | 2656 | { |
| 2649 | if (it->truncate_lines_p) | 2657 | if (it->line_wrap == TRUNCATE) |
| 2650 | { | 2658 | { |
| 2651 | /* We will need the truncation glyph. */ | 2659 | /* We will need the truncation glyph. */ |
| 2652 | xassert (it->glyph_row == NULL); | 2660 | xassert (it->glyph_row == NULL); |
| @@ -2696,7 +2704,7 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id) | |||
| 2696 | for window-based redisplay. */ | 2704 | for window-based redisplay. */ |
| 2697 | if (!FRAME_WINDOW_P (it->f)) | 2705 | if (!FRAME_WINDOW_P (it->f)) |
| 2698 | { | 2706 | { |
| 2699 | if (it->truncate_lines_p) | 2707 | if (it->line_wrap == TRUNCATE) |
| 2700 | it->last_visible_x -= it->truncation_pixel_width; | 2708 | it->last_visible_x -= it->truncation_pixel_width; |
| 2701 | else | 2709 | else |
| 2702 | it->last_visible_x -= it->continuation_pixel_width; | 2710 | it->last_visible_x -= it->continuation_pixel_width; |
| @@ -2769,7 +2777,7 @@ start_display (it, w, pos) | |||
| 2769 | 2777 | ||
| 2770 | /* Don't reseat to previous visible line start if current start | 2778 | /* Don't reseat to previous visible line start if current start |
| 2771 | position is in a string or image. */ | 2779 | position is in a string or image. */ |
| 2772 | if (it->method == GET_FROM_BUFFER && !it->truncate_lines_p) | 2780 | if (it->method == GET_FROM_BUFFER && it->line_wrap != TRUNCATE) |
| 2773 | { | 2781 | { |
| 2774 | int start_at_line_beg_p; | 2782 | int start_at_line_beg_p; |
| 2775 | int first_y = it->current_y; | 2783 | int first_y = it->current_y; |
| @@ -2794,7 +2802,7 @@ start_display (it, w, pos) | |||
| 2794 | taken us to the start of the continuation line but to the | 2802 | taken us to the start of the continuation line but to the |
| 2795 | end of the continued line. */ | 2803 | end of the continued line. */ |
| 2796 | if (it->current_x > 0 | 2804 | if (it->current_x > 0 |
| 2797 | && !it->truncate_lines_p /* Lines are continued. */ | 2805 | && it->line_wrap != TRUNCATE /* Lines are continued. */ |
| 2798 | && (/* And glyph doesn't fit on the line. */ | 2806 | && (/* And glyph doesn't fit on the line. */ |
| 2799 | new_x > it->last_visible_x | 2807 | new_x > it->last_visible_x |
| 2800 | /* Or it fits exactly and we're on a window | 2808 | /* Or it fits exactly and we're on a window |
| @@ -5432,6 +5440,7 @@ back_to_previous_visible_line_start (it) | |||
| 5432 | pos = --IT_CHARPOS (it2); | 5440 | pos = --IT_CHARPOS (it2); |
| 5433 | --IT_BYTEPOS (it2); | 5441 | --IT_BYTEPOS (it2); |
| 5434 | it2.sp = 0; | 5442 | it2.sp = 0; |
| 5443 | it2.string_from_display_prop_p = 0; | ||
| 5435 | if (handle_display_prop (&it2) == HANDLED_RETURN | 5444 | if (handle_display_prop (&it2) == HANDLED_RETURN |
| 5436 | && !NILP (val = get_char_property_and_overlay | 5445 | && !NILP (val = get_char_property_and_overlay |
| 5437 | (make_number (pos), Qdisplay, Qnil, &overlay)) | 5446 | (make_number (pos), Qdisplay, Qnil, &overlay)) |
| @@ -5582,6 +5591,7 @@ reseat_1 (it, pos, set_stop_p) | |||
| 5582 | IT_STRING_CHARPOS (*it) = -1; | 5591 | IT_STRING_CHARPOS (*it) = -1; |
| 5583 | IT_STRING_BYTEPOS (*it) = -1; | 5592 | IT_STRING_BYTEPOS (*it) = -1; |
| 5584 | it->string = Qnil; | 5593 | it->string = Qnil; |
| 5594 | it->string_from_display_prop_p = 0; | ||
| 5585 | it->method = GET_FROM_BUFFER; | 5595 | it->method = GET_FROM_BUFFER; |
| 5586 | it->object = it->w->buffer; | 5596 | it->object = it->w->buffer; |
| 5587 | it->area = TEXT_AREA; | 5597 | it->area = TEXT_AREA; |
| @@ -6643,11 +6653,20 @@ move_it_in_display_line_to (struct it *it, | |||
| 6643 | { | 6653 | { |
| 6644 | enum move_it_result result = MOVE_UNDEFINED; | 6654 | enum move_it_result result = MOVE_UNDEFINED; |
| 6645 | struct glyph_row *saved_glyph_row; | 6655 | struct glyph_row *saved_glyph_row; |
| 6656 | struct it wrap_it, atpos_it; | ||
| 6657 | int may_wrap = 0; | ||
| 6646 | 6658 | ||
| 6647 | /* Don't produce glyphs in produce_glyphs. */ | 6659 | /* Don't produce glyphs in produce_glyphs. */ |
| 6648 | saved_glyph_row = it->glyph_row; | 6660 | saved_glyph_row = it->glyph_row; |
| 6649 | it->glyph_row = NULL; | 6661 | it->glyph_row = NULL; |
| 6650 | 6662 | ||
| 6663 | /* Use wrap_it to save a copy of IT wherever a word wrap could | ||
| 6664 | occur. Use atpos_it to save a copy of IT at the desired | ||
| 6665 | position, if found, so that we can scan ahead and check if the | ||
| 6666 | word later overshoots the window edge. */ | ||
| 6667 | wrap_it.sp = -1; | ||
| 6668 | atpos_it.sp = -1; | ||
| 6669 | |||
| 6651 | #define BUFFER_POS_REACHED_P() \ | 6670 | #define BUFFER_POS_REACHED_P() \ |
| 6652 | ((op & MOVE_TO_POS) != 0 \ | 6671 | ((op & MOVE_TO_POS) != 0 \ |
| 6653 | && BUFFERP (it->object) \ | 6672 | && BUFFERP (it->object) \ |
| @@ -6667,36 +6686,77 @@ move_it_in_display_line_to (struct it *it, | |||
| 6667 | && it->method == GET_FROM_BUFFER | 6686 | && it->method == GET_FROM_BUFFER |
| 6668 | && IT_CHARPOS (*it) > to_charpos) | 6687 | && IT_CHARPOS (*it) > to_charpos) |
| 6669 | { | 6688 | { |
| 6670 | result = MOVE_POS_MATCH_OR_ZV; | 6689 | if (it->line_wrap == WORD_WRAP) |
| 6671 | break; | 6690 | { |
| 6691 | /* If wrap_it is valid, the current position might be in | ||
| 6692 | a word that is wrapped to the next line, so continue | ||
| 6693 | to see if that happens. */ | ||
| 6694 | if (wrap_it.sp < 0) | ||
| 6695 | { | ||
| 6696 | result = MOVE_POS_MATCH_OR_ZV; | ||
| 6697 | break; | ||
| 6698 | } | ||
| 6699 | if (atpos_it.sp < 0) | ||
| 6700 | atpos_it = *it; | ||
| 6701 | } | ||
| 6702 | else | ||
| 6703 | { | ||
| 6704 | result = MOVE_POS_MATCH_OR_ZV; | ||
| 6705 | break; | ||
| 6706 | } | ||
| 6672 | } | 6707 | } |
| 6673 | 6708 | ||
| 6674 | /* Stop when ZV reached. | 6709 | /* Stop when ZV reached. |
| 6675 | We used to stop here when TO_CHARPOS reached as well, but that is | 6710 | We used to stop here when TO_CHARPOS reached as well, but that is |
| 6676 | too soon if this glyph does not fit on this line. So we handle it | 6711 | too soon if this glyph does not fit on this line. So we handle it |
| 6677 | explicitly below. */ | 6712 | explicitly below. */ |
| 6678 | if (!get_next_display_element (it) | 6713 | if (!get_next_display_element (it)) |
| 6679 | || (it->truncate_lines_p | ||
| 6680 | && BUFFER_POS_REACHED_P ())) | ||
| 6681 | { | 6714 | { |
| 6682 | result = MOVE_POS_MATCH_OR_ZV; | 6715 | result = MOVE_POS_MATCH_OR_ZV; |
| 6683 | break; | 6716 | break; |
| 6684 | } | 6717 | } |
| 6685 | 6718 | ||
| 6686 | /* The call to produce_glyphs will get the metrics of the | 6719 | if (it->line_wrap == TRUNCATE) |
| 6687 | display element IT is loaded with. We record in x the | 6720 | { |
| 6688 | x-position before this display element in case it does not | 6721 | if (BUFFER_POS_REACHED_P ()) |
| 6689 | fit on the line. */ | 6722 | { |
| 6690 | x = it->current_x; | 6723 | result = MOVE_POS_MATCH_OR_ZV; |
| 6691 | 6724 | break; | |
| 6692 | /* Remember the line height so far in case the next element doesn't | 6725 | } |
| 6693 | fit on the line. */ | 6726 | } |
| 6694 | if (!it->truncate_lines_p) | 6727 | else |
| 6695 | { | 6728 | { |
| 6729 | /* Remember the line height so far in case the next element | ||
| 6730 | doesn't fit on the line. */ | ||
| 6696 | ascent = it->max_ascent; | 6731 | ascent = it->max_ascent; |
| 6697 | descent = it->max_descent; | 6732 | descent = it->max_descent; |
| 6733 | |||
| 6734 | if (it->line_wrap == WORD_WRAP) | ||
| 6735 | { | ||
| 6736 | if (it->what == IT_CHARACTER | ||
| 6737 | && (it->c == ' ' || it->c == '\t')) | ||
| 6738 | may_wrap = 1; | ||
| 6739 | else if (may_wrap) | ||
| 6740 | { | ||
| 6741 | /* We are done if the position is already found. */ | ||
| 6742 | if (atpos_it.sp >= 0) | ||
| 6743 | { | ||
| 6744 | *it = atpos_it; | ||
| 6745 | atpos_it.sp = -1; | ||
| 6746 | goto buffer_pos_reached; | ||
| 6747 | } | ||
| 6748 | wrap_it = *it; | ||
| 6749 | may_wrap = 0; | ||
| 6750 | } | ||
| 6751 | } | ||
| 6698 | } | 6752 | } |
| 6699 | 6753 | ||
| 6754 | /* The call to produce_glyphs will get the metrics of the | ||
| 6755 | display element IT is loaded with. Record the x-position | ||
| 6756 | before this display element, in case it doesn't fit on the | ||
| 6757 | line. */ | ||
| 6758 | x = it->current_x; | ||
| 6759 | |||
| 6700 | PRODUCE_GLYPHS (it); | 6760 | PRODUCE_GLYPHS (it); |
| 6701 | 6761 | ||
| 6702 | if (it->area != TEXT_AREA) | 6762 | if (it->area != TEXT_AREA) |
| @@ -6740,19 +6800,30 @@ move_it_in_display_line_to (struct it *it, | |||
| 6740 | if ((op & MOVE_TO_X) && new_x > to_x) | 6800 | if ((op & MOVE_TO_X) && new_x > to_x) |
| 6741 | { | 6801 | { |
| 6742 | if (BUFFER_POS_REACHED_P ()) | 6802 | if (BUFFER_POS_REACHED_P ()) |
| 6743 | goto buffer_pos_reached; | 6803 | { |
| 6804 | if (it->line_wrap == WORD_WRAP) | ||
| 6805 | { | ||
| 6806 | if (wrap_it.sp < 0) | ||
| 6807 | goto buffer_pos_reached; | ||
| 6808 | if (atpos_it.sp < 0) | ||
| 6809 | atpos_it = *it; | ||
| 6810 | } | ||
| 6811 | else | ||
| 6812 | goto buffer_pos_reached; | ||
| 6813 | } | ||
| 6744 | it->current_x = x; | 6814 | it->current_x = x; |
| 6745 | result = MOVE_X_REACHED; | 6815 | result = MOVE_X_REACHED; |
| 6746 | break; | 6816 | break; |
| 6747 | } | 6817 | } |
| 6748 | else if (/* Lines are continued. */ | 6818 | |
| 6749 | !it->truncate_lines_p | 6819 | if (/* Lines are continued. */ |
| 6750 | && (/* And glyph doesn't fit on the line. */ | 6820 | it->line_wrap != TRUNCATE |
| 6751 | new_x > it->last_visible_x | 6821 | && (/* And glyph doesn't fit on the line. */ |
| 6752 | /* Or it fits exactly and we're on a window | 6822 | new_x > it->last_visible_x |
| 6753 | system frame. */ | 6823 | /* Or it fits exactly and we're on a window |
| 6754 | || (new_x == it->last_visible_x | 6824 | system frame. */ |
| 6755 | && FRAME_WINDOW_P (it->f)))) | 6825 | || (new_x == it->last_visible_x |
| 6826 | && FRAME_WINDOW_P (it->f)))) | ||
| 6756 | { | 6827 | { |
| 6757 | if (/* IT->hpos == 0 means the very first glyph | 6828 | if (/* IT->hpos == 0 means the very first glyph |
| 6758 | doesn't fit on the line, e.g. a wide image. */ | 6829 | doesn't fit on the line, e.g. a wide image. */ |
| @@ -6811,24 +6882,37 @@ move_it_in_display_line_to (struct it *it, | |||
| 6811 | it->max_descent = descent; | 6882 | it->max_descent = descent; |
| 6812 | } | 6883 | } |
| 6813 | 6884 | ||
| 6885 | if (wrap_it.sp >= 0) | ||
| 6886 | { | ||
| 6887 | *it = wrap_it; | ||
| 6888 | atpos_it.sp = -1; | ||
| 6889 | } | ||
| 6890 | |||
| 6814 | TRACE_MOVE ((stderr, "move_it_in: continued at %d\n", | 6891 | TRACE_MOVE ((stderr, "move_it_in: continued at %d\n", |
| 6815 | IT_CHARPOS (*it))); | 6892 | IT_CHARPOS (*it))); |
| 6816 | result = MOVE_LINE_CONTINUED; | 6893 | result = MOVE_LINE_CONTINUED; |
| 6817 | break; | 6894 | break; |
| 6818 | } | 6895 | } |
| 6819 | else if (BUFFER_POS_REACHED_P ()) | 6896 | |
| 6820 | goto buffer_pos_reached; | 6897 | if (BUFFER_POS_REACHED_P ()) |
| 6821 | else if (new_x > it->first_visible_x) | 6898 | { |
| 6899 | if (it->line_wrap == WORD_WRAP) | ||
| 6900 | { | ||
| 6901 | if (wrap_it.sp < 0) | ||
| 6902 | goto buffer_pos_reached; | ||
| 6903 | if (atpos_it.sp < 0) | ||
| 6904 | atpos_it = *it; | ||
| 6905 | } | ||
| 6906 | else | ||
| 6907 | goto buffer_pos_reached; | ||
| 6908 | } | ||
| 6909 | |||
| 6910 | if (new_x > it->first_visible_x) | ||
| 6822 | { | 6911 | { |
| 6823 | /* Glyph is visible. Increment number of glyphs that | 6912 | /* Glyph is visible. Increment number of glyphs that |
| 6824 | would be displayed. */ | 6913 | would be displayed. */ |
| 6825 | ++it->hpos; | 6914 | ++it->hpos; |
| 6826 | } | 6915 | } |
| 6827 | else | ||
| 6828 | { | ||
| 6829 | /* Glyph is completely off the left margin of the display | ||
| 6830 | area. Nothing to do. */ | ||
| 6831 | } | ||
| 6832 | } | 6916 | } |
| 6833 | 6917 | ||
| 6834 | if (result != MOVE_UNDEFINED) | 6918 | if (result != MOVE_UNDEFINED) |
| @@ -6867,7 +6951,7 @@ move_it_in_display_line_to (struct it *it, | |||
| 6867 | 6951 | ||
| 6868 | /* Stop if lines are truncated and IT's current x-position is | 6952 | /* Stop if lines are truncated and IT's current x-position is |
| 6869 | past the right edge of the window now. */ | 6953 | past the right edge of the window now. */ |
| 6870 | if (it->truncate_lines_p | 6954 | if (it->line_wrap == TRUNCATE |
| 6871 | && it->current_x >= it->last_visible_x) | 6955 | && it->current_x >= it->last_visible_x) |
| 6872 | { | 6956 | { |
| 6873 | #ifdef HAVE_WINDOW_SYSTEM | 6957 | #ifdef HAVE_WINDOW_SYSTEM |
| @@ -6893,6 +6977,11 @@ move_it_in_display_line_to (struct it *it, | |||
| 6893 | 6977 | ||
| 6894 | #undef BUFFER_POS_REACHED_P | 6978 | #undef BUFFER_POS_REACHED_P |
| 6895 | 6979 | ||
| 6980 | /* If we scanned beyond to_pos and didn't find a point to wrap at, | ||
| 6981 | return iterator at to_pos. */ | ||
| 6982 | if (atpos_it.sp >= 0) | ||
| 6983 | *it = atpos_it; | ||
| 6984 | |||
| 6896 | /* Restore the iterator settings altered at the beginning of this | 6985 | /* Restore the iterator settings altered at the beginning of this |
| 6897 | function. */ | 6986 | function. */ |
| 6898 | it->glyph_row = saved_glyph_row; | 6987 | it->glyph_row = saved_glyph_row; |
| @@ -8555,7 +8644,7 @@ resize_mini_window (w, exact_p) | |||
| 8555 | max_height = min (total_height, max_height); | 8644 | max_height = min (total_height, max_height); |
| 8556 | 8645 | ||
| 8557 | /* Find out the height of the text in the window. */ | 8646 | /* Find out the height of the text in the window. */ |
| 8558 | if (it.truncate_lines_p) | 8647 | if (it.line_wrap == TRUNCATE) |
| 8559 | height = 1; | 8648 | height = 1; |
| 8560 | else | 8649 | else |
| 8561 | { | 8650 | { |
| @@ -15997,7 +16086,8 @@ extend_face_to_end_of_line (it) | |||
| 15997 | && it->glyph_row->displays_text_p | 16086 | && it->glyph_row->displays_text_p |
| 15998 | && face->box == FACE_NO_BOX | 16087 | && face->box == FACE_NO_BOX |
| 15999 | && face->background == FRAME_BACKGROUND_PIXEL (f) | 16088 | && face->background == FRAME_BACKGROUND_PIXEL (f) |
| 16000 | && !face->stipple) | 16089 | && !face->stipple |
| 16090 | && it->line_wrap != WORD_WRAP) | ||
| 16001 | return; | 16091 | return; |
| 16002 | 16092 | ||
| 16003 | /* Set the glyph row flag indicating that the face of the last glyph | 16093 | /* Set the glyph row flag indicating that the face of the last glyph |
| @@ -16212,6 +16302,11 @@ display_line (it) | |||
| 16212 | { | 16302 | { |
| 16213 | struct glyph_row *row = it->glyph_row; | 16303 | struct glyph_row *row = it->glyph_row; |
| 16214 | Lisp_Object overlay_arrow_string; | 16304 | Lisp_Object overlay_arrow_string; |
| 16305 | struct it wrap_it; | ||
| 16306 | int may_wrap = 0, wrap_x; | ||
| 16307 | int wrap_row_used = -1, wrap_row_ascent, wrap_row_height; | ||
| 16308 | int wrap_row_phys_ascent, wrap_row_phys_height; | ||
| 16309 | int wrap_row_extra_line_spacing; | ||
| 16215 | 16310 | ||
| 16216 | /* We always start displaying at hpos zero even if hscrolled. */ | 16311 | /* We always start displaying at hpos zero even if hscrolled. */ |
| 16217 | xassert (it->hpos == 0 && it->current_x == 0); | 16312 | xassert (it->hpos == 0 && it->current_x == 0); |
| @@ -16306,12 +16401,31 @@ display_line (it) | |||
| 16306 | 16401 | ||
| 16307 | /* Remember the line height so far in case the next element doesn't | 16402 | /* Remember the line height so far in case the next element doesn't |
| 16308 | fit on the line. */ | 16403 | fit on the line. */ |
| 16309 | if (!it->truncate_lines_p) | 16404 | if (it->line_wrap != TRUNCATE) |
| 16310 | { | 16405 | { |
| 16311 | ascent = it->max_ascent; | 16406 | ascent = it->max_ascent; |
| 16312 | descent = it->max_descent; | 16407 | descent = it->max_descent; |
| 16313 | phys_ascent = it->max_phys_ascent; | 16408 | phys_ascent = it->max_phys_ascent; |
| 16314 | phys_descent = it->max_phys_descent; | 16409 | phys_descent = it->max_phys_descent; |
| 16410 | |||
| 16411 | if (it->line_wrap == WORD_WRAP && it->area == TEXT_AREA) | ||
| 16412 | { | ||
| 16413 | if (it->what == IT_CHARACTER | ||
| 16414 | && (it->c == ' ' || it->c == '\t')) | ||
| 16415 | may_wrap = 1; | ||
| 16416 | else if (may_wrap) | ||
| 16417 | { | ||
| 16418 | wrap_it = *it; | ||
| 16419 | wrap_x = x; | ||
| 16420 | wrap_row_used = row->used[TEXT_AREA]; | ||
| 16421 | wrap_row_ascent = row->ascent; | ||
| 16422 | wrap_row_height = row->height; | ||
| 16423 | wrap_row_phys_ascent = row->phys_ascent; | ||
| 16424 | wrap_row_phys_height = row->phys_height; | ||
| 16425 | wrap_row_extra_line_spacing = row->extra_line_spacing; | ||
| 16426 | may_wrap = 0; | ||
| 16427 | } | ||
| 16428 | } | ||
| 16315 | } | 16429 | } |
| 16316 | 16430 | ||
| 16317 | PRODUCE_GLYPHS (it); | 16431 | PRODUCE_GLYPHS (it); |
| @@ -16371,7 +16485,7 @@ display_line (it) | |||
| 16371 | new_x = x + glyph->pixel_width; | 16485 | new_x = x + glyph->pixel_width; |
| 16372 | 16486 | ||
| 16373 | if (/* Lines are continued. */ | 16487 | if (/* Lines are continued. */ |
| 16374 | !it->truncate_lines_p | 16488 | it->line_wrap != TRUNCATE |
| 16375 | && (/* Glyph doesn't fit on the line. */ | 16489 | && (/* Glyph doesn't fit on the line. */ |
| 16376 | new_x > it->last_visible_x | 16490 | new_x > it->last_visible_x |
| 16377 | /* Or it fits exactly on a window system frame. */ | 16491 | /* Or it fits exactly on a window system frame. */ |
| @@ -16412,6 +16526,8 @@ display_line (it) | |||
| 16412 | } | 16526 | } |
| 16413 | } | 16527 | } |
| 16414 | #endif /* HAVE_WINDOW_SYSTEM */ | 16528 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 16529 | if (wrap_row_used > 0) | ||
| 16530 | goto back_to_wrap; | ||
| 16415 | } | 16531 | } |
| 16416 | } | 16532 | } |
| 16417 | else if (CHAR_GLYPH_PADDING_P (*glyph) | 16533 | else if (CHAR_GLYPH_PADDING_P (*glyph) |
| @@ -16439,6 +16555,26 @@ display_line (it) | |||
| 16439 | it->max_phys_ascent = phys_ascent; | 16555 | it->max_phys_ascent = phys_ascent; |
| 16440 | it->max_phys_descent = phys_descent; | 16556 | it->max_phys_descent = phys_descent; |
| 16441 | } | 16557 | } |
| 16558 | else if (wrap_row_used > 0) | ||
| 16559 | { | ||
| 16560 | back_to_wrap: | ||
| 16561 | *it = wrap_it; | ||
| 16562 | it->continuation_lines_width += wrap_x; | ||
| 16563 | row->used[TEXT_AREA] = wrap_row_used; | ||
| 16564 | row->ascent = wrap_row_ascent; | ||
| 16565 | row->height = wrap_row_height; | ||
| 16566 | row->phys_ascent = wrap_row_phys_ascent; | ||
| 16567 | row->phys_height = wrap_row_phys_height; | ||
| 16568 | row->extra_line_spacing = wrap_row_extra_line_spacing; | ||
| 16569 | row->continued_p = 1; | ||
| 16570 | row->ends_at_zv_p = 0; | ||
| 16571 | row->exact_window_width_line_p = 0; | ||
| 16572 | it->continuation_lines_width += x; | ||
| 16573 | |||
| 16574 | /* Make sure that a non-default face is extended | ||
| 16575 | up to the right margin of the window. */ | ||
| 16576 | extend_face_to_end_of_line (it); | ||
| 16577 | } | ||
| 16442 | else if (it->c == '\t' && FRAME_WINDOW_P (it->f)) | 16578 | else if (it->c == '\t' && FRAME_WINDOW_P (it->f)) |
| 16443 | { | 16579 | { |
| 16444 | /* A TAB that extends past the right edge of the | 16580 | /* A TAB that extends past the right edge of the |
| @@ -16554,7 +16690,7 @@ display_line (it) | |||
| 16554 | 16690 | ||
| 16555 | /* If we truncate lines, we are done when the last displayed | 16691 | /* If we truncate lines, we are done when the last displayed |
| 16556 | glyphs reach past the right margin of the window. */ | 16692 | glyphs reach past the right margin of the window. */ |
| 16557 | if (it->truncate_lines_p | 16693 | if (it->line_wrap == TRUNCATE |
| 16558 | && (FRAME_WINDOW_P (it->f) | 16694 | && (FRAME_WINDOW_P (it->f) |
| 16559 | ? (it->current_x >= it->last_visible_x) | 16695 | ? (it->current_x >= it->last_visible_x) |
| 16560 | : (it->current_x > it->last_visible_x))) | 16696 | : (it->current_x > it->last_visible_x))) |
| @@ -18579,7 +18715,7 @@ display_string (string, lisp_string, face_string, face_string_pos, | |||
| 18579 | { | 18715 | { |
| 18580 | struct glyph *glyph = row->glyphs[TEXT_AREA] + n_glyphs_before + i; | 18716 | struct glyph *glyph = row->glyphs[TEXT_AREA] + n_glyphs_before + i; |
| 18581 | 18717 | ||
| 18582 | if (!it->truncate_lines_p | 18718 | if (it->line_wrap != TRUNCATE |
| 18583 | && x + glyph->pixel_width > max_x) | 18719 | && x + glyph->pixel_width > max_x) |
| 18584 | { | 18720 | { |
| 18585 | /* End of continued line or max_x reached. */ | 18721 | /* End of continued line or max_x reached. */ |
| @@ -18635,7 +18771,7 @@ display_string (string, lisp_string, face_string, face_string_pos, | |||
| 18635 | set_iterator_to_next (it, 1); | 18771 | set_iterator_to_next (it, 1); |
| 18636 | 18772 | ||
| 18637 | /* Stop if truncating at the right edge. */ | 18773 | /* Stop if truncating at the right edge. */ |
| 18638 | if (it->truncate_lines_p | 18774 | if (it->line_wrap == TRUNCATE |
| 18639 | && it->current_x >= it->last_visible_x) | 18775 | && it->current_x >= it->last_visible_x) |
| 18640 | { | 18776 | { |
| 18641 | /* Add truncation mark, but don't do it if the line is | 18777 | /* Add truncation mark, but don't do it if the line is |
| @@ -20583,7 +20719,7 @@ produce_stretch_glyph (it) | |||
| 20583 | else | 20719 | else |
| 20584 | ascent = (height * FONT_BASE (font)) / FONT_HEIGHT (font); | 20720 | ascent = (height * FONT_BASE (font)) / FONT_HEIGHT (font); |
| 20585 | 20721 | ||
| 20586 | if (width > 0 && !it->truncate_lines_p | 20722 | if (width > 0 && it->line_wrap != TRUNCATE |
| 20587 | && it->current_x + width > it->last_visible_x) | 20723 | && it->current_x + width > it->last_visible_x) |
| 20588 | width = it->last_visible_x - it->current_x - 1; | 20724 | width = it->last_visible_x - it->current_x - 1; |
| 20589 | 20725 | ||
| @@ -24538,11 +24674,18 @@ Value is a number or a cons (WIDTH-DPI . HEIGHT-DPI). */); | |||
| 24538 | DEFVAR_INT ("debug-end-pos", &debug_end_pos, doc: /* Don't ask. */); | 24674 | DEFVAR_INT ("debug-end-pos", &debug_end_pos, doc: /* Don't ask. */); |
| 24539 | #endif | 24675 | #endif |
| 24540 | 24676 | ||
| 24541 | DEFVAR_BOOL ("truncate-partial-width-windows", | 24677 | DEFVAR_LISP ("truncate-partial-width-windows", |
| 24542 | &truncate_partial_width_windows, | 24678 | &Vtruncate_partial_width_windows, |
| 24543 | doc: /* *Non-nil means truncate lines in all windows less than full frame wide. | 24679 | doc: /* Non-nil means truncate lines in windows with less than the frame width. |
| 24680 | For an integer value, truncate lines in each window with less than the | ||
| 24681 | full frame width, provided the window width is less than that integer; | ||
| 24682 | otherwise, respect the value of `truncate-lines'. | ||
| 24683 | |||
| 24684 | For any other non-nil value, truncate lines in all windows with | ||
| 24685 | less than the full frame width. | ||
| 24686 | |||
| 24544 | Nil means to respect the value of `truncate-lines'. */); | 24687 | Nil means to respect the value of `truncate-lines'. */); |
| 24545 | truncate_partial_width_windows = 1; | 24688 | Vtruncate_partial_width_windows = make_number (30); |
| 24546 | 24689 | ||
| 24547 | DEFVAR_BOOL ("mode-line-inverse-video", &mode_line_inverse_video, | 24690 | DEFVAR_BOOL ("mode-line-inverse-video", &mode_line_inverse_video, |
| 24548 | doc: /* When nil, display the mode-line/header-line/menu-bar in the default face. | 24691 | doc: /* When nil, display the mode-line/header-line/menu-bar in the default face. |