From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii 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 11:03:44 +0300 Message-ID: <83oavkeu8v.fsf@gnu.org> 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> <53EE98D8.5010605@gmail.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1408176272 5586 80.91.229.3 (16 Aug 2014 08:04:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 16 Aug 2014 08:04:32 +0000 (UTC) Cc: emacs-devel@gnu.org, dgutov@yandex.ru To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Aug 16 10:04:23 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 1XIYyI-0006L8-Cv for ged-emacs-devel@m.gmane.org; Sat, 16 Aug 2014 10:04:18 +0200 Original-Received: from localhost ([::1]:34677 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIYyF-0003Fq-Ht for ged-emacs-devel@m.gmane.org; Sat, 16 Aug 2014 04:04:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41275) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIYy7-0003Eq-Jn for emacs-devel@gnu.org; Sat, 16 Aug 2014 04:04:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XIYxz-0008AA-Sx for emacs-devel@gnu.org; Sat, 16 Aug 2014 04:04:07 -0400 Original-Received: from mtaout26.012.net.il ([80.179.55.182]:49705) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIYxz-0008A1-EM for emacs-devel@gnu.org; Sat, 16 Aug 2014 04:03:59 -0400 Original-Received: from conversion-daemon.mtaout26.012.net.il by mtaout26.012.net.il (HyperSendmail v2007.08) id <0NAE00K002R2KT00@mtaout26.012.net.il> for emacs-devel@gnu.org; Sat, 16 Aug 2014 11:02:30 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout26.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NAE00EB93O6FS80@mtaout26.012.net.il>; Sat, 16 Aug 2014 11:02:30 +0300 (IDT) In-reply-to: <53EE98D8.5010605@gmail.com> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 80.179.55.182 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:173702 Archived-At: > Date: Sat, 16 Aug 2014 03:33:44 +0400 > From: Dmitry Gutov > CC: emacs-devel@gnu.org > > 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. I don't see this part in the bug discussion. Where did it take place? > 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'? If the only problem with posn-col-row is that it errs by one when there's a header line, adding one in that case sounds like an easy way out.