[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Obtain X / HPOS with move_it_to at eol when buffer-display-table line-fe
From: |
Keith David Bershatsky |
Subject: |
Obtain X / HPOS with move_it_to at eol when buffer-display-table line-feed |
Date: |
Tue, 29 Aug 2017 00:01:16 -0700 |
I am working on my own feature requests 17684 (thin vertical line) and 22873
(multiple fake cursors).
I am having difficulty calculating the X and HPOS using move_it_to when a
buffer-display-table contains an entry for a line feed (aka \n). I am looking
for a more eloquent way of of handling this instead of subtracting the
frame-char-width from it.current.pos, and also subtracting 1 from
it.current.hpos. We can test the buffer-display-table with something like
(aref buffer-display-table ?\n), which in my use-case yields [(182 . 127) 10]
because I also use face to color the eol character.
We test for a line feed with: FETCH_BYTE (IT_BYTEPOS (it)) == '\n'
We move to POS using:
move_it_to (&it, POS, it.last_visible_x, it.last_visible_y - 1, -1, MOVE_TO_POS
| MOVE_TO_X | MOVE_TO_Y);
Is there a better way to handle this instead of subtracting frame-char-width
from X and subtracting 1 from HPOS?
Thanks,
Keith
- Obtain X / HPOS with move_it_to at eol when buffer-display-table line-feed,
Keith David Bershatsky <=