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#18545: 24.4.50: Bug - forward-line inside with-selected-window Date: Sun, 28 Sep 2014 20:51:22 +0300 Message-ID: <83oatzmy5h.fsf@gnu.org> References: <290964377.56621411668876487.JavaMail.www@wwinf7125> <83a95nv9fm.fsf@gnu.org> <542668BA.6010800@gmx.at> <838ul5tpfu.fsf@gnu.org> <54268B0B.1020203@gmx.at> <8361g9tijj.fsf@gnu.org> <5426BD71.4000705@gmx.at> <83zjdlrqti.fsf@gnu.org> <83wq8prmp2.fsf@gnu.org> <54270A02.2010907@gmx.at> <83r3ywsvkv.fsf@gnu.org> <83ppegsurp.fsf@gnu.org> <5427D634.1070100@gmx.at> <83sijbn1xg.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1411926748 24201 80.91.229.3 (28 Sep 2014 17:52:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 28 Sep 2014 17:52:28 +0000 (UTC) Cc: lompik@voila.fr, 18545@debbugs.gnu.org To: rudalics@gmx.at Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Sep 28 19:52:20 2014 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 1XYIdw-0004RQ-F3 for geb-bug-gnu-emacs@m.gmane.org; Sun, 28 Sep 2014 19:52:20 +0200 Original-Received: from localhost ([::1]:60510 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYIdw-0003O3-38 for geb-bug-gnu-emacs@m.gmane.org; Sun, 28 Sep 2014 13:52:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50248) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYIdp-0003No-1u for bug-gnu-emacs@gnu.org; Sun, 28 Sep 2014 13:52:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XYIdk-0003WD-CV for bug-gnu-emacs@gnu.org; Sun, 28 Sep 2014 13:52:12 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34751) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYIdk-0003RA-9B for bug-gnu-emacs@gnu.org; Sun, 28 Sep 2014 13:52:08 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XYIde-0001Pq-CI for bug-gnu-emacs@gnu.org; Sun, 28 Sep 2014 13:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 28 Sep 2014 17:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18545 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18545-submit@debbugs.gnu.org id=B18545.14119266985413 (code B ref 18545); Sun, 28 Sep 2014 17:52:02 +0000 Original-Received: (at 18545) by debbugs.gnu.org; 28 Sep 2014 17:51:38 +0000 Original-Received: from localhost ([127.0.0.1]:54548 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XYIdF-0001PE-U7 for submit@debbugs.gnu.org; Sun, 28 Sep 2014 13:51:38 -0400 Original-Received: from mtaout26.012.net.il ([80.179.55.182]:59582) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XYIdC-0001P2-UW for 18545@debbugs.gnu.org; Sun, 28 Sep 2014 13:51:36 -0400 Original-Received: from conversion-daemon.mtaout26.012.net.il by mtaout26.012.net.il (HyperSendmail v2007.08) id <0NCM00F00HD21M00@mtaout26.012.net.il> for 18545@debbugs.gnu.org; Sun, 28 Sep 2014 20:49:38 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout26.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NCM008O4HIQJ760@mtaout26.012.net.il>; Sun, 28 Sep 2014 20:49:38 +0300 (IDT) In-reply-to: <83sijbn1xg.fsf@gnu.org> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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:93833 Archived-At: > Date: Sun, 28 Sep 2014 19:29:47 +0300 > From: Eli Zaretskii > Cc: lompik@voila.fr, 18545@debbugs.gnu.org > > > Date: Sun, 28 Sep 2014 11:34:44 +0200 > > From: martin rudalics > > CC: lompik@voila.fr, 18545@debbugs.gnu.org > > > > > Hmm... I wonder why did we enter this area of the code, i.e. why did > > > this condition fire: > > > > > > /* Handle case where place to start displaying has been specified, > > > unless the specified location is outside the accessible range. */ > > > if (w->force_start || window_frozen_p (w)) > > > > > > Was w->force_start non-zero, or did window_frozen_p return non-zero? > > > If the former, can you see where was the force_start flag set? (I'd > > > be surprised if it's the latter, since windows are only frozen when we > > > grow the minibuffer, which shouldn't be happening here, I think.) > > > > > > In general, if the force_start flag of a window is set, that means we > > > shouldn't scroll, so bringing point back into view makes sense. > > > > That's likely me. Under certain conditions I do `recenter' with a > > negative argument in `post-command-hook' which basically looks like > > > > (recenter (max 0 (- (window-height) 7))) > > > > which triggers w->force_start being set here in xdisp.c: > > > > if (IT_CHARPOS (it) == PT) > > w->force_start = 1; > > That's what I thought. > > > So my case _is_ very likely special. Still "bringing point back into > > view" shouldn't make point appear on a partially visible line. > > No, that's likely the bug here. I will look into that. Does the patch below help? If not, can you tell where I goofed? === modified file 'src/xdisp.c' --- src/xdisp.c 2014-09-25 07:01:35 +0000 +++ src/xdisp.c 2014-09-28 17:45:22 +0000 @@ -16179,15 +16179,21 @@ redisplay_window (Lisp_Object window, bo && CHARPOS (startp) >= BEGV && CHARPOS (startp) <= ZV) { + ptrdiff_t it_charpos; + w->optional_new_start = 0; start_display (&it, w, startp); move_it_to (&it, PT, 0, it.last_visible_y, -1, MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y); - if (IT_CHARPOS (it) == PT) - w->force_start = 1; - /* IT may overshoot PT if text at PT is invisible. */ - else if (IT_CHARPOS (it) > PT && CHARPOS (startp) <= PT) - w->force_start = 1; + it_charpos = IT_CHARPOS (it); + if (line_bottom_y (&it) < it.last_visible_y) + { + if (it_charpos == PT) + w->force_start = 1; + /* IT may overshoot PT if text at PT is invisible. */ + else if (it_charpos > PT && CHARPOS (startp) <= PT) + w->force_start = 1; + } } force_start: