From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ash Newsgroups: gmane.emacs.help Subject: Re: Moving point around empty overlays with 'after-text Date: Sun, 09 Apr 2023 13:44:07 -0700 Message-ID: <2314d321-040a-4466-afdb-4317df7e6584@app.fastmail.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> <22b315db-39eb-80b6-1a7c-127f5e703dc1@gmail.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="39556"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Cyrus-JMAP/3.9.0-alpha0-334-g8c072af647-fm-20230330.001-g8c072af6 To: "Platon Pronko" , 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 22:45: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 1plbuU-000A5n-16 for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 09 Apr 2023 22:45:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1plbtw-0007fT-EC; Sun, 09 Apr 2023 16:44:40 -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 1plbtt-0007fF-1D for help-gnu-emacs@gnu.org; Sun, 09 Apr 2023 16:44:37 -0400 Original-Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1plbtq-0005Sw-Mw for help-gnu-emacs@gnu.org; Sun, 09 Apr 2023 16:44:36 -0400 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 0AEA2320029B; Sun, 9 Apr 2023 16:44:29 -0400 (EDT) Original-Received: from imap42 ([10.202.2.92]) by compute3.internal (MEProxy); Sun, 09 Apr 2023 16:44:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catgirl.ai; h=cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1681073069; x=1681159469; bh=+u ft7rjJ3jX57Bxwd11Gf6yAu1w914gMym4dqzqpqgM=; b=lp4yjwb/xWuOyQr4f6 ilC4bZaAm4YR/42rRgsV24DtFy/KCdRG/Jq9HeHnFUMyuLvAM8Fh99qnD32Rn1ZZ C/OndcqpfQT8qysOIw+p6jCZQBNvaOBCTBgsX2ZNbs+g0qlLjISjHTDbSKU9ilGI IE1rEmlTehohLcotzfYCPKwztT/938l6vHh4CPR99B0gpDyZKWN1IwkenzHKpcMR RcqgdH9+o8KYPFi8hngwto2wSoX5St6J0+YDfZSNLfDgLRCZG0BUpHACjWrWVi8U cG+Lrnh1eYimHJOoTh6G2gagXAJJt6wxCfUE0ceEr65AuXz1k0EuMZXAuVPtjChL 8t7A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1681073069; x=1681159469; bh=+uft7rjJ3jX57 Bxwd11Gf6yAu1w914gMym4dqzqpqgM=; b=Fuarfi8zZk2xWGt2DJAQ7uw2fAlW/ oz76WEXN5IAqf2HMBCh2xz3h1vDqwmEfq9b7VOwq+p6nBokKMmEoWmKXT29Sz8OP +cmiIl4hNLXyjr0ymF1cFdroXblgthI4O0ic9/TUeB1AbmM5yiLWmveBmHTk1Ppv 0bg3SChyaGQ0vTz6h/VpnzXSRFfLZc7ilieB81gQfyjlnA81of7P0upFQc84IVo7 VghJyi/83PETQlXAEuOHheftm5cRGaOOOnYfbjzGXqw5zlypfVGa1st6mC6iHFe+ m9TF3hVa49LWIZ4x6/5MPW2ckFqWm0EgW9tXHbHVcwlcCIxBWPwEHb2jw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdektddgudehhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtsegrtderreerredtnecuhfhrohhmpeetshhh uceovgigthdtlhestggrthhgihhrlhdrrghiqeenucggtffrrghtthgvrhhnpefftefhud ffheeltdeujefgvdelgfdugfefgffgffeluddvteeugfevveeffeevfeenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegvgihttdhlsegtrghtgh hirhhlrdgrih X-ME-Proxy: Feedback-ID: i98e14743:Fastmail Original-Received: by mailuser.nyi.internal (Postfix, from userid 501) id 4B5A3BC007E; Sun, 9 Apr 2023 16:44:29 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface In-Reply-To: <22b315db-39eb-80b6-1a7c-127f5e703dc1@gmail.com> Received-SPF: pass client-ip=64.147.123.25; envelope-from=ext0l@catgirl.ai; helo=wout2-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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:143235 Archived-At: Yeah, I think doing this "right" might require adding a new property to overlays/strings (or giving an existing property a new value) to enable this behavior and modifying C code. Not sure how viable that is or if it's something the devs would want. On Sun, Apr 9, 2023, at 5:15 AM, Platon Pronko wrote: > 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 > >