From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: xdisp.c's struct it questions. Date: Sat, 03 Oct 2015 19:59:01 +0300 Message-ID: <83oagf3n3e.fsf@gnu.org> References: <20151003154835.GA4509@acm.fritz.box> <83r3lc2au2.fsf@gnu.org> <20151003163800.GB4509@acm.fritz.box> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1443891576 6881 80.91.229.3 (3 Oct 2015 16:59:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 3 Oct 2015 16:59:36 +0000 (UTC) Cc: emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 03 18:59:22 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZiQ9a-0000zG-23 for ged-emacs-devel@m.gmane.org; Sat, 03 Oct 2015 18:59:22 +0200 Original-Received: from localhost ([::1]:39350 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZiQ9U-0001Z4-Fv for ged-emacs-devel@m.gmane.org; Sat, 03 Oct 2015 12:59:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZiQ9R-0001Ur-4N for emacs-devel@gnu.org; Sat, 03 Oct 2015 12:59:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZiQ9N-00074m-Nl for emacs-devel@gnu.org; Sat, 03 Oct 2015 12:59:12 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:34351) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZiQ9N-00074O-DN for emacs-devel@gnu.org; Sat, 03 Oct 2015 12:59:09 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0NVN00L00LMQA600@a-mtaout20.012.net.il> for emacs-devel@gnu.org; Sat, 03 Oct 2015 19:59:06 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.94.185.246]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NVN00LL2LUI3C50@a-mtaout20.012.net.il>; Sat, 03 Oct 2015 19:59:06 +0300 (IDT) In-reply-to: <20151003163800.GB4509@acm.fritz.box> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.166 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:190798 Archived-At: > Date: Sat, 3 Oct 2015 16:38:00 +0000 > Cc: emacs-devel@gnu.org > From: Alan Mackenzie > > > Also note that the criteria is actually tested to "reach or exceed" > > the goal values, i.e. do not expect to always get an exact equality, > > only "greater or equal". > > Ah. Hmm. OK. That's rather important! In fact, that's exactly what > seems to be happening to me. > > So these routines are only for use in contexts where it only matters > that a particular range/position is _covered_, rather than reached > exactly. Not sure I agree; perhaps I don't understand what you mean by "covered". If you give a goal value that _can_ be reached exactly, these functions should do exactly that. But a value might not be reachable exactly. A trivial example is a value of X that is in the middle of a character (the value is in pixels). A less trivial example is when the goal is the character position in the middle of invisible text, like text covered by 'invisible' text property or by a display string. > Would `reseat' (or one of its variants) be the right function to put a > struct it _exactly_ at a particular position? If you change the value of it->pos by hand, you _must_ call 'reseat' afterwards to synchronize all the other fields, so that you could continue using the move_it_* functions. But note that 'reseat' cannot compute the screen coordinates (current_x, current_y, and vpos), which is why most uses reseat the iterator to a beginning of a physical line, where these coordinates can be set by you.