diff options
| author | Jimmy Aguilar Mena | 2019-04-05 12:37:59 +0200 |
|---|---|---|
| committer | Jimmy Aguilar Mena | 2019-05-05 16:27:37 +0200 |
| commit | 491e145f96aa0278d0a4cf0dc4c1e75550f67d25 (patch) | |
| tree | 1e5770017d8de139c950b545da90c0b1e00240f8 /src | |
| parent | 18ea7605c06791641a465cd209a3de760d560863 (diff) | |
| download | emacs-491e145f96aa0278d0a4cf0dc4c1e75550f67d25.tar.gz emacs-491e145f96aa0278d0a4cf0dc4c1e75550f67d25.zip | |
display-fill-column-indicator interface corrections
*lisp/display-fill-column-indicator.el: Fixed character selection for
the indicator based in the current faces. Extended condition to set
display-fill-column-indicator-character in graphical displays.
*src/xdisp.c: Fixed some long lines.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 62 |
1 files changed, 36 insertions, 26 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 25ef98b49cf..31bb83c4181 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -20183,19 +20183,23 @@ append_space_for_newline (struct it *it, bool default_face_p) | |||
| 20183 | XFIXNAT (Vdisplay_fill_column_indicator_column); | 20183 | XFIXNAT (Vdisplay_fill_column_indicator_column); |
| 20184 | 20184 | ||
| 20185 | struct font *font = | 20185 | struct font *font = |
| 20186 | default_face->font ? default_face->font : FRAME_FONT (it->f); | 20186 | default_face->font ? |
| 20187 | default_face->font : FRAME_FONT (it->f); | ||
| 20187 | const int char_width = | 20188 | const int char_width = |
| 20188 | font->average_width ? font->average_width : font->space_width; | 20189 | font->average_width ? |
| 20190 | font->average_width : font->space_width; | ||
| 20189 | 20191 | ||
| 20190 | const int column_x = | 20192 | const int column_x = |
| 20191 | char_width * fill_column_indicator_column + it->lnum_pixel_width; | 20193 | char_width * fill_column_indicator_column + |
| 20194 | it->lnum_pixel_width; | ||
| 20192 | 20195 | ||
| 20193 | if (it->current_x == column_x) | 20196 | if (it->current_x == column_x) |
| 20194 | { | 20197 | { |
| 20195 | it->c = it->char_to_display = | 20198 | it->c = it->char_to_display = |
| 20196 | XFIXNAT (Vdisplay_fill_column_indicator_character); | 20199 | XFIXNAT (Vdisplay_fill_column_indicator_character); |
| 20197 | it->face_id = | 20200 | it->face_id = |
| 20198 | merge_faces (it->w, Qfill_column_face, 0, DEFAULT_FACE_ID); | 20201 | merge_faces (it->w, Qfill_column_face, |
| 20202 | 0, DEFAULT_FACE_ID); | ||
| 20199 | face = FACE_FROM_ID(it->f, it->face_id); | 20203 | face = FACE_FROM_ID(it->f, it->face_id); |
| 20200 | goto produce_glyphs; | 20204 | goto produce_glyphs; |
| 20201 | } | 20205 | } |
| @@ -20444,10 +20448,12 @@ extend_face_to_end_of_line (struct it *it) | |||
| 20444 | struct font *font = | 20448 | struct font *font = |
| 20445 | default_face->font ? default_face->font : FRAME_FONT (f); | 20449 | default_face->font ? default_face->font : FRAME_FONT (f); |
| 20446 | const int char_width = | 20450 | const int char_width = |
| 20447 | font->average_width ? font->average_width : font->space_width; | 20451 | font->average_width ? |
| 20452 | font->average_width : font->space_width; | ||
| 20448 | 20453 | ||
| 20449 | const int column_x = char_width * fill_column_indicator_column + | 20454 | const int column_x = |
| 20450 | it->lnum_pixel_width; | 20455 | char_width * fill_column_indicator_column + |
| 20456 | it->lnum_pixel_width; | ||
| 20451 | 20457 | ||
| 20452 | if ((it->current_x <= column_x) | 20458 | if ((it->current_x <= column_x) |
| 20453 | && (column_x <= it->last_visible_x)) | 20459 | && (column_x <= it->last_visible_x)) |
| @@ -20459,39 +20465,43 @@ extend_face_to_end_of_line (struct it *it) | |||
| 20459 | const bool saved_box_start = it->start_of_box_run_p; | 20465 | const bool saved_box_start = it->start_of_box_run_p; |
| 20460 | Lisp_Object save_object = it->object; | 20466 | Lisp_Object save_object = it->object; |
| 20461 | 20467 | ||
| 20462 | /* The stretch width needs to considet the latter added glyph */ | 20468 | /* The stretch width needs to considet the latter |
| 20463 | const int stretch_width = column_x - it->current_x - char_width; | 20469 | added glyph */ |
| 20470 | const int stretch_width = | ||
| 20471 | column_x - it->current_x - char_width; | ||
| 20464 | 20472 | ||
| 20465 | memset (&it->position, 0, sizeof it->position); | 20473 | memset (&it->position, 0, sizeof it->position); |
| 20466 | it->avoid_cursor_p = true; | 20474 | it->avoid_cursor_p = true; |
| 20467 | it->object = Qnil; | 20475 | it->object = Qnil; |
| 20468 | 20476 | ||
| 20469 | /* Only generate a stretch glysph if there is distance between | 20477 | /* Only generate a stretch glysph if there is distance |
| 20470 | current_x and and the indicator position */ | 20478 | between current_x and and the indicator position */ |
| 20471 | if (stretch_width > 0) | 20479 | if (stretch_width > 0) |
| 20472 | { | 20480 | { |
| 20473 | int stretch_ascent = (((it->ascent + it->descent) | 20481 | int stretch_ascent = (((it->ascent + it->descent) |
| 20474 | * FONT_BASE (font)) / FONT_HEIGHT (font)); | 20482 | * FONT_BASE (font)) / FONT_HEIGHT (font)); |
| 20475 | append_stretch_glyph (it, Qnil, stretch_width, | 20483 | append_stretch_glyph (it, Qnil, stretch_width, |
| 20476 | it->ascent + it->descent, stretch_ascent); | 20484 | it->ascent + it->descent, |
| 20477 | } | 20485 | stretch_ascent); |
| 20478 | 20486 | } | |
| 20479 | /* Generate the glysph indicator only if append_space_for_newline | 20487 | |
| 20480 | didn't already. */ | 20488 | /* Generate the glysph indicator only if |
| 20489 | append_space_for_newline didn't already. */ | ||
| 20481 | if (it->current_x < column_x) | 20490 | if (it->current_x < column_x) |
| 20482 | { | 20491 | { |
| 20483 | it->char_to_display = | 20492 | it->char_to_display = |
| 20484 | XFIXNAT (Vdisplay_fill_column_indicator_character); | 20493 | XFIXNAT (Vdisplay_fill_column_indicator_character); |
| 20485 | it->face_id = | 20494 | it->face_id = |
| 20486 | merge_faces (it->w, Qfill_column_face, 0, DEFAULT_FACE_ID); | 20495 | merge_faces (it->w, Qfill_column_face, |
| 20496 | 0, DEFAULT_FACE_ID); | ||
| 20487 | PRODUCE_GLYPHS (it); | 20497 | PRODUCE_GLYPHS (it); |
| 20488 | } | 20498 | } |
| 20489 | 20499 | ||
| 20490 | /* Restore the face after the indicator was generated */ | 20500 | /* Restore the face after the indicator was generated */ |
| 20491 | it->face_id = saved_face_id; | 20501 | it->face_id = saved_face_id; |
| 20492 | 20502 | ||
| 20493 | /* If there is space after the indicator generate an extra | 20503 | /* If there is space after the indicator generate an |
| 20494 | empty glysph to restore the face. */ | 20504 | extra empty glysph to restore the face. */ |
| 20495 | it->char_to_display = ' '; | 20505 | it->char_to_display = ' '; |
| 20496 | PRODUCE_GLYPHS (it); | 20506 | PRODUCE_GLYPHS (it); |
| 20497 | 20507 | ||
| @@ -20630,8 +20640,8 @@ extend_face_to_end_of_line (struct it *it) | |||
| 20630 | { | 20640 | { |
| 20631 | int fill_column_indicator_column = -1; | 20641 | int fill_column_indicator_column = -1; |
| 20632 | 20642 | ||
| 20633 | /* Vdisplay_fill_column_indicator_column accepts the special value t | 20643 | /* Vdisplay_fill_column_indicator_column accepts the special |
| 20634 | to use the default fill-column variable. */ | 20644 | value t to use the default fill-column variable. */ |
| 20635 | if (EQ (Vdisplay_fill_column_indicator_column, Qt) | 20645 | if (EQ (Vdisplay_fill_column_indicator_column, Qt) |
| 20636 | && FIXNATP (BVAR (current_buffer, fill_column))) | 20646 | && FIXNATP (BVAR (current_buffer, fill_column))) |
| 20637 | fill_column_indicator_column = | 20647 | fill_column_indicator_column = |