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: Calculating screen relative X when horizontal scrolling. Date: Mon, 15 Oct 2018 15:25:06 -0700 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Trace: blaine.gmane.org 1539642227 32456 195.159.176.226 (15 Oct 2018 22:23:47 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 15 Oct 2018 22:23:47 +0000 (UTC) To: Emacs Devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 16 00:23:43 2018 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 1gCBH4-0008MP-AD for ged-emacs-devel@m.gmane.org; Tue, 16 Oct 2018 00:23:42 +0200 Original-Received: from localhost ([::1]:55098 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCBJA-00086U-QN for ged-emacs-devel@m.gmane.org; Mon, 15 Oct 2018 18:25:52 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50494) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCBIY-00086O-Jg for emacs-devel@gnu.org; Mon, 15 Oct 2018 18:25:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gCBIT-0000M4-HY for emacs-devel@gnu.org; Mon, 15 Oct 2018 18:25:14 -0400 Original-Received: from gateway34.websitewelcome.com ([192.185.148.212]:42779) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gCBIT-0000HM-49 for emacs-devel@gnu.org; Mon, 15 Oct 2018 18:25:09 -0400 Original-Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway34.websitewelcome.com (Postfix) with ESMTP id DD1502B6657 for ; Mon, 15 Oct 2018 17:25:07 -0500 (CDT) Original-Received: from gator3053.hostgator.com ([50.87.144.69]) by cmsmtp with SMTP id CBIRgoB1qaSeyCBIRg97bP; Mon, 15 Oct 2018 17:25:07 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com ; s=default; h=Content-Type:MIME-Version:Subject:To:From:Message-ID:Date: Sender:Reply-To:Cc:Content-Transfer-Encoding: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=SsHYObZP3XhD+jJtyQdbDNyOu9xI5UXvqPOV3X1hC+o=; b=eOtwq5/udLhG7Sh47p8MFoKUKA Iq90d9K2YWD6Ceovhzkn8nPdwirVMNzAP7RZ6fEM9KiMmuE8gqZltdR8hE9tcBwvdkvK1IC2xUx6i YoRKEQJpJkolioAoQSmLUtfDyWJs+ruT9V056oC8PnBpCTLGGQOK6igQn/dPMwW28ZYSsPQWWuc9K yeX9ps6ajBMaF6IveQV9JG56MajXC5biiWXj6HwFjbrz0mn9jU2jTYyUHaCKqh+T6cFMzsux+60ro QEcRfoF4CWptgctIrZyD4ouqIQyryUb6ZNvdB1RwBJWIs8hra5EzTg+RMp5kms0lHTt4pvdVUIKL5 aEDI868Q==; Original-Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:50392 helo=server.local) by gator3053.hostgator.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.91) (envelope-from ) id 1gCBIR-001mm0-6L for emacs-devel@gnu.org; Mon, 15 Oct 2018 17:25:07 -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: 1gCBIR-001mm0-6L X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: cpe-45-48-239-195.socal.res.rr.com (server.local) [45.48.239.195]:50392 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.148.212 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:230404 Archived-At: I am having difficulty calculating the screen relative x in the following two (2) fact patterns. How can I calculate the relative x for each fact pattern? FACT PATTERN # 1: 1. Current line is horizontally scrolled differently than all other lines in the window. 2. Current line is truncated on the _left_ 3. display-line-numbers is non-nil. 4. Current line has characters of varying pixel widths. 5. hscl_temp_p == true FACT PATTERN # 2: 1. Current line is horizontally scrolled differently than all other lines in the window. 2. Current line is truncated on the _left_ 3. display-line-numbers is non-nil. 4. Current line has characters of varying pixel widths. 5. hscl_perm_p == true int frame_char_width = FRAME_COLUMN_WIDTH (it->f); bool auto_hscroll_mode_p = EQ (Fbuffer_local_value (Qauto_hscroll_mode, it->w->contents), Qcurrent_line); it hscl_first_hpos = window_hscroll_limited (it->w, it->f); /* EXAMPLE: (scroll-left 5); and, then press the left arrow key one time.*/ bool hscl_temp_p = (!it->w->suspend_auto_hscroll && auto_hscroll_mode_p && it->w->hscroll > 0 && it->w->min_hscroll == 0); /* EXAMPLE: C-u C-x < and do something that causes the current line to be horizontally scrolled differently. */ bool hscl_perm_p = (!it->w->suspend_auto_hscroll && auto_hscroll_mode_p && it->w->hscroll > 0 && it->w->min_hscroll > 0 && it->w->min_hscroll != it->w->hscroll); int relative_x; if (it->current_x > 0 && hscl_perm_p) relative_x = it->current_x - (hscl_first_hpos * frame_char_width); else if (it->current_x > 0 && hscl_temp_p) relative_x = it->current_x - (hscl_first_hpos * frame_char_width);