From: Keith David Bershatsky <esq@lawlist.com>
To: Emacs Devel <emacs-devel@gnu.org>
Subject: Calculating screen relative X when horizontal scrolling.
Date: Mon, 15 Oct 2018 15:25:06 -0700 [thread overview]
Message-ID: <m2zhve6e65.wl%esq@lawlist.com> (raw)
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);
next reply other threads:[~2018-10-15 22:25 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-15 22:25 Keith David Bershatsky [this message]
2018-10-16 14:48 ` Calculating screen relative X when horizontal scrolling Eli Zaretskii
-- strict thread matches above, loose matches on Subject: below --
2018-10-16 15:41 Keith David Bershatsky
2018-10-17 16:25 ` Eli Zaretskii
2018-10-17 17:54 Keith David Bershatsky
2018-10-17 20:43 Keith David Bershatsky
2018-10-19 19:23 ` Eli Zaretskii
2018-10-19 19:58 Keith David Bershatsky
2018-10-20 7:13 ` Eli Zaretskii
2018-10-19 20:02 Keith David Bershatsky
2018-10-20 9:55 Keith David Bershatsky
2018-10-24 20:40 Keith David Bershatsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2zhve6e65.wl%esq@lawlist.com \
--to=esq@lawlist.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).