[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Calculating screen relative X when horizontal scrolling.
From: |
Keith David Bershatsky |
Subject: |
Re: Calculating screen relative X when horizontal scrolling. |
Date: |
Wed, 17 Oct 2018 13:43:49 -0700 |
In addition to the explanation in the previous post about temporarily hijacking
w->phys_cursor.x and setting it with my own relative x before calling
draw_window_cursor, the following screenshots may help to explain (by way of
visual example) the relative x that I am seeking when horizontal scrolling:
(scroll-left 9): https://lawlist.com/images/scroll_left_09.png
(scroll-left 10): https://lawlist.com/images/scroll_left_10.png
(scroll-left 11): https://lawlist.com/images/scroll_left_11.png
In the (scroll-left 9) screenshot, the following code renders the _correct_
relative x for the entire current line.
relative_x = it->current_x - ((window_hscroll_limited (it->w, it->f) *
FRAME_COLUMN_WIDTH (it->f))
However, that same code does not work when I evaluate (scroll-left 10) or
(scroll-left 11). The problem appears to have something to do with the varying
pixel widths of the different characters.
The same problem arises when temporarily or semi-permanently scrolling _only_
the current line; i.e., when either of the following tests are _true_:
/* 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);
- Calculating screen relative X when horizontal scrolling., Keith David Bershatsky, 2018/10/15
- 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 <=
- 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
- Re: Calculating screen relative X when horizontal scrolling., Keith David Bershatsky, 2018/10/24