From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup Date: Fri, 14 Jul 2017 02:04:21 +0300 Message-ID: <860e76b5-513f-bfcd-e584-ea15cfa0772a@yandex.ru> References: <611468a0-3115-813a-7347-d0c06e155831@web.de> <83vanrx5uo.fsf@gnu.org> <362a7d18-7f05-2e99-f8b3-41c353cf234f@yandex.ru> <83h8zawvih.fsf@gnu.org> <00f59a24-2d80-ca47-b6f3-3d219aa5aa3f@yandex.ru> <8360fqvz9x.fsf@gnu.org> <6aa4616d-79f7-db1b-c048-076a9a48596f@yandex.ru> <83tw39urzq.fsf@gnu.org> <4c4b873b-2bec-1c12-82f5-325b558bea93@yandex.ru> <83o9tgul6h.fsf@gnu.org> <49b431fd-aaa4-e7ca-06fc-7146a0a5692c@yandex.ru> <83a84zul0d.fsf@gnu.org> <513eca6f-998a-a937-76c4-7cf2fb0ff787@yandex.ru> <83wp81u8rz.fsf@gnu.org> <83shipthve.fsf@gnu.org> <83fueotasd.fsf@gnu.org> <838tkgt8dp.fsf@gnu.org> <8337aot0fk.fsf@gnu.org> <35924ed4-65fc-6180-8a02-8158a192b4c2@yandex.ru> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1499987194 13203 195.159.176.226 (13 Jul 2017 23:06:34 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 13 Jul 2017 23:06:34 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:54.0) Gecko/20100101 Thunderbird/54.0 Cc: alexanderm@web.de, 27427@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jul 14 01:06:29 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dVnBe-0002mZ-GE for geb-bug-gnu-emacs@m.gmane.org; Fri, 14 Jul 2017 01:06:22 +0200 Original-Received: from localhost ([::1]:34619 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVnBk-0003FM-0f for geb-bug-gnu-emacs@m.gmane.org; Thu, 13 Jul 2017 19:06:28 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59152) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVnAR-0002eX-Oh for bug-gnu-emacs@gnu.org; Thu, 13 Jul 2017 19:05:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVnAM-0007m5-Mz for bug-gnu-emacs@gnu.org; Thu, 13 Jul 2017 19:05:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34835) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dVnAM-0007lw-JH for bug-gnu-emacs@gnu.org; Thu, 13 Jul 2017 19:05:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dVnAM-0007R4-8I for bug-gnu-emacs@gnu.org; Thu, 13 Jul 2017 19:05:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Jul 2017 23:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27427 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 27427-submit@debbugs.gnu.org id=B27427.149998707128537 (code B ref 27427); Thu, 13 Jul 2017 23:05:02 +0000 Original-Received: (at 27427) by debbugs.gnu.org; 13 Jul 2017 23:04:31 +0000 Original-Received: from localhost ([127.0.0.1]:37512 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dVn9r-0007QD-HU for submit@debbugs.gnu.org; Thu, 13 Jul 2017 19:04:31 -0400 Original-Received: from mail-wr0-f179.google.com ([209.85.128.179]:33141) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dVn9q-0007Q0-4s for 27427@debbugs.gnu.org; Thu, 13 Jul 2017 19:04:30 -0400 Original-Received: by mail-wr0-f179.google.com with SMTP id r103so59754987wrb.0 for <27427@debbugs.gnu.org>; Thu, 13 Jul 2017 16:04:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=uXvaPFDCYBW2YMfVdSEzwCw36sLMePxRyYavR5qozUI=; b=LsyPcwjX6Az+YV1Loc+Mk7S4lguBBvx00fCvWCe/AthelK/dAZI922DrvFaSrFub2z F5itkdLdm+qgkGHdI3iNzE/NcS+u6SUmRSSvi+xNqnu0MOq6GGD2Ylz8Yods81aLNEtv QC+3KpKiJ4DNdzsnqsxINyfK4QOywd1rQwt2WDKKU9oLpAcoSYijU23pRP41CCXhYvC0 11AM9ej31JN9cB0aY25QV27sMjo5ZF9kZwpX7PCsOz/mMNZnT/T8kuqJxVSKXGAsI8el LAe0LMoooVNsVkcPEiOIsF2rlIhwolzlC9fY67Hl5oZGpxJjuQ+jAUjCQQyhBl76DpjO Vn7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:cc:references:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=uXvaPFDCYBW2YMfVdSEzwCw36sLMePxRyYavR5qozUI=; b=OCPmTJOKz1EkI9Nk+wBERqQkh4TJqFygCQE3WZiL1tdVBObQw/Gztn1bH9g4JNU33f 7I4QTdZEJmBjUvwxMJOLW3LUW9vDxf+fFHtukqHzSxGt70OCxnd/tK4UZXW2PwcS49wT jkSawmoWx+APpkp5MA9NWCzvkyYUzaOhNbt//gaVSLf7yybfGpIhjOnd4M03qD6kRJAX mbwGDGc9ZTgTo4zsziBda7HFQtaF9HOcIp5vtQ3salJ2EyLpZQGEVWz0T/B7N4WtkbvS 0l7cPlZ82oeKh0ir4dw/SUnoMbeb8JMZesxEGsvUBtzp6iwfXYcX3rGrmF067BfyaWKZ YMwQ== X-Gm-Message-State: AIVw113RD17Oo2cfByHG9WR9vbAY4r/ZnAky9jxOP+XF0klFYjcsuSfD iQsvwYfVtl8XFIQQgi4= X-Received: by 10.223.154.10 with SMTP id z10mr2490186wrb.73.1499987064239; Thu, 13 Jul 2017 16:04:24 -0700 (PDT) Original-Received: from [192.168.1.3] ([185.105.174.193]) by smtp.googlemail.com with ESMTPSA id q17sm842219wmd.4.2017.07.13.16.04.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 16:04:22 -0700 (PDT) In-Reply-To: <35924ed4-65fc-6180-8a02-8158a192b4c2@yandex.ru> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:134522 Archived-At: On 6/26/17 1:56 AM, Dmitry Gutov wrote: > On 6/25/17 8:57 PM, Eli Zaretskii wrote: > >> Should be fixed now. > > Thanks, both cases are working well now. ...and either something changed before the merge into master, or I tested the result poorly. Probably the latter. What doesn't work well is that the popup "background" gets displaced to the left by the width of the numbers column, when rendered using the popup overlay. Background meaning the contents of all the lines behind the popup. And that happens because the line number glyphs are gone for those specific lines, and we can't pad them without knowing the width of the numbers column. Now, I've come upon this idea of a trivial patch. What do you think, Eli? It seems to work perfectly, even though I'm struggling to understand how this might happen under the covers. Is it brittle? We bind display-line-numbers to nil around the call to posn-at-point, so that it calculates the column value that we want. I imagine there's some extra redisplay work involved, but it still turns out to be faster than calling posn-at-point twice. diff --git a/company.el b/company.el index f361bb7..869c5de 100644 --- a/company.el +++ b/company.el @@ -835,7 +835,8 @@ means that `company-mode' is always turned on except in `message-mode' buffers." (cons (+ col (window-hscroll)) row))) (defun company--col-row (&optional pos) - (company--posn-col-row (posn-at-point pos))) + (let (display-line-numbers) + (company--posn-col-row (posn-at-point pos)))) (defun company--row (&optional pos) (cdr (company--col-row pos)))