From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Platon Pronko Newsgroups: gmane.emacs.help Subject: Re: Moving point around empty overlays with 'after-text Date: Sat, 8 Apr 2023 18:10:33 +0800 Message-ID: <28954f0d-205d-b322-4a43-cf4481d1266e@gmail.com> References: <9b1654ec-1ac6-4936-860b-2d77dcc4dac7@app.fastmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25380"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 To: Ash , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 08 12:11:14 2023 Return-path: Envelope-to: geh-help-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 1pl5XO-0006Sg-JT for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 08 Apr 2023 12:11:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pl5Ws-0006Be-G8; Sat, 08 Apr 2023 06:10:42 -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 1pl5Wr-0006BT-G6 for help-gnu-emacs@gnu.org; Sat, 08 Apr 2023 06:10:41 -0400 Original-Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pl5Wp-0001E8-Pi for help-gnu-emacs@gnu.org; Sat, 08 Apr 2023 06:10:41 -0400 Original-Received: by mail-pl1-x62a.google.com with SMTP id la3so633454plb.11 for ; Sat, 08 Apr 2023 03:10:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680948637; x=1683540637; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=MQ3AxMNOPglOhPuDMWUgqS+VEeY8XYbN23LYqgqZZcg=; b=mJcVtoJ8gMCuynjoZpoi89SjVn3jCC6kaB8BVZdYZJJd0FX1jiqxpZKlDF0HBgPTL2 S9u3FUl/wTsUp/7PlTcFlWKLi3bAckfmZ+GLNCYH3IURETSqXCtCOjZKBoH6bkw0KmII 3mq8ZGPTTFxIO/kC+DIC7MjUaiPPeAhce43dZarMClWzgopvxmBoL2i6YebKti/JmKm5 ZYakpkT5j1ydO2Kh9tGaSUTSA1T4f5r8Qc9UilaYKPshP4l70XbuaAQ4jkxeB3LkW2/F 2R4oH5D33afm2JFYyC6tyjjo9Qpapa6eSEYbyfDPg2jg3sEBgA51TEdhrnCP60TKPXD3 cLOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680948637; x=1683540637; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MQ3AxMNOPglOhPuDMWUgqS+VEeY8XYbN23LYqgqZZcg=; b=zEPxyvvs1L5tP1Z7scnjkg8fFD6qcSRgosHf7iA9h+cRPXLAA64BcLMu3OvU2PKOq1 srKPXDCEYH4ixjdHOCFkT7NTZFB/xsWS33zeD+dnewARkGAe1FILG5OR/RO2YnJrS17y DznBnkNvqelVNMDeWpHKjYb07+/19itLo87LNJuRZEk5d5rYtIBMM2GEvjT1oW3I5YpD uBGy/vkjdA09y3tfxj8cryIGMy4ktDp02xt5og76wajNcO42EvlSyQd0RndK8UfmiEee Vxhd1m6Y0p/qG/ifxJYBBsgGxiBY8XAdZkTTyOvjBPSEkv4E3LuVSXbTj8gnN4apTx2S Gbsw== X-Gm-Message-State: AAQBX9e9naKbiMlFiSMjAcmpfQM40ZqBsrZRIYA03SK8AIrNE4m6kKIn kGQlZWVNELwbCzhJ0h/b81s= X-Google-Smtp-Source: AKy350b+MATapq/AxcCeOUPwSJOxhRR5mlWLYPw9w3TQ0VaDtn2dO3ai5Y/9oDlS/W9UiGXiUcdsSA== X-Received: by 2002:a05:6a20:a91f:b0:d5:9216:9182 with SMTP id cd31-20020a056a20a91f00b000d592169182mr1419011pzb.9.1680948637401; Sat, 08 Apr 2023 03:10:37 -0700 (PDT) Original-Received: from [192.170.1.133] ([103.24.106.35]) by smtp.gmail.com with ESMTPSA id a1-20020aa78641000000b0062deace7c0csm4437270pfo.190.2023.04.08.03.10.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 08 Apr 2023 03:10:37 -0700 (PDT) Content-Language: en-US In-Reply-To: <9b1654ec-1ac6-4936-860b-2d77dcc4dac7@app.fastmail.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=platon7pronko@gmail.com; helo=mail-pl1-x62a.google.com X-Spam_score_int: -7 X-Spam_score: -0.8 X-Spam_bar: / X-Spam_report: (-0.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, NICE_REPLY_A=-2.03, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:143227 Archived-At: On 2023-04-08 13:46, Ash wrote: > https://github.com/emacs-lsp/lsp-mode/issues/3263 is a bug in lsp-mode (emacs's > own eglot has the same bug as far as I can tell) that appears to boil down to > the behavior of emacs overlays and after-string. That is, if your buffer looks > like > > let my_value{: Vec} = vec![0, 1, 2]; > > (where the curly braces indicate the after-string property of an > overlay), you need to put your cursor *after* the overlay to > insert text at the end of the variable name, which comes *before* > it, and it's impossible to put your cursor immediately between > the overlay and the preceding text. I assume the behavior the > user desires is that you can put your cursor either immediately > before or immediately after the overlay and insert text, and that > pressing the left/right arrow would move you over the overlay but > leave the actual position of point unchahnged. > > My suspicion is that this isn't fixable just by setting the right text/overlay > properties, since both the cursor locations immediately before and after the > overlay actually correspond to the same location in the underlying string. But > I'm not good at text property arcana. Any advice? Github issue has some suggestion about how it could possibly be done, and the poster rightfully notes that the solution is nasty (essentially catching the event of cursor moving 1 char forward, tweaking overlay properties and resetting the cursor back). Does it actually make any sense to put the cursor right after the overlay? In my opinion the easier solution would be to always put it before the overlay - this way when the text is typed it is inserted right before the cursor, not somewhere else. However there are problems with that as well, because right now there is no correct way to set cursor position when near the zero-width overlay (see https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62540). -- Best regards, Platon Pronko PGP 2A62D77A7A2CB94E