From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gerd =?UTF-8?Q?M=C3=B6llmann?= Newsgroups: gmane.emacs.bugs Subject: bug#72230: 29.4; Cursor Disappears with Hebrew Text Date: Mon, 22 Jul 2024 08:47:30 +0200 Message-ID: References: <86o76qbvd9.fsf@gnu.org> <86ikwybuoq.fsf@gnu.org> <86a5iabq90.fsf@gnu.org> <87sew2xju6.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5863"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , hermann sorgel , Stefan Kangas , 72230@debbugs.gnu.org To: Po Lu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jul 22 08:49:18 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1sVmrG-0001ND-6E for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 22 Jul 2024 08:49:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sVmqz-0006Fc-VF; Mon, 22 Jul 2024 02:49:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sVmqy-00067k-8a for bug-gnu-emacs@gnu.org; Mon, 22 Jul 2024 02:49:00 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sVmqx-0004LM-VI for bug-gnu-emacs@gnu.org; Mon, 22 Jul 2024 02:48:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sVmr0-0005Te-Eh for bug-gnu-emacs@gnu.org; Mon, 22 Jul 2024 02:49:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gerd =?UTF-8?Q?M=C3=B6llmann?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 Jul 2024 06:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72230 X-GNU-PR-Package: emacs Original-Received: via spool by 72230-submit@debbugs.gnu.org id=B72230.172163092421027 (code B ref 72230); Mon, 22 Jul 2024 06:49:02 +0000 Original-Received: (at 72230) by debbugs.gnu.org; 22 Jul 2024 06:48:44 +0000 Original-Received: from localhost ([127.0.0.1]:56722 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sVmqh-0005T4-G6 for submit@debbugs.gnu.org; Mon, 22 Jul 2024 02:48:43 -0400 Original-Received: from mail-ej1-f49.google.com ([209.85.218.49]:61898) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sVmqf-0005Sq-2W for 72230@debbugs.gnu.org; Mon, 22 Jul 2024 02:48:41 -0400 Original-Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a6fd513f18bso339102366b.3 for <72230@debbugs.gnu.org>; Sun, 21 Jul 2024 23:48:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721630852; x=1722235652; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=wIcb4XEuECg94+pfInjkQtf0ydR23wPRtw0aabzO7Yo=; b=KN2uu7rEElcGg50jlH3VQvjKCQnC7/rfiuoRDjL7WgGsD+HEEN5m+CkUzT8UPdcdxt NZ60dXdNUT7uBquv16uVR7geXLu1nldWvj0Aby/MDjeg88ejhwJIHKUwXz46dO/MOG+B cjluIdhkraNU74baJeTU0NSuDtykLL+JYz2w26jO6BpE9jMXt43+56k5d8+RilWrPYOW 9OsCg+VxVREQTlTUKj2/xadh8Tt3TueOFZdfAl9PCQU7EtcZJAK3/v6Or/NLPAe6Hpgc dmaS3s9NAESIgs44YQDlPR36lb8svK6LChHJXMrXpQkDT1dkLNs3AJFe6W4jhaVXAq2m 24nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721630852; x=1722235652; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=wIcb4XEuECg94+pfInjkQtf0ydR23wPRtw0aabzO7Yo=; b=TC9OLUorjS7Dfq46pAy0nNs+m+I12sCrvBCgmwl9j2YXYv27CosDKjcV+mSKCf4DQZ Bi32LGLi6lDPI4P1K3Gysp+arhybD2QEpjA69rFGnVPPwnxy/Y2yU/bb2tYU/ifWj9zy T+c8XZDzD3SZF4/vFdnN2IP5l5qN7mcsDYwan8gulFj1Jf3AyjOrEgKYxKpCKBtDZzIf MU5vDmIGw1DnPUNvyOd/1MRhr94D3naj8/cI/XA/Q+VkWxYlYApv4v2SUMfJ1m4P+S23 Ce5yo/CnV7iic+Qw05rpF114bSt0Mh6Ce7dmR035deRYtExOb+NHCsjg/KKhrFFQxduT SfPg== X-Forwarded-Encrypted: i=1; AJvYcCXrxr3SfyapNn2nYAHvdo/4KIw39Br6lFunzm0i48TGpKaF1eq1YYIpukF/R80BPerSvvsxwrRNSFLZDFybBsDfer20h+w= X-Gm-Message-State: AOJu0Yy3X4G/q+zm0eYLTY27ax9+hyLccjAyC55uAhOTvvDhOMnbEZaU n9aMAjOq2JwNxwiaxknTFO3Xxq8RbXAXKUPlXe+eVKp2xc3446FuemN3Ow== X-Google-Smtp-Source: AGHT+IHyHDpeeHKeWFXoJD0yiTaWV+/ZstypPKQSz0kKcrsfRgpgHQdbQYdiJcMFXaB4SVjchbM5NA== X-Received: by 2002:a17:906:39c8:b0:a77:dd5c:d7f2 with SMTP id a640c23a62f3a-a7a0111613cmr996073966b.5.1721630851972; Sun, 21 Jul 2024 23:47:31 -0700 (PDT) Original-Received: from pro2.fritz.box (pd9e3607a.dip0.t-ipconnect.de. [217.227.96.122]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7a3c785e07sm379924466b.38.2024.07.21.23.47.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jul 2024 23:47:31 -0700 (PDT) In-Reply-To: <87sew2xju6.fsf@yahoo.com> (Po Lu's message of "Mon, 22 Jul 2024 10:05:05 +0800") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:289108 Archived-At: Po Lu writes: > Stefan Kangas writes: > >> Eli Zaretskii writes: >> >>> So maybe the problem is elsewhere. One thing is almost certain: it's >>> a problem specific to the macOS build of Emacs. People who can debug >>> on that platform are encouraged to suggest insights and changes. >> >> This seems to have something to with the clipping path, and is fixed >> here by the below patch. I don't think it's suitable for installing >> though. >> >> Po Lu, since you added the below NSRectClip call, do you have any >> thoughts here? > > Yes, this will cause the overhangs of a cursor glyph to overwrite its > surroundings. There is certain to be some other factor that has not > been accounted for, while mindlessly removing clipping operations is not > the solution. > >> diff --git a/src/nsterm.m b/src/nsterm.m >> index 794630de1c1..54b15bc851d 100644 >> --- a/src/nsterm.m >> +++ b/src/nsterm.m >> @@ -3102,7 +3102,7 @@ Note that CURSOR_WIDTH is meaningful only for >> (h)bar cursors. >> #ifdef NS_IMPL_GNUSTEP >> GSRectClipList (ctx, &r, 1); >> #else >> - NSRectClip (r); >> + // NSRectClip (r); >> #endif >> >> [FRAME_CURSOR_COLOR (f) set]; >> @@ -3135,7 +3135,7 @@ Note that CURSOR_WIDTH is meaningful only for >> (h)bar cursors. >> on the right of its glyph, rather than on the left. */ >> cursor_glyph = get_phys_cursor_glyph (w); >> if ((cursor_glyph->resolved_level & 1) != 0) >> - s.origin.x += cursor_glyph->pixel_width - s.size.width; >> + s.origin.x += cursor_glyph->pixel_width - cursor_width; > > I don't recollect what `s' is supposed to represent. I propose the following as a fix. This computes the right rectangle to draw before that rectangle is set via NSClipRect. 1 file changed, 8 insertions(+), 12 deletions(-) src/nsterm.m | 20 ++++++++------------ modified src/nsterm.m @@ -3026,7 +3026,7 @@ External call (RIF): draw cursor. Note that CURSOR_WIDTH is meaningful only for (h)bar cursors. -------------------------------------------------------------------------- */ { - NSRect r, s; + NSRect r; int fx, fy, h, cursor_height; struct frame *f = WINDOW_XFRAME (w); struct glyph *phys_cursor_glyph; @@ -3076,6 +3076,12 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors. /* The bar cursor should never be wider than the glyph. */ if (cursor_width < w->phys_cursor_width) w->phys_cursor_width = cursor_width; + + /* If the character under cursor is R2L, draw the bar cursor + on the right of its glyph, rather than on the left. */ + cursor_glyph = get_phys_cursor_glyph (w); + if ((cursor_glyph->resolved_level & 1) != 0) + fx += cursor_glyph->pixel_width - w->phys_cursor_width; } /* If we have an HBAR, "cursor_width" MAY specify height. */ else if (cursor_type == HBAR_CURSOR) @@ -3126,18 +3132,8 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors. [ctx restoreGraphicsState]; break; case HBAR_CURSOR: - NSRectFill (r); - [ctx restoreGraphicsState]; - break; case BAR_CURSOR: - s = r; - /* If the character under cursor is R2L, draw the bar cursor - on the right of its glyph, rather than on the left. */ - cursor_glyph = get_phys_cursor_glyph (w); - if ((cursor_glyph->resolved_level & 1) != 0) - s.origin.x += cursor_glyph->pixel_width - s.size.width; - - NSRectFill (s); + NSRectFill (r); [ctx restoreGraphicsState]; break; }