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#54488: 29.0.50; move-to-column/overlay-related regression in latest master, perhaps 28? Date: Tue, 22 Mar 2022 16:31:39 +0200 Message-ID: <834k3qf48k.fsf@gnu.org> References: <87bkxzdccp.fsf@gmail.com> <831qyvfpv4.fsf@gnu.org> <83fsnbfd72.fsf@gnu.org> <8735jbc6gj.fsf@gmail.com> <6095582d-7065-8089-e8c7-857f070f8ce2@yandex.ru> <87y212b9nt.fsf@gmail.com> <83a6difahu.fsf@gnu.org> <835yo6f5tu.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3021"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 54488@debbugs.gnu.org To: joaotavora@gmail.com, dgutov@yandex.ru Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 22 15:33:10 2022 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 1nWfZO-0000bu-B6 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 22 Mar 2022 15:33:10 +0100 Original-Received: from localhost ([::1]:39780 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nWfZM-0000um-V6 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 22 Mar 2022 10:33:08 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:48360) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nWfZG-0000ue-LW for bug-gnu-emacs@gnu.org; Tue, 22 Mar 2022 10:33:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47660) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nWfZG-0006Tx-D2 for bug-gnu-emacs@gnu.org; Tue, 22 Mar 2022 10:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nWfZG-0003EJ-0e for bug-gnu-emacs@gnu.org; Tue, 22 Mar 2022 10:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 Mar 2022 14:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54488 X-GNU-PR-Package: emacs Original-Received: via spool by 54488-submit@debbugs.gnu.org id=B54488.164795952311033 (code B ref 54488); Tue, 22 Mar 2022 14:33:01 +0000 Original-Received: (at 54488) by debbugs.gnu.org; 22 Mar 2022 14:32:03 +0000 Original-Received: from localhost ([127.0.0.1]:41557 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nWfYJ-0002rc-7C for submit@debbugs.gnu.org; Tue, 22 Mar 2022 10:32:03 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:44360) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nWfYH-0002lr-R1 for 54488@debbugs.gnu.org; Tue, 22 Mar 2022 10:32:02 -0400 Original-Received: from [2001:470:142:3::e] (port=38604 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nWfYB-0006JP-7S; Tue, 22 Mar 2022 10:31:56 -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=S192ng0NC9z0IUY0aYcAMYyyDNYr3WEVPFKCFAolxDE=; b=SBs+zYImxcWd uETsPF8DDBMIP0bQAi8MbxTjx4AC4xGeWpmK00yf7EwUeAAY54Kv3GgTLs9QegZbBX3lX55serln0 PYWFUzTR0ow2GOOZRGUCX/soopAV+iLAtVzcjZn5YXmP12jowVkB1gehWieGBuVLpwsJZKCkiDDXs ddQ6cvk558qU9zUUxh0vGnp4KhZc1UybpvpZbvp85WCVO9JNJ9M1pdQa6N9uvw+xRjU0CEn6d64Ct 0AMSutBeScIG6jIewVmcCgFmx+G0xI5vzIJuEQuJwxWDEIkK31pUfKyi222fcsDOpdpnpNcmD7QQG 2lVG8pRe6tmW8jc9UkNX9w==; Original-Received: from [87.69.77.57] (port=3463 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 1nWfYA-0000Tz-KW; Tue, 22 Mar 2022 10:31:54 -0400 In-Reply-To: <835yo6f5tu.fsf@gnu.org> (message from Eli Zaretskii on Tue, 22 Mar 2022 15:57:17 +0200) 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" Xref: news.gmane.io gmane.emacs.bugs:228758 Archived-At: > Date: Tue, 22 Mar 2022 15:57:17 +0200 > From: Eli Zaretskii > Cc: 54488@debbugs.gnu.org, dgutov@yandex.ru > > I think I see the problem. Stay tuned. I definitely see a problem with display strings with embedded newlines, but I don't think I understand how it affects your use case. Try this simple recipe: emacs -Q M-: (overlay-put (make-overlay 91 100) 'display "FOOBAR\nBAZQUUX") RET You should then see this in *scratch (I indented by 2 columns, so it stands out): ;; This buffer is for text that is not saved, and for Lisp evaluation. ;; To create a fileFOOBAR BAZQUUXt it with C-x C-f and enter text in its buffer. (with the "FOOBAR\nBAZQUUX" part intangible, i.e. you cannot put the cursor inside). Now go to the 't' at the end of "BAZQUUXt" and type "C-x =". In Emacs 28 and earlier you will see "column=28", in Emacs 29 you will see "column=32". This is because Emacs 28 ignores the display string and examines only the buffer text, which is "covered" by the display property. By contrast, Emacs 29 ignores the "covered" buffer text (since it's invisible on display) and examines only the characters of the display string. Since the newline has a width of zero, we get 9 columns between "file" and "t with" in Emacs 28, but 13 in Emacs 29. So yes, Emacs 29 behaves differently, but the important part is that both Emacs 28 and Emacs 29 are wrong: the _real_ column at 't' is 7 (columns are zero-based). IOW, both Emacs 28 and Emacs 29 fail to account for the fact that the newline inside the display string resets the column to zero. I could perhaps come up with a solution for that, and have the above snippet correctly return 7 as the column. But I don't see how this will help company-mode and/or Eglot, since the value returned by Emacs 28 makes no more sense than the value returned by Emacs 29. So I need your help with understanding what exactly fails in the original use case, due to this change. Specifically, how does the code involved in this use move-to-column/current-column when there are display strings with embedded newlines around? TIA