all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: "... the window start at a meaningless point within a line."
Date: Fri, 16 Oct 2015 20:12:38 +0000	[thread overview]
Message-ID: <20151016201238.GD2779@acm.fritz.box> (raw)
In-Reply-To: <837fmm65bl.fsf@gnu.org>

Hello, Eli.

On Fri, Oct 16, 2015 at 09:23:10PM +0300, Eli Zaretskii wrote:
> > Date: Fri, 16 Oct 2015 18:12:50 +0000
> > Cc: emacs-devel@gnu.org
> > From: Alan Mackenzie <acm@muc.de>

> > > But why do you need to do that?  IOW, what problem does
> > > maybe_move_to_exact_bol solve, and how that problem is related to what
> > > Fvertical_motion does?

> > > Perhaps start by explaining what problems you discovered in
> > > Fvertical_motion that required you to make those changes.

> > Without maybe_move_to_exact_bol, vertical-motion, when it lands near
> > the top of the window, leaves the cursor not at column 0 on the screen.

> > So, for example, with point at C, unmodified (vertical-motion -1) takes
> > us to A2, when we want to go to L3.

> So all you need is make a correction after Fvertical_motion did its
> thing, is that right?

After Fvertical_motion has _almost_ done its thing.  (i.e., after it's
moved by rows, but before applying a column offset, should such have
been requested).

> Will the following algorithm work:

No, it won't.  If it did, I'd be somewhat annoyed, having spent so much
time thinking about it, drawing diagrams, and debugging over the last
week or so.  ;-)

>   . compute the horizontal difference, in pixels, between the position
>     which xdisp would use as window-start and the actual window-start
>     (the value should always be positive); let's call the result N

>   . let Fvertical_motion do its thing exactly as it does now

>   . move N more pixels to the right, i.e. in the direction of
>     increasing the X coordinate, or to the end of line, if it ends
>     before that coordinate

> If this should work, then all you need is to implement the 1st bullet,
> which is very easy, nothing as complicated as your
> maybe_move_to_exact_bol.  It should just call move_it_in_display_line
> to get to the actual window-start, and save the X coordinate wehen it
> gets there.

Here's an example why it won't work:

    nlines = 3
1.  B---WS-------------A---L1------------\nC----------C2---------C3-----
                       ^                              T          it

o - Point starts at A, and (since this is already the start of an xdsip
  line) Fvertical_motion moves it forward three lines to C3.
o - What we want to happen is for point to be first set back to the
  (exact) BOL, WS, then moved forward three lines to C2.
o - So, before applying the N pixel correction, the actual and target
  final positions are already a complete line apart, regardless of the
  number of characters (or pixels) on either of these lines.

(Quick recap of the notation: WS is the "exact" window start, L1 is an
"exact" BOL.  B or A (here, B) is the "xdisp" window start, A is an
"xdisp" BOL.  C, C2, C3 are "common" BOLs.  ^ is point, "it" is
Fvertical_motion's first placement of `it', T is our target BOL.)

By making the pertinent text line just a little bit longer, we could end
up with this (note the extra BOL at A2):

    nlines = 3
2.  B---WS-------------A---L1------------A2-\nC---------C2--------C3---
                       ^                                it,T
o - Now Fvertical_motion puts `it' bang on target.
o - To adjust the final position by N pixels would make it wrong.

I see no alternative to counting BOLs of each type up to the point of
coincidence, C.  It is possible this might be done with more finesse
that I've managed so far, but be done it must.

-- 
Alan Mackenzie (Nuremberg, Germany).



  parent reply	other threads:[~2015-10-16 20:12 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-30 20:45 "... the window start at a meaningless point within a line." Alan Mackenzie
2015-10-01  8:48 ` Eli Zaretskii
2015-10-01  9:41   ` Alan Mackenzie
2015-10-01 10:16     ` Eli Zaretskii
2015-10-01 11:02       ` Alan Mackenzie
2015-10-01 12:03         ` Eli Zaretskii
2015-10-01 16:35           ` Alan Mackenzie
2015-10-15 18:16           ` Alan Mackenzie
2015-10-15 20:14             ` Eli Zaretskii
2015-10-16  9:55               ` Alan Mackenzie
2015-10-16 10:19                 ` Eli Zaretskii
2015-10-16 15:19                   ` Alan Mackenzie
2015-10-16 17:26                     ` Eli Zaretskii
2015-10-16 20:46                       ` David Kastrup
2015-10-17  7:15                         ` Eli Zaretskii
2015-10-17  7:56                           ` David Kastrup
2015-10-16 21:14                       ` Alan Mackenzie
2015-10-16 17:35                 ` Eli Zaretskii
2015-10-16 18:12                   ` Alan Mackenzie
2015-10-16 18:23                     ` Eli Zaretskii
2015-10-16 18:36                       ` Eli Zaretskii
2015-10-16 20:12                       ` Alan Mackenzie [this message]
2015-10-17  8:33                         ` Eli Zaretskii
2015-10-17 11:57                           ` Alan Mackenzie
2015-10-17 12:34                             ` Eli Zaretskii
2015-10-17 13:31                               ` Eli Zaretskii
2015-10-17 14:22                                 ` Eli Zaretskii
2015-10-18 15:00                                   ` Alan Mackenzie
2015-10-18 17:44                                     ` Eli Zaretskii
2015-10-19 10:27                                       ` Alan Mackenzie
2015-10-27 13:40                                         ` Alan Mackenzie
2015-10-27 17:35                                           ` Alan Mackenzie
2015-10-27 18:33                                             ` Eli Zaretskii
2015-10-27 18:23                                           ` Eli Zaretskii
2015-10-28  8:58                                             ` Alan Mackenzie
2015-10-28 13:15                                             ` Alan Mackenzie
2015-10-31 13:21                                               ` Eli Zaretskii
2015-10-31 21:17                                                 ` Alan Mackenzie
2015-11-01  3:40                                                   ` Eli Zaretskii
2015-11-01 14:45                                                     ` Alan Mackenzie
2015-11-01 15:23                                                 ` Alan Mackenzie
2015-11-01 17:45                                                   ` Eli Zaretskii
2015-11-01 18:07                                                     ` Eli Zaretskii
2015-11-01 18:46                                                     ` Alan Mackenzie
2015-10-18 14:53                                 ` Alan Mackenzie
2015-10-18 17:46                                   ` Eli Zaretskii
2015-10-19 10:45                                     ` Alan Mackenzie
2015-10-19 10:56                                       ` Eli Zaretskii
2015-10-19 11:24                                         ` Alan Mackenzie
2015-10-19 11:28                                           ` Eli Zaretskii
2015-10-19 12:02                                             ` Alan Mackenzie
2015-10-19 12:33                                               ` Eli Zaretskii
2015-10-19 13:11                                                 ` Alan Mackenzie
2015-10-19 13:27                                                   ` Eli Zaretskii
2015-10-19 19:15                                                     ` Alan Mackenzie
2015-10-27 13:46                                                       ` Alan Mackenzie
2015-10-17 15:30                               ` Alan Mackenzie

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151016201238.GD2779@acm.fritz.box \
    --to=acm@muc.de \
    --cc=eliz@gnu.org \
    --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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.