From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= 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 14:54:13 +0000 Message-ID: <87r16uavhm.fsf@gmail.com> 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> <834k3qf48k.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39021"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 54488@debbugs.gnu.org, dgutov@yandex.ru To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 22 15:54:20 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 1nWfts-000A0C-6C for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 22 Mar 2022 15:54:20 +0100 Original-Received: from localhost ([::1]:55018 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nWftq-000559-MB for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 22 Mar 2022 10:54:18 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:54072) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nWfta-00054y-3u for bug-gnu-emacs@gnu.org; Tue, 22 Mar 2022 10:54:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47704) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nWftZ-0001ap-RS for bug-gnu-emacs@gnu.org; Tue, 22 Mar 2022 10:54:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nWftZ-0005vt-OA for bug-gnu-emacs@gnu.org; Tue, 22 Mar 2022 10:54:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 Mar 2022 14:54: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.164796080222759 (code B ref 54488); Tue, 22 Mar 2022 14:54:01 +0000 Original-Received: (at 54488) by debbugs.gnu.org; 22 Mar 2022 14:53:22 +0000 Original-Received: from localhost ([127.0.0.1]:41601 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nWfsv-0005uy-Tw for submit@debbugs.gnu.org; Tue, 22 Mar 2022 10:53:22 -0400 Original-Received: from mail-wm1-f52.google.com ([209.85.128.52]:54007) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nWfsu-0005uj-0z for 54488@debbugs.gnu.org; Tue, 22 Mar 2022 10:53:20 -0400 Original-Received: by mail-wm1-f52.google.com with SMTP id i186so1973967wma.3 for <54488@debbugs.gnu.org>; Tue, 22 Mar 2022 07:53:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=qoq1GguYKKRL1avfwYFsNps4DfUZF0OKDCWJ4b//sPA=; b=UTJvjqOv9eldVSA7ls71EHDmdudSAvihXa2GEV2D220dMdtPWUEWVTwpwx1UUbp0bD 0tsCBq+xpkXGCm3dIskRIT/ZdnMutQSTS2g6ezC4wy0Tr/i/9nrHnSvJjIIXJJI1UZi3 pe6nEmsg6gZTMAqERihWphE4y/39RDlWe24QILKuqFRb6THIXv+htHP/2yGlECFdqJ4w npixA4T59LWwbURc3q0bKNnjug3MB783kSdqnjwYguHv2cl4hDAiAvHF+ndyyMmzbrp8 sASL9J7nja685TxtDwIOG1cB9pH8q/AsE+upSd1X3bYokRhwKpb3e4ib3WXMxvsga51n O7Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=qoq1GguYKKRL1avfwYFsNps4DfUZF0OKDCWJ4b//sPA=; b=CwWQY/NBBTuilT2oXuQMtJqyCGXQuALEpMwmXJCKaAEd8BY+tnNXzb5vsP4Vgt/rR+ wMzxZsG7cLs92BKykyfwdP21OAqz/FBsu0VgBivXhAiXuz99rxoidI4YQNWwURhGsNyu GAsGOxtl51hAkEUW0s0yv1IIvX2MS9BNB5IEbp/qdp5uYwPgMCSMXW23houd996pW3Ey +JChfRgNBoHnv6ineVvp5BOMVU2M6cO818hZ8/U/DNvN3+Y55E65DbRSP0mmNixQedgP 44jGMLHhk7XtRGODdIF5VnmvqZxTGqpWW+BYiyw59s9C+XniIOSIg1Yn9a13Af+KkK8m En2Q== X-Gm-Message-State: AOAM531uRCf8wXKyCg/+GaeMn6eJz9J5Ga3jPQ48htH4bBO8SS5LF+PK 0SrPjq9h97Uc25LDVQjruMcp7uXkIJk= X-Google-Smtp-Source: ABdhPJz8RN0Qi/LWyS0CnX5jOA32EAPiykJqKApmarI8+LUa437dF8MhCPbRzyfftYrEnVbtLs/bAw== X-Received: by 2002:a1c:2744:0:b0:382:a9b7:1c8a with SMTP id n65-20020a1c2744000000b00382a9b71c8amr4096436wmn.187.1647960793677; Tue, 22 Mar 2022 07:53:13 -0700 (PDT) Original-Received: from krug ([87.196.73.24]) by smtp.gmail.com with ESMTPSA id o14-20020a5d47ce000000b00203e0a21c16sm18885051wrc.3.2022.03.22.07.53.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Mar 2022 07:53:13 -0700 (PDT) In-Reply-To: <834k3qf48k.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 22 Mar 2022 16:31:39 +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:228763 Archived-At: Eli Zaretskii writes: > 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? I think I alluded to/explained this in the original bug report. I'll try again: eglot needs just move-to-column that it runs in a narrowed region containing only the line and obtain an upper bound of the "LSP-abiding" column that the LSP server means (unfortunately the LSP-abiding column may differ from Emacs's understanding of columns because of different assumpting regarding length of character encodings). Eglot then gets (point) and tries "encode-coding-string" to measure things. In Emacs 29, before the fix, that (point) seems to -- very surprisingly -- return something beyond the narrowed region and so encode-coding-string will complain with args out of range. In the example I gave you, that narrowed region, (point-max) is 176. - that (point) form returns 179 in Emacs 29 -- error obviously. - that (point) form returns 167 in Emacs 27 -- no error. This is the code more or less in Eglot: (defun eglot-move-to-lsp-abiding-column (column) "Move to COLUMN abiding by the LSP spec." (save-restriction (cl-loop with lbp =3D (line-beginning-position) initially (narrow-to-region lbp (line-end-position)) (move-to-column column) for diff =3D (- column (/ (- (length (encode-coding-region (or lbp (line-beginn= ing-position)) (point) 'utf-16 t)) 2) 2)) until (zerop diff) do (condition-case eob-err (forward-char (/ (if (> diff 0) (1+ diff) (1- diff)) 2)) (end-of-buffer (cl-return eob-err)))))) Jo=C3=A3o