[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFA] Console based mouse face highlighting.
From: |
Nick Roberts |
Subject: |
Re: [RFA] Console based mouse face highlighting. |
Date: |
Thu, 17 May 2007 09:46:00 +1200 |
> I don't think you need to poke the face of the glyphs in the glyph
> matrix to have them in mouse highlight face. Instead, you need to
> turn on the mouse highlight face before the call to fwrite that
> actually delivers the glyphs to the screen. To this end, either
> modify write_glyphs to teach it to use mouse_face_face_id when that is
> necessary (e.g., add an additional argument to write_glyphs), or write
> a new function that is identical to write_glyphs which will use the
> mouse face instead of the face encoded in the glyph matrix.
>
> I think this will be a more elegant solution, and it also avoids
> malloc'ing memory.
I can't easily add an extra argument to write_glyphs as it's called in many
places. However, I can use a (static) global variable and this is what I did
do earlier but it didn't work because had I assumed cursor_to (x, y) when it's
actually cursor_to (y, x) i.e vertical co-ordinate first.
Do you mean something like below? (I've tested it and it works too.) It's
certainly more lightweght, but I think global variables tend to spoil the flow.
--
Nick http://www.inet.net.nz/~nickrob
In term.c:
static int draw_mouse_face;
In term_show_mouse_face:
loop ...
cursor_to (pos_y, pos_x);
if (draw == DRAW_MOUSE_FACE)
{
draw_mouse_face = 1;
write_glyphs (row->glyphs[TEXT_AREA] + start_hpos, nglyphs);
draw_mouse_face = 0;
}
else /* draw == DRAW_NORMAL_TEXT */
write_glyphs (row->glyphs[TEXT_AREA] + start_hpos, nglyphs);
}
cursor_to (save_y, save_x);
In write_glyphs:
while (len > 0)
{
/* Identify a run of glyphs with the same face. */
int face_id = string->face_id;
int n;
if (draw_mouse_face)
{
face_id = mouse_face_face_id;
n = len;
}
else
for (n = 1; n < len; ++n)
if (string[n].face_id != face_id)
break;
- Re: [PATCH] Console based mouse face highlighting., (continued)
- Re: [PATCH] Console based mouse face highlighting., Eli Zaretskii, 2007/05/14
- Re: [PATCH] Console based mouse face highlighting., Nick Roberts, 2007/05/15
- Re: [PATCH] Console based mouse face highlighting., Eli Zaretskii, 2007/05/15
- Re: [PATCH] Console based mouse face highlighting., David Kastrup, 2007/05/15
- Re: [PATCH] Console based mouse face highlighting., Eli Zaretskii, 2007/05/15
- Re: [PATCH/Now RFA] Console based mouse face highlighting., Nick Roberts, 2007/05/15
- Re: [PATCH/Now RFA] Console based mouse face highlighting., Eli Zaretskii, 2007/05/15
- Re: [PATCH/Now RFA] Console based mouse face highlighting., Nick Roberts, 2007/05/16
- Re: [RFA] Console based mouse face highlighting., Nick Roberts, 2007/05/16
- Re: [RFA] Console based mouse face highlighting., Eli Zaretskii, 2007/05/16
- Re: [RFA] Console based mouse face highlighting.,
Nick Roberts <=
- Re: [RFA] Console based mouse face highlighting., Eli Zaretskii, 2007/05/16
- Re: [RFA] Console based mouse face highlighting., Nick Roberts, 2007/05/17
- Re: [RFA] Console based mouse face highlighting., Stefan Monnier, 2007/05/17
- Re: [RFA] Console based mouse face highlighting., Eli Zaretskii, 2007/05/17
- Re: [RFA] Console based mouse face highlighting., Nick Roberts, 2007/05/17
- Re: [RFA] Console based mouse face highlighting., Eli Zaretskii, 2007/05/17
- Re: [RFA] Console based mouse face highlighting., Nick Roberts, 2007/05/17
- Re: [RFA] Console based mouse face highlighting., Eli Zaretskii, 2007/05/18
- Re: [RFA] Console based mouse face highlighting., Nick Roberts, 2007/05/18
- Re: [RFA] Console based mouse face highlighting., Eli Zaretskii, 2007/05/19