From: Nick Roberts <nickrob@snap.net.nz>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: [RFA] Console based mouse face highlighting.
Date: Thu, 17 May 2007 09:46:00 +1200 [thread overview]
Message-ID: <17995.31640.399794.621018@kahikatea.snap.net.nz> (raw)
In-Reply-To: <u3b1weimq.fsf@gnu.org>
> 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;
next prev parent reply other threads:[~2007-05-16 21:46 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-12 10:02 [PATCH] Console based mouse face highlighting Nick Roberts
2007-05-12 10:11 ` Nick Roberts
2007-05-12 13:25 ` Eli Zaretskii
2007-05-12 23:54 ` Nick Roberts
2007-05-13 3:42 ` Eli Zaretskii
2007-05-13 4:19 ` Nick Roberts
2007-05-13 4:41 ` Eli Zaretskii
2007-05-14 21:11 ` Nick Roberts
2007-05-15 3:26 ` Eli Zaretskii
2007-05-15 3:53 ` Nick Roberts
2007-05-15 21:15 ` Eli Zaretskii
2007-05-15 21:33 ` David Kastrup
2007-05-16 3:16 ` Eli Zaretskii
2007-05-15 22:39 ` [PATCH/Now RFA] " Nick Roberts
2007-05-16 3:24 ` Eli Zaretskii
2007-05-16 3:54 ` Nick Roberts
2007-05-16 10:00 ` [RFA] " Nick Roberts
2007-05-16 18:19 ` Eli Zaretskii
2007-05-16 21:46 ` Nick Roberts [this message]
2007-05-17 3:24 ` Eli Zaretskii
2007-05-17 3:54 ` Nick Roberts
2007-05-17 14:59 ` Stefan Monnier
2007-05-17 20:29 ` Eli Zaretskii
2007-05-17 22:29 ` Nick Roberts
2007-05-17 20:14 ` Eli Zaretskii
2007-05-17 22:34 ` Nick Roberts
2007-05-18 14:33 ` Eli Zaretskii
2007-05-18 21:09 ` Nick Roberts
2007-05-19 7:25 ` Eli Zaretskii
2007-05-19 8:15 ` Nick Roberts
2007-05-19 8:46 ` Eli Zaretskii
2007-05-20 6:00 ` Nick Roberts
2007-05-20 9:37 ` Johan Bockgård
2007-05-20 9:51 ` Nick Roberts
2007-05-22 15:54 ` Johan Bockgård
2007-05-22 21:36 ` Nick Roberts
2007-05-30 5:41 ` Nick Roberts
2007-06-03 1:12 ` Nick Roberts
2007-06-03 21:27 ` Richard Stallman
2007-06-03 22:15 ` Drew Adams
2007-06-03 23:31 ` Nick Roberts
2007-06-04 3:24 ` Eli Zaretskii
2007-05-20 18:54 ` Eli Zaretskii
2007-05-20 20:12 ` Renaming NEWS [was: [RFA] Console based mouse face highlighting.] Glenn Morris
2007-05-20 20:42 ` Nick Roberts
2007-05-20 21:31 ` Renaming NEWS Miles Bader
2007-05-21 8:09 ` Glenn Morris
2007-05-21 8:42 ` David Kastrup
2007-05-22 6:46 ` Glenn Morris
2007-05-22 7:12 ` Miles Bader
2007-05-22 17:08 ` Glenn Morris
2007-05-22 8:30 ` Richard Stallman
2007-05-22 17:09 ` Glenn Morris
2007-05-21 10:33 ` Renaming NEWS [was: [RFA] Console based mouse face highlighting.] Richard Stallman
2007-05-19 22:31 ` [RFA] Console based mouse face highlighting Richard Stallman
2007-05-14 16:57 ` [PATCH] " Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=17995.31640.399794.621018@kahikatea.snap.net.nz \
--to=nickrob@snap.net.nz \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).