emacs-devel
[Top][All Lists]
Advanced

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

Re: How to calculate X when dealing with truncate-lines non-nil.


From: Eli Zaretskii
Subject: Re: How to calculate X when dealing with truncate-lines non-nil.
Date: Fri, 29 Sep 2017 19:25:44 +0300

> Date: Thu, 28 Sep 2017 10:31:58 -0700
> From: Keith David Bershatsky <address@hidden>
> 
> I believe this issue is resolvable mathematically as follows:
> 
>     int x;
>     if (it.line_wrap == TRUNCATE)
>       x = it.current_x - it.first_visible_x;
>       else
>         x = it.current_x;
> 
> Unless anyone sees a problem with this method, the issue is resolved.

This could be a solution in some cases.  The real answer depends on
what exactly does your code do, something that you didn't disclose.

In any case, I think that the 'it.line_wrap == TRUNCATE' condition is
not needed: if you want the window-relative X coordinate, you should
always subtract the first_visible_x value: if it's zero, no harm will
be done.



reply via email to

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