emacs-devel
[Top][All Lists]
Advanced

[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: Fri, 19 Oct 2018 12:58:56 -0700

Thank you, Eli, for continuing to try and help with this particular issue -- 
greatly appreciated!

For reference point of this particular analysis:

it->lnum_pixel_width == 44

Evaluating (scroll-left 10) gives a temporary:  it->w->hscroll == 10

The first character 'の' which was at a relative_x of 55 in a (scroll-left 9) 
situation, is still at a relative_x of 55 in a (scroll-left 10) situation.  
That character doesn't move move off the screen yet -- probably because it has 
a pixel width of 18; whereas, the frame_char_width is 11 for regular English 
characters.

it->current_x == 99 for the first character 'の'.

it->first_visible-x == 110.  Which is at odds with the previous statement.

My guess is that the first character 'の' is really at an it->current_x of 143; 
and, the it->first_visible_x would have to be 99.

I created my own custom dump glyph row which calculates the relative_x just 
like pgrowx in .gdbinit; i.e., add up all of the previous glyph->pixel_width up 
to the current location go get the relative_x at issue.

To help me see what is happening, I put in a few new entries just above 
'glyph->charpos = ' in all six (6) locations within xdisp.c and assigned a new 
"gizmo" (for lack of knowing the proper name) like this 'glyph->x = 
it->current_x;' with the appropriate corresponding entry for glyph->x in 
dispextern.h.  In the custom dump glyph row (discussed above), I can see that 
glyph->x for the first 'の' character is actually 143, not 99.

[I can certainly remove the above modifications to xdisp.c, but I don't think 
they hurt and they seem to be helpful to debug this particular issue.]

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

> Date: [10-19-2018 12:23:34] <19 Oct 2018 22:23:34 +0300>
> From: Eli Zaretskii <address@hidden>
> To: Keith David Bershatsky <address@hidden>
> CC: address@hidden
> Subject: Re: Calculating screen relative X when horizontal scrolling.
> 
> > Date:  Wed, 17 Oct 2018 13:43:49 -0700
> > From:  Keith David Bershatsky <address@hidden>
> > Cc:  address@hidden
> >
> > relative_x = it->current_x - ((window_hscroll_limited (it->w, it->f) * 
> > FRAME_COLUMN_WIDTH (it->f))
> 
> Can you tell why you don't use the simple approach:
> 
>   relative_x = it->current_x - it->first_visible_x;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]