[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/extend_face_id 21fdd67 07/14: Fix last change in a
From: |
Jimmy Aguilar Mena |
Subject: |
[Emacs-diffs] scratch/extend_face_id 21fdd67 07/14: Fix last change in append_space_for_newline. |
Date: |
Sun, 29 Sep 2019 15:49:26 -0400 (EDT) |
branch: scratch/extend_face_id
commit 21fdd672984275a47ed9c6d08ada0115a92c4c32
Author: Jimmy Aguilar Mena <address@hidden>
Commit: Jimmy Aguilar Mena <address@hidden>
Fix last change in append_space_for_newline.
* src/xdisp.c (append_space_for_newline): Small code refactor and
simplification.
---
src/xdisp.c | 95 +++++++++++++++++++++++++++++++------------------------------
1 file changed, 48 insertions(+), 47 deletions(-)
diff --git a/src/xdisp.c b/src/xdisp.c
index 6cbd09e..f56a640 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -434,6 +434,7 @@ static int
fill_column_indicator_column (struct it *it, int char_width)
{
if (Vdisplay_fill_column_indicator
+ && it->w->pseudo_window_p == 0
&& it->continuation_lines_width == 0
&& CHARACTERP (Vdisplay_fill_column_indicator_character))
{
@@ -20288,7 +20289,7 @@ append_space_for_newline (struct it *it, bool
default_face_p)
int saved_c = it->c, saved_len = it->len;
int saved_char_to_display = it->char_to_display;
int saved_x = it->current_x;
- int saved_face_id = it->face_id;
+ const int saved_face_id = it->face_id;
bool saved_box_end = it->end_of_box_run_p;
struct text_pos saved_pos = it->position;
Lisp_Object saved_object = it->object;
@@ -20299,32 +20300,39 @@ append_space_for_newline (struct it *it, bool
default_face_p)
it->object = Qnil;
it->len = 1;
- int local_default_face_id =
- lookup_basic_face (it->w, it->f, DEFAULT_FACE_ID);
- struct face* default_face =
- FACE_FROM_ID (it->f, local_default_face_id);
-
- /* Corner case for when display-fill-column-indicator-mode
- is active and the extra character should be added in the
- same place than the line. */
-
int char_width = 1;
+ if (default_face_p
#ifdef HAVE_WINDOW_SYSTEM
- if (FRAME_WINDOW_P (it->f))
+ || FRAME_WINDOW_P (it->f)
+#endif
+ )
{
- struct font *font = (default_face->font
- ? default_face->font
- : FRAME_FONT (it->f));
- char_width = (font->average_width
- ? font->average_width
- : font->space_width);
- }
+ const int local_default_face_id =
+ lookup_basic_face (it->w, it->f, DEFAULT_FACE_ID);
+ struct face* default_face =
+ FACE_FROM_ID (it->f, local_default_face_id);
+
+#ifdef HAVE_WINDOW_SYSTEM
+ if (FRAME_WINDOW_P (it->f))
+ {
+ struct font *font = (default_face->font
+ ? default_face->font
+ : FRAME_FONT (it->f));
+ char_width = (font->average_width
+ ? font->average_width
+ : font->space_width);
+ }
#endif
+ if (default_face_p)
+ it->face_id = local_default_face_id;
+ }
+ /* Corner case for when display-fill-column-indicator-mode
+ is active and the extra character should be added in the
+ same place than the line. */
+
const int indicator_column =
- (it->w->pseudo_window_p == 0
- ? fill_column_indicator_column (it, char_width)
- : -1);
+ fill_column_indicator_column (it, char_width);
if (it->current_x == indicator_column)
{
@@ -20334,31 +20342,26 @@ append_space_for_newline (struct it *it, bool
default_face_p)
= merge_faces (it->w, Qfill_column_indicator,
0, saved_face_id);
face = FACE_FROM_ID (it->f, it->face_id);
- goto produce_glyphs;
}
+ else
+ {
+ it->c = it->char_to_display = ' ';
+ /* If the default face was remapped, be sure to use the
+ remapped face for the appended newline. */
- it->c = it->char_to_display = ' ';
- /* If the default face was remapped, be sure to use the
- remapped face for the appended newline. */
- it->face_id = default_face_p
- ? local_default_face_id
- : it->saved_face_id;
-
-
- face = FACE_FROM_ID (it->f, it->face_id);
- it->face_id = FACE_FOR_CHAR (it->f, face, 0, -1, Qnil);
- /* In R2L rows, we will prepend a stretch glyph that will
- have the end_of_box_run_p flag set for it, so there's no
- need for the appended newline glyph to have that flag
- set. */
- if (it->glyph_row->reversed_p
- /* But if the appended newline glyph goes all the way to
- the end of the row, there will be no stretch glyph,
- so leave the box flag set. */
- && saved_x + FRAME_COLUMN_WIDTH (it->f) < it->last_visible_x)
- it->end_of_box_run_p = false;
-
- produce_glyphs:
+ face = FACE_FROM_ID (it->f, it->face_id);
+ it->face_id = FACE_FOR_CHAR (it->f, face, 0, -1, Qnil);
+ /* In R2L rows, we will prepend a stretch glyph that will
+ have the end_of_box_run_p flag set for it, so there's no
+ need for the appended newline glyph to have that flag
+ set. */
+ if (it->glyph_row->reversed_p
+ /* But if the appended newline glyph goes all the way to
+ the end of the row, there will be no stretch glyph,
+ so leave the box flag set. */
+ && saved_x + FRAME_COLUMN_WIDTH (it->f) < it->last_visible_x)
+ it->end_of_box_run_p = false;
+ }
PRODUCE_GLYPHS (it);
#ifdef HAVE_WINDOW_SYSTEM
if (FRAME_WINDOW_P (it->f))
@@ -20579,9 +20582,7 @@ extend_face_to_end_of_line (struct it *it)
: font->space_width);
const int indicator_column =
- (it->w->pseudo_window_p == 0
- ? fill_column_indicator_column (it, char_width)
- : -1);
+ fill_column_indicator_column (it, char_width);
const char saved_char = it->char_to_display;
const struct text_pos saved_pos = it->position;
- [Emacs-diffs] branch scratch/extend_face_id created (now c7c7fae), Jimmy Aguilar Mena, 2019/09/29
- [Emacs-diffs] scratch/extend_face_id c1dbe02 04/14: Fixed extend face filtered for prop., Jimmy Aguilar Mena, 2019/09/29
- [Emacs-diffs] scratch/extend_face_id 523aeb6 01/14: Simplify struct face to use only underline., Jimmy Aguilar Mena, 2019/09/29
- [Emacs-diffs] scratch/extend_face_id 6a3808c 02/14: Added face parameter :extend., Jimmy Aguilar Mena, 2019/09/29
- [Emacs-diffs] scratch/extend_face_id 4859ca2 08/14: Make hl-line face to extend all the line.., Jimmy Aguilar Mena, 2019/09/29
- [Emacs-diffs] scratch/extend_face_id 46e8f70 10/14: Extend_face simplify., Jimmy Aguilar Mena, 2019/09/29
- [Emacs-diffs] scratch/extend_face_id 28655de 03/14: Conditional merged face to extend after eol., Jimmy Aguilar Mena, 2019/09/29
- [Emacs-diffs] scratch/extend_face_id 30fe702 06/14: Add space for cursor to work also in terminal., Jimmy Aguilar Mena, 2019/09/29
- [Emacs-diffs] scratch/extend_face_id 34b31fe 05/14: Changed handle_face_prop_general prototype., Jimmy Aguilar Mena, 2019/09/29
- [Emacs-diffs] scratch/extend_face_id 21fdd67 07/14: Fix last change in append_space_for_newline.,
Jimmy Aguilar Mena <=
- [Emacs-diffs] scratch/extend_face_id 76da65a 09/14: Added parameter attr_filter to face_at_string_position., Jimmy Aguilar Mena, 2019/09/29
- [Emacs-diffs] scratch/extend_face_id c7c7fae 14/14: * etc/NEWS : Added comment about :extend face attribute in NEWS., Jimmy Aguilar Mena, 2019/09/29
- [Emacs-diffs] scratch/extend_face_id be3b66e 13/14: Document new :extend face attribute in manuals., Jimmy Aguilar Mena, 2019/09/29
- [Emacs-diffs] scratch/extend_face_id 06d35c2 12/14: Fixed merge_face_ref recursive calls., Jimmy Aguilar Mena, 2019/09/29
- [Emacs-diffs] scratch/extend_face_id 1fe9bee 11/14: Optimization in extend_face, Jimmy Aguilar Mena, 2019/09/29