aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMasatake YAMATO2005-05-24 16:56:41 +0000
committerMasatake YAMATO2005-05-24 16:56:41 +0000
commit55ce5058b109669016ea49c933a971eaf3ae973f (patch)
tree70eb4c2d254ca4daba7e36988e4e191b785f308e /src
parent8349069cda35c68cc6edbf543173a410517f59a0 (diff)
downloademacs-55ce5058b109669016ea49c933a971eaf3ae973f.tar.gz
emacs-55ce5058b109669016ea49c933a971eaf3ae973f.zip
2005-05-24 Masatake YAMATO <jet@gyve.org>
* xdisp.c (note_mode_line_or_margin_highlight): Use b and e as loop sentinels.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/xdisp.c71
2 files changed, 41 insertions, 35 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 8995607881f..4fc3ad1f8f7 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12005-05-24 Masatake YAMATO <jet@gyve.org>
2
3 * xdisp.c (note_mode_line_or_margin_highlight): Use b and e
4 as loop sentinels.
5
12005-05-24 Nick Roberts <nickrob@snap.net.nz> 62005-05-24 Nick Roberts <nickrob@snap.net.nz>
2 7
3 * xmenu.c (Fx_popup_dialog): Add a third boolean argument to 8 * xmenu.c (Fx_popup_dialog): Add a third boolean argument to
diff --git a/src/xdisp.c b/src/xdisp.c
index 8a9c1d267af..8d379536062 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -21253,8 +21253,8 @@ note_mode_line_or_margin_highlight (window, x, y, area)
21253 Lisp_Object mouse_face; 21253 Lisp_Object mouse_face;
21254 int original_x_pixel = x; 21254 int original_x_pixel = x;
21255 struct glyph * glyph = NULL; 21255 struct glyph * glyph = NULL;
21256 struct glyph_row *row; 21256 struct glyph_row *row;
21257 21257
21258 if (area == ON_MODE_LINE || area == ON_HEADER_LINE) 21258 if (area == ON_MODE_LINE || area == ON_HEADER_LINE)
21259 { 21259 {
21260 int x0; 21260 int x0;
@@ -21263,21 +21263,21 @@ note_mode_line_or_margin_highlight (window, x, y, area)
21263 string = mode_line_string (w, area, &x, &y, &charpos, 21263 string = mode_line_string (w, area, &x, &y, &charpos,
21264 &object, &dx, &dy, &width, &height); 21264 &object, &dx, &dy, &width, &height);
21265 21265
21266 row = (area == ON_MODE_LINE)? 21266 row = (area == ON_MODE_LINE)?
21267 MATRIX_MODE_LINE_ROW (w->current_matrix): 21267 MATRIX_MODE_LINE_ROW (w->current_matrix):
21268 MATRIX_HEADER_LINE_ROW(w->current_matrix); 21268 MATRIX_HEADER_LINE_ROW(w->current_matrix);
21269 21269
21270 /* Find glyph */ 21270 /* Find glyph */
21271 if (row->mode_line_p && row->enabled_p) 21271 if (row->mode_line_p && row->enabled_p)
21272 { 21272 {
21273 glyph = row->glyphs[TEXT_AREA]; 21273 glyph = row->glyphs[TEXT_AREA];
21274 end = glyph + row->used[TEXT_AREA]; 21274 end = glyph + row->used[TEXT_AREA];
21275 21275
21276 for (x0 = original_x_pixel; 21276 for (x0 = original_x_pixel;
21277 glyph < end && x0 >= glyph->pixel_width; 21277 glyph < end && x0 >= glyph->pixel_width;
21278 ++glyph) 21278 ++glyph)
21279 x0 -= glyph->pixel_width; 21279 x0 -= glyph->pixel_width;
21280 21280
21281 if (glyph >= end) 21281 if (glyph >= end)
21282 glyph = NULL; 21282 glyph = NULL;
21283 } 21283 }
@@ -21359,7 +21359,7 @@ note_mode_line_or_margin_highlight (window, x, y, area)
21359 if (!KEYMAPP (map)) 21359 if (!KEYMAPP (map))
21360 cursor = dpyinfo->vertical_scroll_bar_cursor; 21360 cursor = dpyinfo->vertical_scroll_bar_cursor;
21361 } 21361 }
21362 21362
21363 /* Change the mouse face according to what is under X/Y. */ 21363 /* Change the mouse face according to what is under X/Y. */
21364 mouse_face = Fget_text_property (pos, Qmouse_face, string); 21364 mouse_face = Fget_text_property (pos, Qmouse_face, string);
21365 if (!NILP (mouse_face) 21365 if (!NILP (mouse_face)
@@ -21375,19 +21375,29 @@ note_mode_line_or_margin_highlight (window, x, y, area)
21375 int total_pixel_width; 21375 int total_pixel_width;
21376 int ignore; 21376 int ignore;
21377 21377
21378
21378 if (clear_mouse_face (dpyinfo)) 21379 if (clear_mouse_face (dpyinfo))
21379 cursor = No_Cursor; 21380 cursor = No_Cursor;
21380 21381
21381 /* Calculate the position(glyph position: GPOS) of GLYPH in 21382 b = Fprevious_single_property_change(make_number (charpos + 1),
21382 displayed string. GPOS is different from CHARPOS. 21383 Qmouse_face, string, Qnil);
21383 21384 if (NILP (b))
21385 b = make_number (0);
21386
21387 e = Fnext_single_property_change (pos, Qmouse_face, string, Qnil);
21388 if (NILP (e))
21389 e = make_number (SCHARS (string));
21390
21391 /* Calculate the position(glyph position: GPOS) of GLYPH in
21392 displayed string. GPOS is different from CHARPOS.
21393
21384 CHARPOS is the position of glyph in internal string 21394 CHARPOS is the position of glyph in internal string
21385 object. A mode line string format has structures which 21395 object. A mode line string format has structures which
21386 is converted to a flatten by emacs lisp interpreter. 21396 is converted to a flatten by emacs lisp interpreter.
21387 The internal string is an element of the structures. 21397 The internal string is an element of the structures.
21388 The displayed string is the flatten string. */ 21398 The displayed string is the flatten string. */
21389 for (tmp_glyph = glyph - 1, gpos = 0; 21399 for (tmp_glyph = glyph - 1, gpos = 0;
21390 tmp_glyph >= row->glyphs[TEXT_AREA]; 21400 tmp_glyph->charpos >= XINT(b);
21391 tmp_glyph--, gpos++) 21401 tmp_glyph--, gpos++)
21392 { 21402 {
21393 if (tmp_glyph->object != glyph->object) 21403 if (tmp_glyph->object != glyph->object)
@@ -21395,41 +21405,31 @@ note_mode_line_or_margin_highlight (window, x, y, area)
21395 } 21405 }
21396 21406
21397 /* Calculate the lenght(glyph sequence length: GSEQ_LENGTH) of 21407 /* Calculate the lenght(glyph sequence length: GSEQ_LENGTH) of
21398 displayed string holding GLYPH. 21408 displayed string holding GLYPH.
21399 21409
21400 GSEQ_LENGTH is different from SCHARS (STRING). 21410 GSEQ_LENGTH is different from SCHARS (STRING).
21401 SCHARS (STRING) returns the length of the internal string. */ 21411 SCHARS (STRING) returns the length of the internal string. */
21402 for (tmp_glyph = glyph, gseq_length = gpos; 21412 for (tmp_glyph = glyph, gseq_length = gpos;
21403 tmp_glyph < glyph + row->used[TEXT_AREA]; 21413 tmp_glyph->charpos < XINT(e);
21404 tmp_glyph++, gseq_length++) 21414 tmp_glyph++, gseq_length++)
21405 { 21415 {
21406 if (tmp_glyph->object != glyph->object) 21416 if (tmp_glyph->object != glyph->object)
21407 break; 21417 break;
21408 } 21418 }
21409
21410 b = Fprevious_single_property_change(make_number (charpos + 1),
21411 Qmouse_face, string, Qnil);
21412 e = Fnext_single_property_change (pos, Qmouse_face, string, Qnil);
21413
21414 if (NILP (b))
21415 b = make_number (0);
21416
21417 if (NILP (e))
21418 e = make_number(gseq_length);
21419 21419
21420 total_pixel_width = 0; 21420 total_pixel_width = 0;
21421 for (tmp_glyph = glyph - (gpos - XINT(b)); tmp_glyph != glyph; tmp_glyph++) 21421 for (tmp_glyph = glyph - gpos; tmp_glyph != glyph; tmp_glyph++)
21422 total_pixel_width += tmp_glyph->pixel_width; 21422 total_pixel_width += tmp_glyph->pixel_width;
21423 21423
21424 dpyinfo->mouse_face_beg_col = (x - gpos) + XINT(b); 21424 dpyinfo->mouse_face_beg_col = (x - gpos);
21425 dpyinfo->mouse_face_beg_row = (area == ON_MODE_LINE)? 21425 dpyinfo->mouse_face_beg_row = (area == ON_MODE_LINE)?
21426 (w->current_matrix)->nrows - 1: 21426 (w->current_matrix)->nrows - 1:
21427 0; 21427 0;
21428 21428
21429 dpyinfo->mouse_face_beg_x = original_x_pixel - (total_pixel_width + dx); 21429 dpyinfo->mouse_face_beg_x = original_x_pixel - (total_pixel_width + dx);
21430 dpyinfo->mouse_face_beg_y = 0; 21430 dpyinfo->mouse_face_beg_y = 0;
21431 21431
21432 dpyinfo->mouse_face_end_col = (x - gpos) + XINT(e); 21432 dpyinfo->mouse_face_end_col = (x - gpos) + gseq_length;
21433 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_beg_row; 21433 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_beg_row;
21434 21434
21435 dpyinfo->mouse_face_end_x = 0; 21435 dpyinfo->mouse_face_end_x = 0;
@@ -21438,7 +21438,7 @@ note_mode_line_or_margin_highlight (window, x, y, area)
21438 dpyinfo->mouse_face_past_end = 0; 21438 dpyinfo->mouse_face_past_end = 0;
21439 dpyinfo->mouse_face_window = window; 21439 dpyinfo->mouse_face_window = window;
21440 21440
21441 dpyinfo->mouse_face_face_id = face_at_string_position(w, string, 21441 dpyinfo->mouse_face_face_id = face_at_string_position(w, string,
21442 charpos, 21442 charpos,
21443 0, 0, 0, &ignore, 21443 0, 0, 0, &ignore,
21444 glyph->face_id, 1); 21444 glyph->face_id, 1);
@@ -21784,6 +21784,7 @@ note_mouse_highlight (f, x, y)
21784 b = make_number (0); 21784 b = make_number (0);
21785 if (NILP (e)) 21785 if (NILP (e))
21786 e = make_number (SCHARS (object) - 1); 21786 e = make_number (SCHARS (object) - 1);
21787
21787 fast_find_string_pos (w, XINT (b), object, 21788 fast_find_string_pos (w, XINT (b), object,
21788 &dpyinfo->mouse_face_beg_col, 21789 &dpyinfo->mouse_face_beg_col,
21789 &dpyinfo->mouse_face_beg_row, 21790 &dpyinfo->mouse_face_beg_row,