[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r106848: Fix the last part of bug #10
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r106848: Fix the last part of bug #10464 with mouse highlight at end of line. |
Date: |
Wed, 11 Jan 2012 21:45:42 +0200 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 106848
fixes bug(s): http://debbugs.gnu.org/10464
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Wed 2012-01-11 21:45:42 +0200
message:
Fix the last part of bug #10464 with mouse highlight at end of line.
src/xdisp.c (rows_from_pos_range): Handle the case where the
highlight ends on a newline.
(mouse_face_from_buffer_pos): Fix off-by-one error in calculating
he end column for display of highlight that ends on a newline
before a R2L line.
modified:
src/ChangeLog
src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-01-11 00:56:25 +0000
+++ b/src/ChangeLog 2012-01-11 19:45:42 +0000
@@ -1,3 +1,11 @@
+2012-01-11 Eli Zaretskii <address@hidden>
+
+ * xdisp.c (rows_from_pos_range): Handle the case where the
+ highlight ends on a newline. (Bug#10464)
+ (mouse_face_from_buffer_pos): Fix off-by-one error in calculating
+ he end column for display of highlight that ends on a newline
+ before a R2L line.
+
2012-01-11 Glenn Morris <address@hidden>
* lread.c (init_lread): If no-site-lisp, remove site-lisp dirs
=== modified file 'src/xdisp.c'
--- a/src/xdisp.c 2012-01-09 20:45:49 +0000
+++ b/src/xdisp.c 2012-01-11 19:45:42 +0000
@@ -25899,14 +25899,15 @@
for ( ; row->enabled_p && MATRIX_ROW_BOTTOM_Y (row) <= last_y; row++)
{
struct glyph_row *next = row + 1;
+ EMACS_INT next_start = MATRIX_ROW_START_CHARPOS (next);
if (!next->enabled_p
|| next >= MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w)
/* The first row >= START whose range of displayed characters
does NOT intersect the range [START_CHARPOS..END_CHARPOS]
is the row END + 1. */
- || (start_charpos < MATRIX_ROW_START_CHARPOS (next)
- && end_charpos < MATRIX_ROW_START_CHARPOS (next))
+ || (start_charpos < next_start
+ && end_charpos < next_start)
|| ((start_charpos > MATRIX_ROW_END_CHARPOS (next)
|| (start_charpos == MATRIX_ROW_END_CHARPOS (next)
&& !next->ends_at_zv_p
@@ -25925,12 +25926,26 @@
but none of the characters it displays are in the range, it is
also END + 1. */
struct glyph *g = next->glyphs[TEXT_AREA];
+ struct glyph *s = g;
struct glyph *e = g + next->used[TEXT_AREA];
while (g < e)
{
if (((BUFFERP (g->object) || INTEGERP (g->object))
- && start_charpos <= g->charpos && g->charpos < end_charpos)
+ && (start_charpos <= g->charpos && g->charpos < end_charpos
+ /* If the buffer position of the first glyph in
+ the row is equal to END_CHARPOS, it means
+ the last character to be highlighted is the
+ newline of ROW, and we must consider NEXT as
+ END, not END+1. */
+ || ((!next->reversed_p && g == s
+ || next->reversed_p && g == e - 1)
+ && (g->charpos == end_charpos
+ /* Special case for when NEXT is an
+ empty line at ZV. */
+ || (g->charpos == -1
+ && !row->ends_at_zv_p
+ && next_start == end_charpos)))))
/* A glyph that comes from DISP_STRING is by
definition to be highlighted. */
|| EQ (g->object, disp_string))
@@ -25942,6 +25957,13 @@
*end = row;
break;
}
+ /* The first row that ends at ZV must be the last to be
+ highlighted. */
+ else if (next->ends_at_zv_p)
+ {
+ *end = next;
+ break;
+ }
}
}
}
@@ -26255,6 +26277,19 @@
}
x += end->pixel_width;
}
+ /* If we exited the above loop because we arrived at the last
+ glyph of the row, and its buffer position is still not in
+ range, it means the last character in range is the preceding
+ newline. Bump the end column and x values to get past the
+ last glyph. */
+ if (end == glyph
+ && BUFFERP (end->object)
+ && (end->charpos < start_charpos
+ || end->charpos >= end_charpos))
+ {
+ x += end->pixel_width;
+ ++end;
+ }
hlinfo->mouse_face_end_x = x;
hlinfo->mouse_face_end_col = end - r2->glyphs[TEXT_AREA];
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r106848: Fix the last part of bug #10464 with mouse highlight at end of line.,
Eli Zaretskii <=