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 obtain x/y/hpos/vpos at eol -- excluding overlay 'after-string.
Date: Tue, 05 Apr 2016 18:08:09 +0300	[thread overview]
Message-ID: <83shz0m6ue.fsf@gnu.org> (raw)
In-Reply-To: <m2oa9paxtr.wl%esq@lawlist.com> (message from Keith David Bershatsky on Mon, 04 Apr 2016 14:06:08 -0700)

> Date:  Mon, 04 Apr 2016 14:06:08 -0700
> From:  Keith David Bershatsky <esq@lawlist.com>
> 
> There are a couple of applications where this would be useful.
> 
> The first application is a common function available interactively called `posn-at-point` which cannot return the desired `x` and `hpos` when an 'after-string is present at point.  For example, line-move-visual in simple.el has never worked correctly when I have overlay 'after-string at the end of the line.  So, I have been using a workaround with `vertical-motion` to calculate the desired `temporary-goal-column`.  Here is the link to a thread on emacs.stackexchange.com from about a year ago relating to this issue:
> 
> http://emacs.stackexchange.com/questions/7957/calculating-cursor-position-excluding-the-overlay-after-string

Your original request was about doing this on the C level, so the
above use case is not really related: line-move-visual is implemented
in Lisp.

> The second application is related to feature request 22873 (multiple fake cursors) and a dormant (yet related) feature request 17684 (drawing a vertical line the length of the window).  I have not been able to accurately predict programmatically where the fake cursors are located subsequent to the screen scrolling when overlay 'after-string are present.  [I spent a day writing up a function to calculate the differential of `y` and `vpos` based on previous and current window-start/end, only to discover that the Little Rascals (fake cursors) were still somewhere else when scrolling.]  The function `erase_phys_cursor` redraws the character (where the cursor was) based upon (in part) the values of x/y/hpos/vpos.  Until I can figure out how to accurately predict where those Little Rascals (fa
 ke cursors) have gone to when scrolling occurs, the easiest thing to do is erase/redraw everything along the `x` axis.  `erase_phys_cursor` should not be used, however, when there is no TEXT along the `x` axis - because that yields strange looking glyphs along the right side of the screen.  Before calling `erase_phys_cursor` (or my custom function `mc_erase`), I want to check to see where the end of the visual line is -- i.e., x/y/hpos/vpos at the end of each visual line -- and only erase/redraw characters when the `x` axis is less than the end of the visual line

This is indeed about something you do in C.  However, I don't
understand why you try using posn-at-point, which is a Lisp API, for a
job you need to do in C.  On the C level, you have access to a more
elaborate information, e.g. you can examine the object at point and do
something when it is an overlay string.

I must admit I still don't see clearly why you need screen coordinates
corresponding to a buffer position, in the multiple-curses scenario.
Isn't it your code that positions those cursors in the first place?
If so, why do you need to find out where those cursors are, if your
code did the positioning?



       reply	other threads:[~2016-04-05 15:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <m2oa9paxtr.wl%esq@lawlist.com>
2016-04-05 15:08 ` Eli Zaretskii [this message]
2016-04-07  6:45 How to obtain x/y/hpos/vpos at eol -- excluding overlay 'after-string Keith David Bershatsky
  -- strict thread matches above, loose matches on Subject: below --
2016-04-05 17:37 Keith David Bershatsky
2016-04-06 17:40 ` Eli Zaretskii
2016-04-05  0:17 Keith David Bershatsky
2016-04-04 19:39 Keith David Bershatsky
2016-04-04 20:30 ` 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=83shz0m6ue.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.