From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Hollow cursor under images Date: Mon, 27 Jan 2020 20:33:14 +0200 Message-ID: <83k15coil1.fsf@gnu.org> References: <83bm2qea01.fsf@gnu.org> <20190304223605.GA22198@breton.holly.idiocy.org> Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="24181"; mail-complaints-to="usenet@ciao.gmane.io" Cc: alan@idiocy.org, emacs-devel@gnu.org To: Evgeny Zajcev Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jan 27 19:34:02 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iw9Cz-0006F0-7C for ged-emacs-devel@m.gmane-mx.org; Mon, 27 Jan 2020 19:34:01 +0100 Original-Received: from localhost ([::1]:49436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iw9Cy-0003UD-A6 for ged-emacs-devel@m.gmane-mx.org; Mon, 27 Jan 2020 13:34:00 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36528) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iw9CO-00034i-6x for emacs-devel@gnu.org; Mon, 27 Jan 2020 13:33:25 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:38765) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iw9CN-0002wn-I7; Mon, 27 Jan 2020 13:33:23 -0500 Original-Received: from [176.228.60.248] (port=4570 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iw9CN-0000Dh-00; Mon, 27 Jan 2020 13:33:23 -0500 In-reply-to: (message from Evgeny Zajcev on Mon, 27 Jan 2020 15:54:56 +0300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:244676 Archived-At: > From: Evgeny Zajcev > Date: Mon, 27 Jan 2020 15:54:56 +0300 > Cc: Eli Zaretskii , emacs-devel > > This patch implements (box . WIDTH) cursor type, allowing user to define his own notion for "Large" image Thanks. This needs a NEWS entry and also an update for the ELisp manual. See also a few comments below. > From 6406d198e9f3f5b2d93987ed0fd4fe22bd590624 Mon Sep 17 00:00:00 2001 > From: Zajcev Evgeny > Date: Mon, 27 Jan 2020 15:49:46 +0300 > Subject: [PATCH] * Support for (box . WIDTH) `cursor-type' > > Before this commit, block cursor becomes hollow under "large" masked > images. Notion for "large" was hardcoded to be image larger then > 32x32 in any dimension. > > This patch allows user to define his own notion for "large" image, > taking full control of block cursor look under masked images. > > With cursor-type equal to `box' cursor will always be block under > masked images. This differs from former behavior for box cursor. > To get former behavior, set `cursor-type' to (box . 32) Please include in the log message a ChangeLog-style list of files and functions where you are making changes. > + (box . WIDTH) display a filled box cursor, but make it > + hollow if cursor is under masked image larger then > + WIDTH in either dimention. ^^^^^^^^^ "dimension" Also, please make it clear that WIDTH is measured in pixels. > +Except for (box . WIDTH) case. This is not a complete sentence, please clarify it. > + if (CONSP (arg) > + && EQ (XCAR (arg), Qbox) > + && RANGED_FIXNUMP (0, XCDR (arg), INT_MAX)) > + { > + *width = XFIXNUM (XCDR (arg)); This calls XFIXNUM no less than 3 times. I wonder if we could tweak the code to do that only once. > + return FILLED_BOX_CURSOR; > + } > + > if (EQ (arg, Qhollow)) > return HOLLOW_BOX_CURSOR; If the condition above is not fulfilled, you then make the code do 5 more gratuitous comparisons, before it falls back on HOLLOW_BOX_CURSOR. It is much better to return HOLLOW_BOX_CURSOR right away if the conditions for FILLED_BOX_CURSOR weren't satisfied, it makes the code which implements this feature much easier to read and understand.