From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#19200: Point adjustemnt moves *into* invisible text Date: Thu, 31 Mar 2016 20:17:53 +0300 Message-ID: <837fgiva66.fsf@gnu.org> References: <87mvpskb84.fsf@web.de> <87io0gbmpl.fsf@web.de> <87d1qnevco.fsf@web.de> <83h9fz65ze.fsf@gnu.org> <83r3f24gbk.fsf@gnu.org> <83egb24a5y.fsf@gnu.org> <83vb4d2pkt.fsf@gnu.org> <83poul2ob9.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1459444763 29565 80.91.229.3 (31 Mar 2016 17:19:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 31 Mar 2016 17:19:23 +0000 (UTC) Cc: michael_heerdegen@web.de, jonas@bernoul.li, 19200@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Mar 31 19:19:11 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1algFS-0006Yo-Gg for geb-bug-gnu-emacs@m.gmane.org; Thu, 31 Mar 2016 19:19:10 +0200 Original-Received: from localhost ([::1]:33507 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1algFR-0000g8-T7 for geb-bug-gnu-emacs@m.gmane.org; Thu, 31 Mar 2016 13:19:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41758) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1algFN-0000g1-7x for bug-gnu-emacs@gnu.org; Thu, 31 Mar 2016 13:19:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1algFK-0005UW-27 for bug-gnu-emacs@gnu.org; Thu, 31 Mar 2016 13:19:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49323) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1algFJ-0005UR-UP for bug-gnu-emacs@gnu.org; Thu, 31 Mar 2016 13:19:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1algFJ-0005Uo-Ny for bug-gnu-emacs@gnu.org; Thu, 31 Mar 2016 13:19:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 31 Mar 2016 17:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19200 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 19200-submit@debbugs.gnu.org id=B19200.145944470921089 (code B ref 19200); Thu, 31 Mar 2016 17:19:01 +0000 Original-Received: (at 19200) by debbugs.gnu.org; 31 Mar 2016 17:18:29 +0000 Original-Received: from localhost ([127.0.0.1]:46450 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1algEn-0005U5-9S for submit@debbugs.gnu.org; Thu, 31 Mar 2016 13:18:29 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50686) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1algEk-0005Tr-OK for 19200@debbugs.gnu.org; Thu, 31 Mar 2016 13:18:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1algEc-0005JH-AR for 19200@debbugs.gnu.org; Thu, 31 Mar 2016 13:18:21 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:38821) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1algEO-0005Hc-Lu; Thu, 31 Mar 2016 13:18:04 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1895 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1algEN-0008QS-VI; Thu, 31 Mar 2016 13:18:04 -0400 In-reply-to: (message from Stefan Monnier on Wed, 23 Mar 2016 12:10:26 -0400) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:115812 Archived-At: > From: Stefan Monnier > Cc: 19200@debbugs.gnu.org, michael_heerdegen@web.de, jonas@bernoul.li > Date: Wed, 23 Mar 2016 12:10:26 -0400 > > So someone needs to step through the code and figure out why this > doesn't happen. I guess you expected me to be that Someone... > E.g. maybe it doesn't happen because adjust_point_for_property is > not called at all. It _is_ called. > >> The issue of the main bug is not so much that we don't know how to fix > >> it, but that noone has bothered to investigate it to try and figure out > >> what is actually happening. > > Didn't I do that? Doesn't the fact that the relevant code calls > > get-char-property-and-overlay explain what happens? > > No: the get-char-property-and-overlay calls will only determine the > boundaries of the invisible text (i.e. they should find that the > invisible chunk goes between 3 and 5). The function is entered with point at 5, so 'beg' and 'end' start with that value. Then get_char_property_and_overlay in the "while (end < ZV" loop returns nil for position 5, so that loop is exited immediately. Then a similar call in the "while (beg > BEGV" loop returns t for position 5 - 1 = 4. Then previous-single-char-property-change returns 3, so 'beg' becomes 3. Then another call to get_char_property_and_overlay returns nil for position 3 - 1 = 2, and the while loop is exited with beg = 3 and end = 5. Since point is 5, we land here: /* Pretend the area doesn't exist if the buffer is not modified. */ if (!modified && !ellipsis && beg < end) { if (last_pt == beg && PT == end && end < ZV) (check_composition = check_display = true, SET_PT (end + 1)); else if (last_pt == end && PT == beg && beg > BEGV) (check_composition = check_display = true, SET_PT (beg - 1)); else if (PT == ((PT < last_pt) ? beg : end)) /* We've already moved as far as we can. Trying to go to the other end would mean moving backwards and thus could lead to an infinite loop. */ ; else if (val = Fget_pos_property (make_number (PT), Qinvisible, Qnil), TEXT_PROP_MEANS_INVISIBLE (val) && (val = (Fget_pos_property (make_number (PT == beg ? end : beg), Qinvisible, Qnil)), !TEXT_PROP_MEANS_INVISIBLE (val))) (check_composition = check_display = true, SET_PT (PT == beg ? end : beg)); } last_pt is 1, so we wind up in this branch: else if (PT == ((PT < last_pt) ? beg : end)) /* We've already moved as far as we can. Trying to go to the other end would mean moving backwards and thus could lead to an infinite loop. */ ; which does nothing. So point never moves and stays at 5. > After that, adjust_point_for_property should start by moving point to > position 3 (because last_pt should be < 3). It doesn't. > And after that it should use Fget_pos_property to decide whether to stay > at position 3 or to move to position 5, and in this case it should > choose to stay at position 3. It doesn't get there.