From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christoph Arenz Newsgroups: gmane.emacs.bugs Subject: bug#54800: 28.1; calc: Cursor positioned at weird position in calc stack Date: Sat, 9 Apr 2022 14:31:06 +0200 Message-ID: <3e3b4386-9720-60bb-1e54-fa7326191b7a@web.de> References: <4a0319d6-b533-b3d8-bf52-bb18d74757e1@web.de> <831qy6aewb.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19122"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Cc: 54800@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 09 14:32:11 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ndAGA-0004n9-KY for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Apr 2022 14:32:10 +0200 Original-Received: from localhost ([::1]:49226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ndAG9-0005Nw-9Q for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Apr 2022 08:32:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50466) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ndAG2-0005NY-Pd for bug-gnu-emacs@gnu.org; Sat, 09 Apr 2022 08:32:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43041) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ndAG2-0000PA-H3 for bug-gnu-emacs@gnu.org; Sat, 09 Apr 2022 08:32:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ndAG2-0007W2-E3 for bug-gnu-emacs@gnu.org; Sat, 09 Apr 2022 08:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Christoph Arenz Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Apr 2022 12:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54800 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 54800-submit@debbugs.gnu.org id=B54800.164950747728835 (code B ref 54800); Sat, 09 Apr 2022 12:32:02 +0000 Original-Received: (at 54800) by debbugs.gnu.org; 9 Apr 2022 12:31:17 +0000 Original-Received: from localhost ([127.0.0.1]:36938 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ndAFI-0007V1-Vp for submit@debbugs.gnu.org; Sat, 09 Apr 2022 08:31:17 -0400 Original-Received: from mout.web.de ([212.227.17.11]:36277) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ndAFG-0007Um-5c for 54800@debbugs.gnu.org; Sat, 09 Apr 2022 08:31:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1649507467; bh=kz6FQd9RUkNyRhLmDzDGyG7IeUDJp1EFfa5YJpjnqMo=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=mlUoPpJA83HQIaKRsoQGM6AY6wy9cypfx6eKArU8ITGLGwQK6s/OVxk+EFdFxnVJ9 LbTTPIebU5A5XH3M171WpEmIvUcSm7HFDJne/8zuIFFS1/ObZC+FvJEYlDY/BrQ+mN PXSxuXzFFhOJvYgoX+Tl9lIa2SHxFs94h8dJeYyA= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Original-Received: from [192.168.188.20] ([5.83.184.164]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1My6lR-1ntyoG1lLL-00zKQr; Sat, 09 Apr 2022 14:31:07 +0200 Content-Language: en-US In-Reply-To: <831qy6aewb.fsf@gnu.org> X-Provags-ID: V03:K1:zoIatV9I7tHrtjqfNJMsUbLzMQL8fwygfoFOc+BF7y4yZKL7Qi/ TA3HLXgSOWmY9X/XmbGDRhBBRg5zOS1PjvvXlMU1vdfB5ItNbfqW067bHCT0nYWSXnrzMSW G2hvadAklkiUSn/kAPTLfcF2h3oft2vJcvcya8eKZkSP3yrYFV6ETIZOr6VjZ4N2SF+ssnH yb884DCODP4p8hO9eRgOA== X-UI-Out-Filterresults: notjunk:1;V03:K0:SLIW6eZAQCg=:Vtq/DGVPYNmQRr2QUkqm2/ UwKHMSoaxxkxtSMlFph+AI8W374tJg9jreveq9Z9Y7W5WRkOUkR2EHXhcmgfSFp1gHoS4p9eH x8VBrfkuEeEzoHdMrHid/i5FfFZLxFVvPiN2sCKldUMho1Zfd5l3fNPhw3z/OIjLbywW1SnI4 7lHpW/3Jd2HM4+4ncGgPZSAmYKoXaUfuNcOvvGkQANKkbvkIUYwwMRu/rUL5yZLtAjSwixMHs 1E4EEFfsauYDjsLnTZNWICkos6ilewdvvsJUuoHTgcWPyDV5BfHeIbrvG/7QO5axfsIFRITkK Bz9iMz98v2Q319/cTMJB4vtzIagDPWWP2wmFm4h9L5XxNHxkL/xKyvaFGdilmN6cN3kRDdCcc 7eUY4vw8shgi+XtJZvSUR15RUzNKPpUbnfmSF7u5MXYs/Pj4zIN3ymGEn55S+wgW0KHwY+I5V 05IOlLqSD/bNipsIS5bLOw/czIhYAtO3i9JAWJymRISsuDpMCLGZHhG6ROK0TlPfyLJJaJ+qT FK2h5aiOgaGIOsakfiJN1ixzr2GsxM8py4nVzhjW0X8xoavOknVYM6iML9rHSA0R4Z9ISKbYL UeSaKq3esB1u5e8Cm0qtGL7cUxpkjjqEb4NvBB+6v7riQ0czZwDXK4KGNYHJAnXMFtt5Hnc87 PjcXTBakkzKitp4uTr6XKJb8mvTzNL01v3+17rAHfgybG3YKmzQzWhOY5qdmEGoPIMEFRLfNr cdlXbC3zk/ogUPm77MN702i1CcLvtkH3HE8rPvQH+TOeS/hX6iZwifEM6Q2Qa1UO5dez0bpl X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:229614 Archived-At: On 09.04.22 09:34, Eli Zaretskii wrote: >> Date: Fri, 8 Apr 2022 21:44:38 +0200 >> From: Christoph Arenz >> >> When the content of the calc stack inclusive top-of-stack symbol `.' >> gets larger in height than the calc window, the cursor is positioned at >> a weird position in the upper half of the stack window. When >> line-numbering is on, the cursor is positioned at the beginning of the >> line at the line number. Calling `calc-realign' does not change the >> cursor postion. >> >> How to reproduce: >> 1. emacs -Q >> 2. C-x * * (to start calc) >> 3. enter a number and RET >> 4. repeat No. 3 until the stacks grows and the symptom appears >> >> Expected behavior for the cursor is to be placed on the `.' symbol, >> representing the top of the stack. >> >> 5. After pressing `o' [calc-realign], the expected behavior would also >> be for the cursor to be positioned at the top of the calc stack. >> >> Debugging the function calc-align-stack-window with edebug, the symptom >> goes away when placing a breakpoint at the line >> (calc-cursor-stack-index 0) just after the set-window-start call, and >> then continuing from there. >> >> The following patch fixes the problem for me, but I do not fully >> understand the NOFORCE option of the set-window-start function. > Thanks, but I think using NOFORCE is not the best solution here, > because that causes Emacs to recenter the stack window, thus showing > fewer stack entries than possible. > > I think the bug is actually off-by-one error, because the > vertical-motion call doesn't take the header-line into account. So I > suggest the following patch instead, please see if it solves the > problem: Your patch solves the problem and shows maximum content of the stack in the window. Note that it still contains the NOFORCE while the off-by-one fix also works without it. > diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el > index 81677d7..900940d 100644 > --- a/lisp/calc/calc.el > +++ b/lisp/calc/calc.el > @@ -1815,8 +1815,8 @@ calc-align-stack-window > (if win > (progn > (calc-cursor-stack-index 0) > - (vertical-motion (- 2 (window-height win))) > - (set-window-start win (point))))) > + (vertical-motion (- 3 (window-height win))) > + (set-window-start win (point) 'noforce)))) > (calc-cursor-stack-index 0) > (if (looking-at " *\\.$") > (goto-char (1- (match-end 0)))))