From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [RFA] Console based mouse face highlighting. Date: Wed, 16 May 2007 21:19:25 +0300 Message-ID: References: <17989.37070.393150.565546@kahikatea.snap.net.nz> <17990.21422.577087.305723@kahikatea.snap.net.nz> <17990.37305.657724.344516@kahikatea.snap.net.nz> <17992.53379.953892.751275@kahikatea.snap.net.nz> <17993.11948.400368.430713@kahikatea.snap.net.nz> <17994.14013.614407.875104@kahikatea.snap.net.nz> <17994.32856.216525.50726@kahikatea.snap.net.nz> <17994.54868.931947.611990@kahikatea.snap.net.nz> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: sea.gmane.org 1179339640 18887 80.91.229.12 (16 May 2007 18:20:40 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 16 May 2007 18:20:40 +0000 (UTC) Cc: emacs-devel@gnu.org To: Nick Roberts Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 16 20:20:39 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HoO73-0007Yz-FR for ged-emacs-devel@m.gmane.org; Wed, 16 May 2007 20:20:37 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HoOF3-0002O6-Qd for ged-emacs-devel@m.gmane.org; Wed, 16 May 2007 14:28:53 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HoOED-0001jg-Dy for emacs-devel@gnu.org; Wed, 16 May 2007 14:28:01 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HoOEB-0001j0-SK for emacs-devel@gnu.org; Wed, 16 May 2007 14:28:01 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HoOEB-0001it-Mk for emacs-devel@gnu.org; Wed, 16 May 2007 14:27:59 -0400 Original-Received: from romy.inter.net.il ([213.8.233.24]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HoO6A-00086A-Bv for emacs-devel@gnu.org; Wed, 16 May 2007 14:19:42 -0400 Original-Received: from HOME-C4E4A596F7 (IGLD-80-230-158-6.inter.net.il [80.230.158.6]) by romy.inter.net.il (MOS 3.7.3-GA) with ESMTP id HVY28585 (AUTH halo1); Wed, 16 May 2007 21:19:23 +0300 (IDT) In-reply-to: <17994.54868.931947.611990@kahikatea.snap.net.nz> (message from Nick Roberts on Wed, 16 May 2007 22:00:52 +1200) X-detected-kernel: FreeBSD 4.7-5.2 (or MacOS X 10.2-10.4) (2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:71190 Archived-At: > From: Nick Roberts > Date: Wed, 16 May 2007 22:00:52 +1200 > > term_show_mouse_face (draw) > loop ... > > if (draw == DRAW_MOUSE_FACE) > { > glyph = xmalloc (nglyphs * sizeof (struct glyph)); > memcpy (glyph, row->glyphs[TEXT_AREA] + start_hpos, > nglyphs * sizeof (struct glyph)); > for (j = 0; j < nglyphs; j = j++) > (glyph + j)->face_id = mouse_face_face_id; > } > else /* draw == DRAW_NORMAL_TEXT */ > glyph = row->glyphs[TEXT_AREA] + start_hpos; > > pos_y = row->y + WINDOW_TOP_EDGE_Y (w); > pos_x = row->used[LEFT_MARGIN_AREA] + start_hpos > + WINDOW_LEFT_EDGE_X (w); > > cursor_to (pos_y, pos_x); > write_glyphs (glyph, nglyphs); > if (draw == DRAW_MOUSE_FACE) > xfree (glyph); > cursor_to (save_y, save_x); > } 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.