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: Keith David Bershatsky
Subject: Re: How to calculate X when dealing with truncate-lines non-nil.
Date: Sat, 30 Sep 2017 09:32:37 -0700

Thank you, Eli, for helping me to simplify the code for the window-relative X 
coordinate.  I have implemented the suggested revision.

I now have a working draft of crosshairs for all three situations (i.e., 
TRUNCATE, WINDOW_WRAP, and WORD_WRAP) by using a combination of window-relative 
X *and* the absolute IT X.  Drawing/erasing multiple fake cursors is done with 
the former, whereas decision making is based on the latter.

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

DATE:  [09-29-2017 09:25:44] <29 Sep 2017 19:25:44 +0300>
FROM:  Eli Zaretskii <address@hidden>
> 
> > 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]