From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel 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 Message-ID: <83ziai2ze4.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1504018789 10241 195.159.176.226 (29 Aug 2017 14:59:49 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 29 Aug 2017 14:59:49 +0000 (UTC) Cc: emacs-devel@gnu.org To: Keith David Bershatsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 29 16:59:44 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmhzP-0002A1-Ot for ged-emacs-devel@m.gmane.org; Tue, 29 Aug 2017 16:59:39 +0200 Original-Received: from localhost ([::1]:45372 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmhzW-0002Ks-G7 for ged-emacs-devel@m.gmane.org; Tue, 29 Aug 2017 10:59:46 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37493) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmhzP-0002KZ-LU for emacs-devel@gnu.org; Tue, 29 Aug 2017 10:59:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dmhzL-0005ho-RP for emacs-devel@gnu.org; Tue, 29 Aug 2017 10:59:39 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:41544) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmhzL-0005hk-O1; Tue, 29 Aug 2017 10:59:35 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4862 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dmhzL-00014A-1V; Tue, 29 Aug 2017 10:59:35 -0400 In-reply-to: (message from Keith David Bershatsky on Tue, 29 Aug 2017 00:01:16 -0700) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:217879 Archived-At: > Date: Tue, 29 Aug 2017 00:01:16 -0700 > From: Keith David Bershatsky > > 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?