[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Obtain X / HPOS with move_it_to at eol when buffer-display-table lin
From: |
Keith David Bershatsky |
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 |
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 <address@hidden>
>
> * * *
>
> 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.
>
> * * *