From: Keith David Bershatsky <esq@lawlist.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: How to calculate X when dealing with truncate-lines non-nil.
Date: Sat, 30 Sep 2017 09:32:37 -0700 [thread overview]
Message-ID: <m2wp4gp2oq.wl%esq@lawlist.com> (raw)
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 <eliz@gnu.org>
>
> > Date: Thu, 28 Sep 2017 10:31:58 -0700
> > From: Keith David Bershatsky <esq@lawlist.com>
> >
> > 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.
next reply other threads:[~2017-09-30 16:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-30 16:32 Keith David Bershatsky [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-09-28 17:31 How to calculate X when dealing with truncate-lines non-nil Keith David Bershatsky
2017-09-29 16:25 ` Eli Zaretskii
2017-09-28 3:16 Keith David Bershatsky
2017-09-29 16:13 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2wp4gp2oq.wl%esq@lawlist.com \
--to=esq@lawlist.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.