[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Calculating screen relative X when horizontal scrolling.
From: |
Keith David Bershatsky |
Subject: |
Calculating screen relative X when horizontal scrolling. |
Date: |
Mon, 15 Oct 2018 15:25:06 -0700 |
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);
- Calculating screen relative X when horizontal scrolling.,
Keith David Bershatsky <=
- Re: Calculating screen relative X when horizontal scrolling., Keith David Bershatsky, 2018/10/16
- Re: Calculating screen relative X when horizontal scrolling., Keith David Bershatsky, 2018/10/17
- Re: Calculating screen relative X when horizontal scrolling., Keith David Bershatsky, 2018/10/17
- Re: Calculating screen relative X when horizontal scrolling., Keith David Bershatsky, 2018/10/19
- Re: Calculating screen relative X when horizontal scrolling., Keith David Bershatsky, 2018/10/19
- Re: Calculating screen relative X when horizontal scrolling., Keith David Bershatsky, 2018/10/20