From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#62540: 30.0.50; incorrect cursor positioning after overlay when put-text-property 'cursor t Date: Thu, 30 Mar 2023 16:33:16 +0300 Message-ID: <83zg7u4b4z.fsf@gnu.org> References: <608539f1-df76-c667-ed13-57ef31b0d081@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3559"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 62540@debbugs.gnu.org To: Platon Pronko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 30 15:50:49 2023 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 1phsfx-0000h1-0h for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 30 Mar 2023 15:50:49 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1phsPn-0007KP-Mt; Thu, 30 Mar 2023 09:34:07 -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 1phsPi-0007JE-73 for bug-gnu-emacs@gnu.org; Thu, 30 Mar 2023 09:34:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1phsPh-00043e-TF for bug-gnu-emacs@gnu.org; Thu, 30 Mar 2023 09:34:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1phsPh-0004hb-PW for bug-gnu-emacs@gnu.org; Thu, 30 Mar 2023 09:34:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 30 Mar 2023 13:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62540 X-GNU-PR-Package: emacs Original-Received: via spool by 62540-submit@debbugs.gnu.org id=B62540.168018321618035 (code B ref 62540); Thu, 30 Mar 2023 13:34:01 +0000 Original-Received: (at 62540) by debbugs.gnu.org; 30 Mar 2023 13:33:36 +0000 Original-Received: from localhost ([127.0.0.1]:56148 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1phsPH-0004gn-Qw for submit@debbugs.gnu.org; Thu, 30 Mar 2023 09:33:36 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:57600) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1phsPF-0004gX-NB; Thu, 30 Mar 2023 09:33:34 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1phsP8-0003yv-LB; Thu, 30 Mar 2023 09:33:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=P0EBjlFqjAT0io4/pSpbuqcdwEbrMuirJ5RxOVUlzIg=; b=g3pNQDAnEkVZ TSQFxLy9mQEO8lhrpWKdQRunMy14F6gPFXQR3bwB0DJE+mTAS2TVNDROYHNbdgr+q/ADL3bxDtrsZ tHJF2cruRDDyrqy4A2RBBsyIR4iq6Ffz+QfylU84Qj2oicvNMowadjjLIFi7DPPKGZoZY9UZ/1iCe H/FEW/GDyRYxdyUz3mB+0Rq8jMxtD4v9kVQGm3Hy3JHhRu5WGaZlxMcUM5pWs9hiiM+zdJqn1wwvU ZeDZpyw1i91xY/9A2/sWZ9ZfjkPen97sIWbZBkoIfZVbEJkGAse+H8cqfKPtSQE9NYIX7ph/cVqdi o7yUMphHyzA3MYb5npNI7Q==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1phsOo-0003Bi-VQ; Thu, 30 Mar 2023 09:33:24 -0400 In-Reply-To: <608539f1-df76-c667-ed13-57ef31b0d081@gmail.com> (message from Platon Pronko on Thu, 30 Mar 2023 18:59:15 +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:258926 Archived-At: tags 62540 notabug thanks > Date: Thu, 30 Mar 2023 18:59:15 +0800 > From: Platon Pronko > > According to documentation, if a character in the overlay text string has 'cursor property set to t, > then cursor should be shown on that character while point is in the overlay. > > However, it seems that this doesn't work at the moment - cursor is still shown after the overlay. > > Here's a test file to reproduce the problem: > > ``` > AD > > (defun test-overlay-cursor (completion pt) > (remove-overlays) > (save-excursion > (let* ((p-completion (propertize completion 'face 'error)) > (ov (make-overlay pt pt nil t t))) > ;; doesn't work, cursor is shown after overlay > (put-text-property 0 1 'cursor t p-completion) > ;; works, cursor is shown before overlay > ;; (put-text-property 0 1 'cursor 1 p-completion) > (overlay-put ov 'display "") > (overlay-put ov 'after-string p-completion))) > (goto-char 2)) > (test-overlay-cursor "BC" 2) > > ``` > > When I run the last sexp I observe the cusor being shown after the overlay: > > ABCD > > While the expected position is: > > ABCD Your overlay is "empty": it doesn't hide any buffer text characters from being shown on display. So Emacs has no reason to try to display the cursor inside the overlay text: ity could simply show the cursor on the character at point. If you change the make-overlay call in your test-overlay-cursor function to say this instead: (ov (make-overlay pt (1+ pt) nil t t))) ^^^^^^^ then it will work as you expect. Note that the ELisp manual explicitly talks about "when the overlay or display string make point not visible on display". This doesn't happen in your case. > Workaround is to use the integer argument instead of t. Yes, if you must use "empty" overlays. But that is basically a side effect of the implementation, and you should not rely on that too much. Better not use "empty" overlays at all if you want to show the cursor inside the overlay string. This is not a bug.