From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: bug#9782: 24.0.90; move-to-window-line not taking header line into account Date: Sat, 16 Aug 2014 03:33:44 +0400 Message-ID: <53EE98D8.5010605@gmail.com> References: <83mxcyuw60.fsf@gnu.org> <87haiiqwiz.fsf@yandex.ru> <83vc6yf8hr.fsf@gnu.org> <5185CB24.5060207@yandex.ru> <83sj21fmo5.fsf@gnu.org> <518725C3.10107@yandex.ru> <83bo8of4hp.fsf@gnu.org> <51885853.7020803@yandex.ru> <83txmfebzp.fsf@gnu.org> <5188B00C.2080600@yandex.ru> <83ip2uentg.fsf@gnu.org> <518937BF.1070500@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1408145662 3015 80.91.229.3 (15 Aug 2014 23:34:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 15 Aug 2014 23:34:22 +0000 (UTC) Cc: emacs-devel@gnu.org To: Dmitry Gutov , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Aug 16 01:34:17 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XIR0i-0007es-3q for ged-emacs-devel@m.gmane.org; Sat, 16 Aug 2014 01:34:16 +0200 Original-Received: from localhost ([::1]:33678 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIR0h-0003V7-Eo for ged-emacs-devel@m.gmane.org; Fri, 15 Aug 2014 19:34:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53231) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIR0N-0003MM-HR for emacs-devel@gnu.org; Fri, 15 Aug 2014 19:34:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XIR0I-00023W-34 for emacs-devel@gnu.org; Fri, 15 Aug 2014 19:33:55 -0400 Original-Received: from mail-lb0-x232.google.com ([2a00:1450:4010:c04::232]:61796) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIR0H-00023F-Ql; Fri, 15 Aug 2014 19:33:49 -0400 Original-Received: by mail-lb0-f178.google.com with SMTP id c11so2416365lbj.23 for ; Fri, 15 Aug 2014 16:33:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=PZpPN53PofVvV0qWXa2opL7GIrQxoyewx/APwfLb7Ts=; b=nuBSASEx/iBqJ8lZsCQthcfjx5AJ7CB4caCqt0n2Xk1Fp7XcEm1a3TE+v/cJEpdrqq 9lCcY7tt/Qs8W4SWSPaXF+C8cJgY75iUIDM3V2lYO+kRhrdXnOZEpP2r8YKqR91Edjrq XLxDdYCmxJC9FYpsO4Bbt3zKm51mWQ8t3NyK6PKaGMtjziRjs/YQCnwCWAJHPAsWMNvH eP7qv8C9HM6bBUGNUPi9wUTk9U7i4OTHC0A0eJmhO52ZzJjRr/VRwdgOBX1nStLDtimE LtLMOWjxcVARWvNTMiex25HbXeDCV0+QPPI21x6VZpHmTsaMfLl8JOC4275LKvRGnmJo r6Yg== X-Received: by 10.152.170.196 with SMTP id ao4mr14533190lac.44.1408145628208; Fri, 15 Aug 2014 16:33:48 -0700 (PDT) Original-Received: from [192.168.1.3] ([178.252.98.87]) by mx.google.com with ESMTPSA id pv6sm14781606lbb.32.2014.08.15.16.33.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Aug 2014 16:33:47 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 In-Reply-To: <518937BF.1070500@yandex.ru> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::232 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:173697 Archived-At: Hi again, If you don't mind, I'd like to renew this discussion for a bit. On 05/07/2013 09:19 PM, Dmitry Gutov wrote: > On 07.05.2013 20:50, Eli Zaretskii wrote: >>> I mean fixing the row number <-> line number discrepancy from the other >>> side, by making a wrapper for `move-to-window-line', the only function >>> of the bunch that deals with line numbers. It's used in >>> `company-pseudo-tooltip-show'. >> >> count-screen-lines also deals with line numbers. > > Yes, but that would be fixing the discrepancy from the other side, and > then `company--row', reimplemented using `count-screen-lines', would > conflict with row values from mouse events, so this will only work when > we don't need to compare them (i.e. when using multiple overlays). Now we've used the following function to get the current line number, for a while: (defun company--row (&optional pos) (save-excursion (when pos (goto-char pos)) (count-screen-lines (window-start) (progn (vertical-motion 0) (point))))) It has a fundamental problem: it doesn't deal well with `display'; this is most apparent in the `M-x report-emacs-bug' buffer, leading to bugs like this: https://github.com/company-mode/company-mode/issues/136 The actual behavior is a bit different in my Emacs compared to the screenshot, but the problem is there. Since `vertical-motion' doesn't jump into the "virtual" text inside the multiline `display' property, `company--row' returns lower values than it should. `move-to-window-line' takes multiline `display' into account just fine, so (move-to-window-line (company--row)) might move to a different line than the point is at. Do you have any further suggestions? Should we revert to using `posn-col-row'? Maybe I could do an alternative implementation of `move-to-window-line' that disregards multiline `display' the same way, using `vertical-motion', but this approach would probably cause buffer text jumping when the popup is displayed in more cases than the `posn-col-row' one.