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: Sun, 9 Apr 2023 20:15:31 +0800 Message-ID: <22b315db-39eb-80b6-1a7c-127f5e703dc1@gmail.com> References: <9b1654ec-1ac6-4936-860b-2d77dcc4dac7@app.fastmail.com> <28954f0d-205d-b322-4a43-cf4481d1266e@gmail.com> <3a1bb709-d00f-49b8-a2c5-d0ac5b6a82c4@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="13242"; 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 Sun Apr 09 14:16:30 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 1plTyA-0003Fr-Dn for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 09 Apr 2023 14:16:30 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1plTxS-0003UF-AF; Sun, 09 Apr 2023 08:15:46 -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 1plTxP-0003Tx-5t for help-gnu-emacs@gnu.org; Sun, 09 Apr 2023 08:15:44 -0400 Original-Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1plTxM-000417-MQ for help-gnu-emacs@gnu.org; Sun, 09 Apr 2023 08:15:42 -0400 Original-Received: by mail-pl1-x62f.google.com with SMTP id la3so2322939plb.11 for ; Sun, 09 Apr 2023 05:15:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1681042538; x=1683634538; 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=CLNyi3iFaAOhDA05S+Ewck2N4NM46nh60wCLmaJUmX0=; b=mTEng9yJz4Yxhyl6L/e4CDQxamhq+/cEhWr9fw+Znma6O1SZq1Arsx7W4NG5eAkmyu 3fqgwtI+mc5N8UNxyaq3tfmIjEDuC9mhkd1vxNS+8RJsg6aM+srV+jGHjmaYN5qAc81y YZU2XG1pjH8NRtNJjghhhjXWaIxhCJeIL6D+QCr5i+r3dy4pef7uCALoNDOwjKrbfgYe k3yds3Msr4KXxLbs4kxhDagNg404C/6A2zWazviDN8nyVw9hBkJdZQHiWRKsz27j3KGZ jEDkbPNXB4vdCdgzxPoMkK5VZzM7hFzeTaUXeGC9TsW3KCXzm3qWnLDomuG79VK37oLM 18fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681042538; x=1683634538; 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=CLNyi3iFaAOhDA05S+Ewck2N4NM46nh60wCLmaJUmX0=; b=V/lh0mMLlMyQleKts9XOIgU4XwNa887l7vBUpATYq47X1mhyePXr/nkthjRS3fhRjO J+X0MM/FHJpHSngXwCAlLEt1wV7gFil4hqqesaYJhyT/ecWCsFwSth9DsfdKb2TyrQHy x1JtkrKn4gAKqH0LlrVxWfYFg9o0ZF6qLVqU4h1QeQwI4FXIIZ0NMYVppbrYpgt1nkZ8 PyLG7gALQe828311g9bNXPVzVpJTNCokdQToFbnT5cn6H7mevb7LVKJ/PV3FsWxiCbqf MBqPC1p627VHGeZuMY6kBNzChis1QOdYvZ/0NNKk2/8UxUjpsEqPzWPcjEotNpSOAbOw Kaaw== X-Gm-Message-State: AAQBX9cyzX29GsizIYEQ0xoZBoHQRJRmaTtckzUlPcf6c852RUX1FSBb 2xGHQVlBpaHuboHRzTaqL/I= X-Google-Smtp-Source: AKy350Zcg/13IlF9g1FwG/HUhp4MFXSqeC0PpJ71HZhZ4F0UAWkN5sqjuIliG/dRtz8J+SlevjHlMg== X-Received: by 2002:a17:90b:3885:b0:244:a3b8:ea9f with SMTP id mu5-20020a17090b388500b00244a3b8ea9fmr9407950pjb.25.1681042537737; Sun, 09 Apr 2023 05:15:37 -0700 (PDT) Original-Received: from [192.170.1.133] ([103.24.106.35]) by smtp.gmail.com with ESMTPSA id gp19-20020a17090adf1300b0023c8a23005asm5563676pjb.49.2023.04.09.05.15.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 09 Apr 2023 05:15:37 -0700 (PDT) Content-Language: en-US In-Reply-To: <3a1bb709-d00f-49b8-a2c5-d0ac5b6a82c4@app.fastmail.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=platon7pronko@gmail.com; helo=mail-pl1-x62f.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 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.888, 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:143233 Archived-At: On 2023-04-09 07:06, Ash wrote: > Yeah, that's my message, hence why I was asking if I was missing something :) > > In some cases it makes sense to put the cursor after the overlay; for example, when invoking a function, the overlay can look like > > some_function({argument_name: }some_value) > > in which case you'd expect to be able to put the cursor after the overlay (to edit the value) and before (to add another argument to the list). Both cursor positions would correspond to the same location, but you're doing something different semantically. So I would expect to be able to type 'another_value, ' before the overlay and 'foo' after and get > > some_function(another_value, {argument_name: }foosome_value) > > and not > > some_function({argument_name: }another_value, foosome_value) > > In practice, I think for the existing overlays in rust-analyzer's inlay hints there's a 'preferred' cursor position (start for type annotations, end for param name annotations) where the user will want it 80% of the time, so it could set things up based on that. Might also investigate the nasty solution and see how clean I can get it and see if it's expensive CPU-wise. > I looked at what other IDE is doing (IDEA in my case). They indeed allow the cursor to be positioned both before and after the inlay, with added text appearing exactly as you described. I still think that doing this hack with "detect if the cursor moved exactly one position forward, tweak overlay, move it back" is horrible. It feels like it might be much better if this was handled at much lower level, not at the level of lsp-mode. -- Best regards, Platon Pronko PGP 2A62D77A7A2CB94E