emacs-devel
[Top][All Lists]
Advanced

[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: Eli Zaretskii
Subject: Re: Obtain X / HPOS with move_it_to at eol when buffer-display-table line-feed
Date: Tue, 29 Aug 2017 17:59:31 +0300

> Date: Tue, 29 Aug 2017 00:01:16 -0700
> From: Keith David Bershatsky <address@hidden>
> 
> 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?

I'm sorry, I don't really understand what is it that you are trying to
accomplish.  Can you tell more about the goals of this code?  Also
what exactly isn't working as you expected?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]