all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Keith David Bershatsky <esq@lawlist.com>
Cc: emacs-devel@gnu.org
Subject: Re: How to calculate X when dealing with truncate-lines non-nil.
Date: Fri, 29 Sep 2017 19:25:44 +0300	[thread overview]
Message-ID: <83poa979pz.fsf@gnu.org> (raw)
In-Reply-To: <m2o9pu4tm9.wl%esq@lawlist.com> (message from Keith David Bershatsky on Thu, 28 Sep 2017 10:31:58 -0700)

> 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.



  reply	other threads:[~2017-09-29 16:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-09-30 16:32 Keith David Bershatsky
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=83poa979pz.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=esq@lawlist.com \
    /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.