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: Is there an IT test for a tab-width spacer? Date: Wed, 25 Oct 2017 18:02:27 +0300 Message-ID: <83k1zj8e4c.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1508943831 24583 195.159.176.226 (25 Oct 2017 15:03:51 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 25 Oct 2017 15:03:51 +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 Wed Oct 25 17:03:46 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 1e7NDT-0004hP-Ei for ged-emacs-devel@m.gmane.org; Wed, 25 Oct 2017 17:03:35 +0200 Original-Received: from localhost ([::1]:48711 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7NDa-0004fV-SH for ged-emacs-devel@m.gmane.org; Wed, 25 Oct 2017 11:03:42 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54730) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7NCf-0004cg-S1 for emacs-devel@gnu.org; Wed, 25 Oct 2017 11:02:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7NCa-0004Lc-4O for emacs-devel@gnu.org; Wed, 25 Oct 2017 11:02:45 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:39637) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7NCa-0004LU-0a; Wed, 25 Oct 2017 11:02:40 -0400 Original-Received: from [176.228.60.248] (port=4887 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1e7NCZ-0008LR-Er; Wed, 25 Oct 2017 11:02:39 -0400 In-reply-to: (message from Keith David Bershatsky on Tue, 24 Oct 2017 17:59:47 -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:219753 Archived-At: > Date: Tue, 24 Oct 2017 17:59:47 -0700 > From: Keith David Bershatsky > > it.c lets us know whether we are on the initial tab that has been assigned a character by the user with the buffer-display-table, e.g., 187/ยป. > > it.c also lets us know whether we have moved beyond that location to a tab without a character; i.e., 9, aka (char-to-string 9). > > I am having trouble calculating the X and HPOS for each and every location between the initial tab and the next textual character. A buffer-display-table for a tab that is assigned a leading 187 followed by a 9 has a minimum tab-width of 2. Even though the buffer-local value for tab-width may be 2, that combination of 187/9 might be a total of 3 characters wide depending upon the circumstances. And as the user increases the buffer-local tab-width value, it seemingly becomes more difficult to predict the X and HPOS. I'm sorry, but I don't understand your description: you use terminology which I cannot decipher. What is "the initial tab"? "initial" in what sense? Also, what do you mean by calculate position "for each and every location between the initial tab and the next character"? What are those locations, and why do you need the coordinates of each one of them? Can you show an example of a buffer where this issue arises? (I think you are making a mistake looking at it.c, you should look at it.char_to_display instead. The former is the character found in the buffer or string, the latter is what actually needs to be displayed, and it could be different, e.g., due to display-table in effect.) > Inching along with a test similar to line 22682 in xdisp.c seems insufficient for this particular project: while (it.current_x + it.pixel_width <= target_x). > > To analyze the width of the spacer and calculate the X and HPOS for each location within that space, is it necessary to go to the next character and then mathematically determine what the previous tab-width was? Sorry, I cannot answer these questions, because I don't understand what you are trying to accomplish.