>> It looks like we need only to keep the background colour also for the
>> indicator.
>
> Are you sure that's all? And that some users won't want the indicator
> face's background to prevail?
User customization could be accommodated by something like the below (naive) patch. We define fill-column-indicator face to have unspecified background; when displaying the indicator we merge the indicator face into the current it->face_id (the same face used for the stretch glyph preceding the indicator).
This has two advantages: (1) By default, we display the indicator using the existing background, but the user can still override by explicitly setting the background attribute of the indicator face. (2) This handles the general case of a non-default background, not just region highlighting. (See the attached screenshot for an example of the issue not involving region highlighting.)
diff --git a/src/xdisp.c b/src/xdisp.c
index 1782748144..07c5ee0a1c 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -20494,7 +20494,7 @@ extend_face_to_end_of_line (struct it *it)
XFIXNAT (Vdisplay_fill_column_indicator_character);
it->face_id =
merge_faces (it->w, Qfill_column_indicator,
- 0, DEFAULT_FACE_ID);
+ 0, saved_face_id);
PRODUCE_GLYPHS (it);
}
@@ -20658,7 +20658,7 @@ extend_face_to_end_of_line (struct it *it)
{
const int saved_face = it->face_id;
it->face_id =
- merge_faces (it->w, Qfill_column_indicator, 0, DEFAULT_FACE_ID);
+ merge_faces (it->w, Qfill_column_indicator, 0, saved_face);
it->c = it->char_to_display =
XFIXNAT (Vdisplay_fill_column_indicator_character);
PRODUCE_GLYPHS (it);
diff --git a/lisp/faces.el b/lisp/faces.el
index b933279064..207b627f25 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -2502,7 +2502,9 @@ line-number-current-line
;; Definition stolen from display-line-numbers.
(defface fill-column-indicator
- '((t :inherit (shadow default)))
+ '((t :inherit shadow :weight normal :slant normal
+ :underline nil :overline nil :strike-through nil
+ :box nil :invert-video nil :stipple nil))
"Face for displaying fill column indicator.
This face is used when `display-fill-column-indicator-mode' is
non-nil."