From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Anders Lindgren Newsgroups: gmane.emacs.bugs Subject: bug#16856: [PATCH] Prevent cursor from over-drawing the fringe Date: Fri, 20 May 2016 21:33:52 +0200 Message-ID: References: <20160517211415.GA85076@breton.holly.idiocy.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a1135dc96b250c805334b2b86 X-Trace: ger.gmane.org 1463773345 4997 80.91.229.3 (20 May 2016 19:42:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 20 May 2016 19:42:25 +0000 (UTC) Cc: 16856@debbugs.gnu.org To: Alan Third Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 20 21:42:14 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b3qBa-0006YY-DD for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 May 2016 21:34:14 +0200 Original-Received: from localhost ([::1]:56121 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3qBZ-0007ws-Gs for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 May 2016 15:34:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58716) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3qBS-0007wa-N1 for bug-gnu-emacs@gnu.org; Fri, 20 May 2016 15:34:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b3qBO-0007mw-LQ for bug-gnu-emacs@gnu.org; Fri, 20 May 2016 15:34:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:47008) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3qBO-0007ms-Hw for bug-gnu-emacs@gnu.org; Fri, 20 May 2016 15:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1b3qBO-0000Si-8D for bug-gnu-emacs@gnu.org; Fri, 20 May 2016 15:34:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Anders Lindgren Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 20 May 2016 19:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16856 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: unreproducible Original-Received: via spool by 16856-submit@debbugs.gnu.org id=B16856.14637728411769 (code B ref 16856); Fri, 20 May 2016 19:34:02 +0000 Original-Received: (at 16856) by debbugs.gnu.org; 20 May 2016 19:34:01 +0000 Original-Received: from localhost ([127.0.0.1]:59345 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b3qBM-0000SQ-MN for submit@debbugs.gnu.org; Fri, 20 May 2016 15:34:00 -0400 Original-Received: from mail-vk0-f68.google.com ([209.85.213.68]:33027) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b3qBL-0000SB-1X for 16856@debbugs.gnu.org; Fri, 20 May 2016 15:33:59 -0400 Original-Received: by mail-vk0-f68.google.com with SMTP id y2so10193524vka.0 for <16856@debbugs.gnu.org>; Fri, 20 May 2016 12:33:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=blyp0rqtVRrTeK4CbTyb5fmjciCRYq2dM1aZNOqQmpk=; b=Reu4I95qtHHYJBwX2gEdEEmPsZ/WJCBnNj9RuHJW9IdrKzK9P4wfWiX+MKGY/qn0hF fbBMFONGs8gUr/uKaVbYxNAJwQBCMBHznGX1ElT54mjUwuyV2eTq4qlvH+lfPZcOQuVt hecLLI/uWMhVn0zcYL0vO4/9IcEwjI/cZQdaCu0bj2a1DkmnBFPCNgYWbBkgUVuUqsg7 8pr9LXDEWZwiZXkrmyftQWc1QcCuTlvEoKePIc7M6Ey8s0bu8uijYUUTESFOOdRkpuxy 5xmFUhQqBSkc02Medqo00bG4CtvBTaTBLiYU6CiUJvWqImMDyt6usjPwPtTF7viwd9rW hEcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=blyp0rqtVRrTeK4CbTyb5fmjciCRYq2dM1aZNOqQmpk=; b=Mr+3/5qMdaJWHdkKH0Trebrf4iXcZYlZrrPLmSK3XHbCEfKDqxg1u56K9+KYsZukTk Fx62N3S0GhI6YrvTuvuc4V3fEvoTYmcqXJl37fCGR1DxDhD+tpOQ2K+hZFYqsCPSuWiG QNmBtM6ZUy5YtRIgXK15YkzZa2P4qb4IoVD1W332Pen5zaGCclM+htqE7vE2wMWz4JWx bNlYuvTTlqB0kH3Z+RmOm0OBaQq7e/3DpPDFacmMMKrQ1f7G8TqObiNYjbJxfzta1Evr x+aRgFZ3cAr25rQuf9RhCM8bURS4OpolAyLym3P3fBZ5lkVsJDmrp/dFs3Ij8fVMJrTr /FMg== X-Gm-Message-State: AOPr4FV9j3rsHtmRCXVwyzoNYSyk41CwkG2uk4V05zD3kXDotQMCRBL0Peam8/EBuK1JrtmzixGy++C3CRDH1A== X-Received: by 10.159.33.132 with SMTP id 4mr2653662uac.43.1463772832219; Fri, 20 May 2016 12:33:52 -0700 (PDT) Original-Received: by 10.31.216.195 with HTTP; Fri, 20 May 2016 12:33:52 -0700 (PDT) In-Reply-To: <20160517211415.GA85076@breton.holly.idiocy.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:118498 Archived-At: --001a1135dc96b250c805334b2b86 Content-Type: text/plain; charset=UTF-8 Hi! I gave this patch a try. It works well, the ns port now behaves like the win32 and gtk+ parts of Emacs. Do you want me to push it to master? -- Anders Ps. When the text area doesn't partially overlap a column, the cursor can be drawn in the fringe. It's a bit unfortunate that when it do overlap, only the part of the cursor in the text area is drawn. A worst case scenario is that only a single pixel of the cursor is visible. An ideal solution would be to draw the cursor partially in the text area and partially in the fringe, but without leaving garbage behind when moved. However, this is nothing that we can solve here and now as it would require change to all emacs ports and possibly the core system. On Tue, May 17, 2016 at 11:14 PM, Alan Third wrote: > src/nsterm.m (ns_draw_window_cursor): Reduce clip area from ANY_AREA to > TEXT_AREA. (bug#16856) > --- > src/nsterm.m | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/src/nsterm.m b/src/nsterm.m > index 1d48c04..5eb4c8f 100644 > --- a/src/nsterm.m > +++ b/src/nsterm.m > @@ -2873,9 +2873,8 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar > cursors. > r.size.height = h; > r.size.width = w->phys_cursor_width; > > - /* TODO: only needed in rare cases with last-resort font in HELLO.. > - should we do this more efficiently? */ > - ns_clip_to_row (w, glyph_row, ANY_AREA, NO); /* do ns_focus(f, &r, 1); > if remove */ > + /* Prevent the cursor from being drawn outside the text area. */ > + ns_clip_to_row (w, glyph_row, TEXT_AREA, NO); /* do ns_focus(f, &r, 1); > if remove */ > > > face = FACE_FROM_ID (f, phys_cursor_glyph->face_id); > -- > > I believe this fixes it. > > -- > Alan Third > --001a1135dc96b250c805334b2b86 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi!

I gave this patch a try.
=
It works well, the ns port now behaves like the win32 and gt= k+ parts of Emacs.

Do you want me to push it = to master?

=C2=A0 =C2=A0 -- Anders

Ps. When the text area doesn't partially overlap a= column, the cursor can be drawn in the fringe. It's a bit unfortunate = that when it do overlap, only the part of the cursor in the text area is dr= awn. A worst case scenario is that only a single pixel of the cursor is vis= ible. An ideal solution would be to draw the cursor partially in the text a= rea and partially in the fringe, but without leaving garbage behind when mo= ved. However, this is nothing that we can solve here and now as it would re= quire change to all emacs ports and possibly the core system.


On Tue, May 17, 2016 at 11:14 PM, Alan Third <alan@idiocy.org> wrote:
src/nsterm.m (ns_draw_window_cu= rsor): Reduce clip area from ANY_AREA to
TEXT_AREA. (bug#16856)
---
=C2=A0src/nsterm.m | 5 ++---
=C2=A01 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/nsterm.m b/src/nsterm.m
index 1d48c04..5eb4c8f 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -2873,9 +2873,8 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar = cursors.
=C2=A0 =C2=A0r.size.height =3D h;
=C2=A0 =C2=A0r.size.width =3D w->phys_cursor_width;

-=C2=A0 /* TODO: only needed in rare cases with last-resort font in HELLO..=
-=C2=A0 =C2=A0 =C2=A0should we do this more efficiently? */
-=C2=A0 ns_clip_to_row (w, glyph_row, ANY_AREA, NO); /* do ns_focus(f, &= ;r, 1); if remove */
+=C2=A0 /* Prevent the cursor from being drawn outside the text area. */ +=C2=A0 ns_clip_to_row (w, glyph_row, TEXT_AREA, NO); /* do ns_focus(f, &am= p;r, 1); if remove */


=C2=A0 =C2=A0face =3D FACE_FROM_ID (f, phys_cursor_glyph->face_id);
--

I believe this fixes it.

--
Alan Third

--001a1135dc96b250c805334b2b86--