emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug#9782: 24.0.90; move-to-window-line not taking header line into a


From: Eli Zaretskii
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

> Date: Sat, 16 Aug 2014 03:33:44 +0400
> From: Dmitry Gutov <address@hidden>
> CC: address@hidden
> 
> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]