all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Keith David Bershatsky <esq@lawlist.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Obtain X / HPOS with move_it_to at eol when buffer-display-table line-feed
Date: Wed, 30 Aug 2017 11:35:21 -0700	[thread overview]
Message-ID: <4lsorjiu.wl%esq@lawlist.com> (raw)

Fake cursors are created/erased by hijacking w->phys_cursor.x/y/hpos/vpos and calling either erase_phys_cursor or draw_window_cursor.  The creation of a glyph/character on top of the cursor is optional so that a floating cursor anywhere is possible if so desired.

With respect to eol pilcrows, move_it_to gives X and HPOS coordinates for an invisible \n to the right of the pilcrow.  We essentially have ¶\n, and IT cannot see the pilcrow.  The X and HPOS returned by move_it_to gives us ¶|\n instead of |¶\n.  Stated another way, X and HPOS are reported as being on the end of the pilcrow, instead of the beginning of the pilcrow.

My preference would be to continue using the built-in method for drawing/erasing cursors -- i.e., let erase_phys_cursor and draw_window_cursor do all the work for us, and we only need to give them precise coordinates (x/y/hpos/vpos).

Perhaps there is some way to help move_it_to see the pilcrow, or at least pretend that it exists?

  /* EXAMPLES of (aref buffer-display-table ?\n):  [(182 . 127) 10]; [182 10]; [10] */
  Lisp_Object buffer_display_table = BVAR (b, display_table);
  bool buffer_display_table_p = !NILP (buffer_display_table);
  Lisp_Object line_feed_vector;
  if (buffer_display_table_p)
    line_feed_vector = Faref (buffer_display_table, make_number (10));
  /* Reset it.current_x and it.hpos to the desired locations. */
  if (FETCH_BYTE (IT_BYTEPOS (it)) == '\n'
      && buffer_display_table_p
      && VECTORP (line_feed_vector)
      && ASIZE (line_feed_vector) > 1)
   {
     it.current_x = ABRACADABRA_X;
     it.hpos = ABRACADABRA_HPOS;
   }

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

DATE:  [08-30-2017 09:51:56] <30 Aug 2017 19:51:56 +0300>
FROM:  Eli Zaretskii <eliz@gnu.org>
> 
> * * *
> 
> When you say "X POS for any particular eol pilcrow", do you mean the x
> coordinate of the beginning of the pilcrow or of its end?
> 
> And what do you get instead when you use move_it_to like you show?
> 
> Also, why do you care about the exact coordinate of the pilcrow?  You
> could simply reach it and then do there whatever you want, no matter
> what is the coordinate.
> 
> * * *



             reply	other threads:[~2017-08-30 18:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-30 18:35 Keith David Bershatsky [this message]
2017-08-30 19:03 ` Obtain X / HPOS with move_it_to at eol when buffer-display-table line-feed Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2017-08-31 16:07 Keith David Bershatsky
2017-08-31 16:17 ` Eli Zaretskii
2017-08-29 18:51 Keith David Bershatsky
2017-08-30 16:51 ` Eli Zaretskii
2017-08-29  7:01 Keith David Bershatsky
2017-08-29 14:59 ` 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=4lsorjiu.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.