aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJimmy Aguilar Mena2019-10-12 19:15:32 +0200
committerJimmy Aguilar Mena2019-10-14 14:18:40 +0200
commit42bbfd29e75686cb33207c753383d9664785f5c8 (patch)
tree42218bfe11ebc150fffd2051164d07e31853aa21 /src
parente02fe26c7fcccb4059a7c7baba20bd9cb3b9a313 (diff)
downloademacs-42bbfd29e75686cb33207c753383d9664785f5c8.tar.gz
emacs-42bbfd29e75686cb33207c753383d9664785f5c8.zip
Update dfci code with new extend_face code.
* src/xdisp.c (extend_face_to_end_of_line): Updated the column-indicator code to use the new version of the function fill_column_indicator_column.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c180
1 files changed, 88 insertions, 92 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 07ff4c7da7d..1eec08d951d 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -21626,9 +21626,7 @@ extend_face_to_end_of_line (struct it *it)
21626 that the character will always be single byte in unibyte 21626 that the character will always be single byte in unibyte
21627 text. */ 21627 text. */
21628 if (!ASCII_CHAR_P (it->c)) 21628 if (!ASCII_CHAR_P (it->c))
21629 {
21630 it->face_id = FACE_FOR_CHAR (f, face, 0, -1, Qnil); 21629 it->face_id = FACE_FOR_CHAR (f, face, 0, -1, Qnil);
21631 }
21632 21630
21633 /* The default face, possibly remapped. */ 21631 /* The default face, possibly remapped. */
21634 struct face *default_face = 21632 struct face *default_face =
@@ -21679,79 +21677,86 @@ extend_face_to_end_of_line (struct it *it)
21679 /* Display fill column indicator if not in modeline or 21677 /* Display fill column indicator if not in modeline or
21680 toolbar and display fill column indicator mode is 21678 toolbar and display fill column indicator mode is
21681 active. */ 21679 active. */
21682 int indicator_column = (it->w->pseudo_window_p == 0 21680 const int indicator_column = (it->w->pseudo_window_p == 0
21683 ? fill_column_indicator_column (it) 21681 ? fill_column_indicator_column (it)
21684 : -1); 21682 : -1);
21685 if (indicator_column >= 0) 21683
21684 struct font *font = (default_face->font
21685 ? default_face->font
21686 : FRAME_FONT (f));
21687
21688 const int char_width = (font->average_width
21689 ? font->average_width
21690 : font->space_width);
21691 int column_x;
21692
21693 const char saved_char = it->char_to_display;
21694 const struct text_pos saved_pos = it->position;
21695 const bool saved_avoid_cursor = it->avoid_cursor_p;
21696 const bool saved_box_start = it->start_of_box_run_p;
21697 Lisp_Object save_object = it->object;
21698 const int saved_face_id = it->face_id;
21699
21700 it->face_id = it->extend_face_id;
21701
21702 if (indicator_column >= 0
21703 && !INT_MULTIPLY_WRAPV (indicator_column, char_width, &column_x)
21704 && !INT_ADD_WRAPV (it->lnum_pixel_width, column_x, &column_x)
21705 && column_x >= it->current_x
21706 && column_x <= it->last_visible_x)
21686 { 21707 {
21687 struct font *font = (default_face->font
21688 ? default_face->font
21689 : FRAME_FONT (f));
21690 const int char_width = (font->average_width
21691 ? font->average_width
21692 : font->space_width);
21693 int column_x;
21694
21695 if (!INT_MULTIPLY_WRAPV (indicator_column, char_width, &column_x)
21696 && !INT_ADD_WRAPV (it->lnum_pixel_width, column_x, &column_x)
21697 && column_x >= it->current_x
21698 && column_x <= it->last_visible_x)
21699 {
21700 const char saved_char = it->char_to_display;
21701 const struct text_pos saved_pos = it->position;
21702 const bool saved_avoid_cursor = it->avoid_cursor_p;
21703 const int saved_face_id = it->face_id;
21704 const bool saved_box_start = it->start_of_box_run_p;
21705 Lisp_Object save_object = it->object;
21706
21707 /* The stretch width needs to considet the latter
21708 added glyph. */
21709 const int stretch_width
21710 = column_x - it->current_x - char_width;
21711
21712 memset (&it->position, 0, sizeof it->position);
21713 it->avoid_cursor_p = true;
21714 it->object = Qnil;
21715
21716 /* Only generate a stretch glyph if there is distance
21717 between current_x and and the indicator position. */
21718 if (stretch_width > 0)
21719 {
21720 int stretch_ascent = (((it->ascent + it->descent)
21721 * FONT_BASE (font)) / FONT_HEIGHT (font));
21722 append_stretch_glyph (it, Qnil, stretch_width,
21723 it->ascent + it->descent,
21724 stretch_ascent);
21725 }
21726 21708
21727 /* Generate the glyph indicator only if 21709 /* The stretch width needs to considet the latter
21728 append_space_for_newline didn't already. */ 21710 added glyph. */
21729 if (it->current_x < column_x) 21711 const int stretch_width
21730 { 21712 = column_x - it->current_x - char_width;
21731 it->char_to_display 21713
21732 = XFIXNAT (Vdisplay_fill_column_indicator_character); 21714 memset (&it->position, 0, sizeof it->position);
21733 it->face_id 21715 it->avoid_cursor_p = true;
21734 = merge_faces (it->w, Qfill_column_indicator, 21716 it->object = Qnil;
21735 0, saved_face_id); 21717
21736 PRODUCE_GLYPHS (it); 21718 /* Only generate a stretch glyph if there is distance
21737 } 21719 between current_x and and the indicator position. */
21738 21720 if (stretch_width > 0)
21739 /* Restore the face after the indicator was generated. */ 21721 {
21740 it->face_id = saved_face_id; 21722 int stretch_ascent = (((it->ascent + it->descent)
21741 21723 * FONT_BASE (font)) / FONT_HEIGHT (font));
21742 /* If there is space after the indicator generate an 21724 append_stretch_glyph (it, Qnil, stretch_width,
21743 extra empty glyph to restore the face. Issue was 21725 it->ascent + it->descent,
21744 observed in X systems. */ 21726 stretch_ascent);
21745 it->char_to_display = ' '; 21727 }
21746 PRODUCE_GLYPHS (it); 21728
21747 21729 /* Generate the glyph indicator only if
21748 it->char_to_display = saved_char; 21730 append_space_for_newline didn't already. */
21749 it->position = saved_pos; 21731 if (it->current_x < column_x)
21750 it->avoid_cursor_p = saved_avoid_cursor; 21732 {
21751 it->start_of_box_run_p = saved_box_start; 21733 const int save_face_id = it->face_id;
21752 it->object = save_object; 21734 it->char_to_display
21753 } 21735 = XFIXNAT (Vdisplay_fill_column_indicator_character);
21736 it->face_id
21737 = merge_faces (it->w, Qfill_column_indicator,
21738 0, it->extend_face_id);
21739 PRODUCE_GLYPHS (it);
21740 it->face_id = save_face_id;
21741
21742 }
21754 } 21743 }
21744
21745 /* Restore the face after the indicator was generated. */
21746
21747 /* If there is space after the indicator generate an
21748 extra empty glyph to restore the face. Issue was
21749 observed in X systems. */
21750 it->char_to_display = ' ';
21751 PRODUCE_GLYPHS (it);
21752
21753 it->char_to_display = saved_char;
21754 it->position = saved_pos;
21755 it->avoid_cursor_p = saved_avoid_cursor;
21756 it->start_of_box_run_p = saved_box_start;
21757 it->object = save_object;
21758 it->face_id = saved_face_id;
21759
21755 } 21760 }
21756 if (it->glyph_row->reversed_p) 21761 if (it->glyph_row->reversed_p)
21757 { 21762 {
@@ -21797,10 +21802,9 @@ extend_face_to_end_of_line (struct it *it)
21797 /* The last row's stretch glyph should get the default 21802 /* The last row's stretch glyph should get the default
21798 face, to avoid painting the rest of the window with 21803 face, to avoid painting the rest of the window with
21799 the region face, if the region ends at ZV. */ 21804 the region face, if the region ends at ZV. */
21800 if (it->glyph_row->ends_at_zv_p) 21805 it->face_id = (it->glyph_row->ends_at_zv_p ?
21801 it->face_id = default_face->id; 21806 default_face->id : face->id);
21802 else 21807
21803 it->face_id = face->id;
21804 it->start_of_box_run_p = false; 21808 it->start_of_box_run_p = false;
21805 append_stretch_glyph (it, Qnil, stretch_width, 21809 append_stretch_glyph (it, Qnil, stretch_width,
21806 it->ascent + it->descent, stretch_ascent); 21810 it->ascent + it->descent, stretch_ascent);
@@ -21822,14 +21826,11 @@ extend_face_to_end_of_line (struct it *it)
21822 { 21826 {
21823 /* Save some values that must not be changed. */ 21827 /* Save some values that must not be changed. */
21824 int saved_x = it->current_x; 21828 int saved_x = it->current_x;
21825 struct text_pos saved_pos; 21829 struct text_pos saved_pos = it->position;
21826 Lisp_Object saved_object; 21830 Lisp_Object saved_object = it->object;;
21827 enum display_element_type saved_what = it->what; 21831 enum display_element_type saved_what = it->what;
21828 int saved_face_id = it->face_id; 21832 int saved_face_id = it->face_id;
21829 21833
21830 saved_object = it->object;
21831 saved_pos = it->position;
21832
21833 it->what = IT_CHARACTER; 21834 it->what = IT_CHARACTER;
21834 memset (&it->position, 0, sizeof it->position); 21835 memset (&it->position, 0, sizeof it->position);
21835 it->object = Qnil; 21836 it->object = Qnil;
@@ -21868,10 +21869,8 @@ extend_face_to_end_of_line (struct it *it)
21868 /* The last row's blank glyphs should get the default face, to 21869 /* The last row's blank glyphs should get the default face, to
21869 avoid painting the rest of the window with the region face, 21870 avoid painting the rest of the window with the region face,
21870 if the region ends at ZV. */ 21871 if the region ends at ZV. */
21871 if (it->glyph_row->ends_at_zv_p) 21872 it->face_id = (it->glyph_row->ends_at_zv_p ?
21872 it->face_id = default_face->id; 21873 default_face->id : face->id);
21873 else
21874 it->face_id = face->id;
21875 21874
21876 /* Display fill-column indicator if needed. */ 21875 /* Display fill-column indicator if needed. */
21877 int indicator_column = fill_column_indicator_column (it); 21876 int indicator_column = fill_column_indicator_column (it);
@@ -21881,24 +21880,21 @@ extend_face_to_end_of_line (struct it *it)
21881 indicator_column = -1; 21880 indicator_column = -1;
21882 do 21881 do
21883 { 21882 {
21884 int saved_face_id; 21883 if (it->current_x == indicator_column)
21885 bool indicate = it->current_x == indicator_column;
21886 if (indicate)
21887 { 21884 {
21888 saved_face_id = it->face_id; 21885 int saved_face_id = it->face_id;
21889 it->face_id 21886 it->face_id
21890 = merge_faces (it->w, Qfill_column_indicator, 0, saved_face_id); 21887 = merge_faces (it->w, Qfill_column_indicator, 0, it->extend_face_id);
21891 it->c = it->char_to_display 21888 it->c = it->char_to_display
21892 = XFIXNAT (Vdisplay_fill_column_indicator_character); 21889 = XFIXNAT (Vdisplay_fill_column_indicator_character);
21893 }
21894 21890
21895 PRODUCE_GLYPHS (it); 21891 PRODUCE_GLYPHS (it);
21896 21892
21897 if (indicate)
21898 {
21899 it->face_id = saved_face_id; 21893 it->face_id = saved_face_id;
21900 it->c = it->char_to_display = ' '; 21894 it->c = it->char_to_display = ' ';
21901 } 21895 }
21896 else
21897 PRODUCE_GLYPHS (it);
21902 } 21898 }
21903 while (it->current_x <= it->last_visible_x); 21899 while (it->current_x <= it->last_visible_x);
21904 21900