From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Keith David Bershatsky Newsgroups: gmane.emacs.devel Subject: Re: Is there an IT test for a tab-width spacer? Date: Sat, 28 Oct 2017 10:10:02 -0700 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1509210634 22691 195.159.176.226 (28 Oct 2017 17:10:34 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 28 Oct 2017 17:10:34 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 28 19:10:27 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 1e8Ucr-0004oN-Mz for ged-emacs-devel@m.gmane.org; Sat, 28 Oct 2017 19:10:26 +0200 Original-Received: from localhost ([::1]:33486 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e8Ucv-0006wX-S3 for ged-emacs-devel@m.gmane.org; Sat, 28 Oct 2017 13:10:29 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42142) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e8Uco-0006wM-7N for emacs-devel@gnu.org; Sat, 28 Oct 2017 13:10:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e8Uck-0008B0-Jp for emacs-devel@gnu.org; Sat, 28 Oct 2017 13:10:21 -0400 Original-Received: from gateway24.websitewelcome.com ([192.185.51.31]:35807) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e8Uck-0007wQ-85 for emacs-devel@gnu.org; Sat, 28 Oct 2017 13:10:18 -0400 Original-Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway24.websitewelcome.com (Postfix) with ESMTP id 98BC57681 for ; Sat, 28 Oct 2017 12:10:04 -0500 (CDT) Original-Received: from gator3053.hostgator.com ([50.87.144.69]) by cmsmtp with SMTP id 8UcWe29D8c72g8UcWe1F3v; Sat, 28 Oct 2017 12:10:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com ; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Cc :To:From:Message-ID:Date:Sender:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=3JATWwumVV1x1d1nNHpbHOHMFbPuZ9JsvwrHY/OVM0M=; b=KrKacWZMCY+OPbUJnjLTqpDJ7y sSUZrtRwkitWk10f+uCq251xtm53jNxRwU3HRTXSZ53WMgAWgr5L4CQHz4rMIqJYMHZB/CXt5gOV4 8PnTfZfGHgnY4Vo6xvY/zuf18xy6YOWL1xsTS9L3C44ruwMpPE51ylx5WEgPdDG1a7IHvHqriCcQQ RpfEFpZAd187qVD1meKXCI2ALETyEpjT4yc40puJAHlfUgy9gMDH2quo1HWW4Hl9Z7jW3qEuCA4Dn GDK9VWjCpC8XhB0uq4b61Bp5SV4MoXxIV5i4K216gYveU4/D2GnxVmfXAPVRZaq6K7T1rgmDvqypk uvyGkI0g==; Original-Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:49991 helo=server.private) by gator3053.hostgator.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.87) (envelope-from ) id 1e8UcV-0001hu-MF; Sat, 28 Oct 2017 12:10:03 -0500 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3053.hostgator.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-BWhitelist: no X-Source-IP: 45.48.239.195 X-Source-L: No X-Exim-ID: 1e8UcV-0001hu-MF X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: cpe-45-48-239-195.socal.res.rr.com (server.private) [45.48.239.195]:49991 X-Source-Auth: lawlist X-Email-Count: 1 X-Source-Cap: bGF3bGlzdDtsYXdsaXN0O2dhdG9yMzA1My5ob3N0Z2F0b3IuY29t X-Local-Domain: yes X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 192.185.51.31 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:219802 Archived-At: Thank you, Eli, for looking at this particular thread. The following link contains a screen-shot of crosshairs at its present st= age of development: https://www.lawlist.com/images/tab_width_01.png * The tab-width used in this example is 8. * Tab is defined in the buffer-display-table as [?=C2=BB ?\t]. My goal is to create solid horizontal and vertical lines spanning the win= dow-body-width and window-body-height that tracks PT. In the screen-shot, we can see that the spacer used for tabs is not alway= s 8. The tab to the immediate right of PT looks like it has a width of 4= . As we move IT, I would like to know if we can programmatically determine = the width of that adjustable space [associated with a tab] and the corres= ponding X and HPOS of the next character. [Once those values are known, = I can place fake cursors along that adjustable space.] Do we have to move forwards to the next character to know what the width = of that adjustable space was, or can we obtain that width while IT is sti= ll at the tab. Thanks, Keith ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DATE: [10-25-2017 08:02:27] <25 Oct 2017 18:02:27 +0300> FROM: Eli Zaretskii >=20 > > Date: Tue, 24 Oct 2017 17:59:47 -0700 > > From: Keith David Bershatsky > >=20 > > it.c lets us know whether we are on the initial tab that has been ass= igned a character by the user with the buffer-display-table, e.g., 187/=C2= =BB. > >=20 > > 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). > >=20 > > I am having trouble calculating the X and HPOS for each and every loc= ation between the initial tab and the next textual character. A buffer-d= isplay-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-wi= dth 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 buf= fer-local tab-width value, it seemingly becomes more difficult to predict= the X and HPOS. >=20 > 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? >=20 > 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? >=20 > Can you show an example of a buffer where this issue arises? >=20 > (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.) >=20 > > Inching along with a test similar to line 22682 in xdisp.c seems insu= fficient for this particular project: while (it.current_x + it.pixel_wid= th <=3D target_x). > >=20 > > To analyze the width of the spacer and calculate the X and HPOS for e= ach location within that space, is it necessary to go to the next charact= er and then mathematically determine what the previous tab-width was? >=20 > Sorry, I cannot answer these questions, because I don't understand > what you are trying to accomplish.