From unknown Sat Aug 16 11:12:16 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#5718 <5718@debbugs.gnu.org> To: bug#5718 <5718@debbugs.gnu.org> Subject: Status: scroll-margin in buffer with small line count. Reply-To: bug#5718 <5718@debbugs.gnu.org> Date: Sat, 16 Aug 2025 18:12:16 +0000 retitle 5718 scroll-margin in buffer with small line count. reassign 5718 emacs submitter 5718 Oleksandr Gavenko severity 5718 wishlist tag 5718 patch fixed thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 14 13:27:15 2010 Received: (at submit) by debbugs.gnu.org; 14 Mar 2010 17:27:15 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nqrat-0003hZ-D4 for submit@debbugs.gnu.org; Sun, 14 Mar 2010 13:27:15 -0400 Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nqrar-0003hU-E5 for submit@debbugs.gnu.org; Sun, 14 Mar 2010 13:27:13 -0400 Received: from lists.gnu.org ([199.232.76.165]:55207) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Nqram-0002vY-PA for submit@debbugs.gnu.org; Sun, 14 Mar 2010 13:27:08 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nqram-0000iR-Bi for bug-gnu-emacs@gnu.org; Sun, 14 Mar 2010 13:27:08 -0400 Received: from [140.186.70.92] (port=38629 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nqraj-0000iE-LL for bug-gnu-emacs@gnu.org; Sun, 14 Mar 2010 13:27:07 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID,T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.0 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nqrae-0006Ot-JO for bug-gnu-emacs@gnu.org; Sun, 14 Mar 2010 13:27:05 -0400 Received: from mail-fx0-f227.google.com ([209.85.220.227]:62090) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nqrae-0006Ok-Ew for bug-gnu-emacs@gnu.org; Sun, 14 Mar 2010 13:27:00 -0400 Received: by fxm27 with SMTP id 27so2827231fxm.8 for ; Sun, 14 Mar 2010 10:26:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=V3HwQS+tjsCm1V+tRHwmaubpj+8hmD+SCwbKJkqlc6E=; b=F6th3h6V6TJXH/o/XhCJg/9H7cc4k4Q/We+KXGG7F26qKlK3cMkGQ1zTxhH/0U4VaR 3uTIs5KOVHO0Pavw6TM3Ns81miMUXtWVOI5nu0AGHW9A3iBTFEigNPVAWvYPebn4kFuX uBg3h3T67Xb0mzWkLkRrq8iWuOzMlVwVWp3cE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=oFjBwJpzh+mwXtJCbgEh2zgpnRPP3rnblW+spsDjaLGfSbNA2/sbOXY7LFCTyxH6PW yDhpyvHz2J0YKDHbMYt2AsblyvU0qD3PYEwEdGHNPqOK8r1Ej3GJE+F1prs7LIN6eklD yeUYmcwuiJl3NheblTXk/8CbYZQpyvr/4s0wM= Received: by 10.223.5.69 with SMTP id 5mr4094040fau.8.1268587618781; Sun, 14 Mar 2010 10:26:58 -0700 (PDT) Received: from [178.92.38.203] (203-38-92-178.pool.ukrtel.net [178.92.38.203]) by mx.google.com with ESMTPS id b17sm5955824fka.43.2010.03.14.10.26.57 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 14 Mar 2010 10:26:58 -0700 (PDT) Message-ID: <4B9D1C61.70903@gmail.com> Date: Sun, 14 Mar 2010 19:26:57 +0200 From: Oleksandr Gavenko User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0 MIME-Version: 1.0 To: bug-gnu-emacs@gnu.org Subject: scroll-margin in buffer with small line count. Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -3.3 (---) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.6 (----) I have official Emacs 22.3 from FSF ftp server for Windows. When set (setq scroll-margin 4) in buffer with window width 6 lines real margin value is 1 (so real line scrolling done when press on second line or when press on fifth line). Experiment show such dependence of real margin on line count: lines real-scroll-margin 3,4,5,6 1 7,8,9,10 2 11,12,13,14 3 >15 4 I count from 3 as when try make less lines Emacs warn. I think that whose modify scroll-margin want to see as many as possible margin value up to its customization value. This formula produce such values: best-scroll-margin = min( (line_count - 1)/2, scroll-margin) So previous table changed to: lines best-scroll-margin 3,4 1 5,6 2 7,8 3 >9 4 Also as you can see in proposal case user switch start work from 9 lines in window, not 15! Please implement described behaviour. -- Best regards! From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 11 00:11:33 2016 Received: (at 5718) by debbugs.gnu.org; 11 Aug 2016 04:11:33 +0000 Received: from localhost ([127.0.0.1]:52854 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bXhLB-0001mA-9P for submit@debbugs.gnu.org; Thu, 11 Aug 2016 00:11:33 -0400 Received: from mail-qk0-f170.google.com ([209.85.220.170]:33396) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bXhL9-0001lx-Qi for 5718@debbugs.gnu.org; Thu, 11 Aug 2016 00:11:32 -0400 Received: by mail-qk0-f170.google.com with SMTP id t7so63744312qkh.0 for <5718@debbugs.gnu.org>; Wed, 10 Aug 2016 21:11:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=55k4tJUFRXE38d9jLz3XS5erzA5peCXGWI7HwhiE4JU=; b=FbGdBRJ13iNUfTrNWQkNpJWb+McYHMYbVeajEcd8gFdudNuVj68X8PmpAvJjcOOCYQ vUBHBN3n/scO6cB2tyA1qQnYu8HMo5cUDzgWMUcJ0BtN5vCTvjSaaoZ1SmJH0AI6+sfz MUk6imbWVDSmFJ2TQiLNxdZIcjNF1pwyFAw3IY0n4A0p82np1Z7ZTGPQJatjQ+N5nP5V AOdmvE/2pz39IbEvdtPJr8RAFkEF0zCooadZ6z1XQTghxXpGxxHKwAh50ybEN8ogUu49 Ses2i/DlRDKoiN96+/Pfe9X1tj7d8dZvGkUugIOfkCJCQUyOOdDOU4UJGf+F61fW//EO G7FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=55k4tJUFRXE38d9jLz3XS5erzA5peCXGWI7HwhiE4JU=; b=URD6gIo02QBdqXSB3p61kWFCI/heN9TQh5t9bRBFD59H61Aw0EYmbGI1J/ygMV3eS7 tRwTA1yB1Ap2v5xqoPFfFAcApOcQqtcEQNiI1RXuPW2fPErfV/I1Y+PoUKA5HKIygY0L yFxpht8e1wRucWAZeOhoptkGdP2vvkbOw+JEj4qiUjeV+clXXQXJkGLCDaVYxf8mc+df ZuevTJCvr4K+2gKT/w/I9UGUYHr5juF395FXyBKY5RrSwddQfx2MrcyrQTz9oCIB9OTZ J6LXpfwSUUKOojbr/fqLpva4K0yIO0wEVU3QANMKZTv9Wjul2hbtlLEkmZ0afeYf1DpD wLiA== X-Gm-Message-State: AEkooutsGVU8X4mLC5JwbVw90c+d6aEbNyIk0f3LYf77IQTbo2SvDSKyWNP24PFWHUB0/A== X-Received: by 10.55.36.131 with SMTP id k3mr8459792qkk.86.1470888686512; Wed, 10 Aug 2016 21:11:26 -0700 (PDT) Received: from Andrews-MacBook-Pro.local.ahyatt-laptop (cpe-74-73-128-199.nyc.res.rr.com. [74.73.128.199]) by smtp.gmail.com with ESMTPSA id u129sm447489qkf.25.2016.08.10.21.11.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Aug 2016 21:11:23 -0700 (PDT) From: Andrew Hyatt To: Oleksandr Gavenko Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> Date: Thu, 11 Aug 2016 00:11:22 -0400 In-Reply-To: <4B9D1C61.70903@gmail.com> (Oleksandr Gavenko's message of "Sun, 14 Mar 2010 19:26:57 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (darwin) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 5718 Cc: 5718@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Oleksandr Gavenko writes: > I have official Emacs 22.3 from FSF ftp server for Windows. > > When set > > (setq scroll-margin 4) > > in buffer with window width 6 lines real margin value is 1 > (so real line scrolling done when press on second line > or when press on fifth line). > > Experiment show such dependence of real margin on line count: > > lines real-scroll-margin > 3,4,5,6 1 > 7,8,9,10 2 > 11,12,13,14 3 >>15 4 > > I count from 3 as when try make less lines Emacs warn. > > I think that whose modify scroll-margin want to see as many > as possible margin value up to its customization value. > > This formula produce such values: > > best-scroll-margin = min( (line_count - 1)/2, scroll-margin) > > So previous table changed to: > > lines best-scroll-margin > 3,4 1 > 5,6 2 > 7,8 3 >>9 4 > > Also as you can see in proposal case > user switch start work from 9 lines in window, not 15! > > Please implement described behaviour. I'm having a hard time understanding this report. However, it seems like more like a wishlist request than a bug: you want to change the scrolling behavior. I'm going to change this to wishlist for now, but let me know if I've misunderstood, please. From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 11 00:11:39 2016 Received: (at control) by debbugs.gnu.org; 11 Aug 2016 04:11:39 +0000 Received: from localhost ([127.0.0.1]:52857 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bXhLH-0001mV-GC for submit@debbugs.gnu.org; Thu, 11 Aug 2016 00:11:39 -0400 Received: from mail-qk0-f170.google.com ([209.85.220.170]:33426) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bXhLG-0001mB-GE for control@debbugs.gnu.org; Thu, 11 Aug 2016 00:11:38 -0400 Received: by mail-qk0-f170.google.com with SMTP id t7so63745894qkh.0 for ; Wed, 10 Aug 2016 21:11:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:message-id:to:from:subject; bh=GcEe4wwM927J/CadopKIW5vXipBjYOHuv+zWoc6D6D0=; b=bbtxzBcgRuzPAQ2dYavNk6fU/+HVCxeSJcP9u5s2rbe3tjlBUkwABd7Q88byf7jsr6 D++umDpAS2t+xgiYP7QDh86FV+9HvOs1xbY9Odx6FKKzPD8C0xR2tPGvJ01AsNZtqTql XdTSmNJ9+5W7hHlT98RNDWb/D6C755iGqCSDA7fi5kw5vnJcZrS+ElC0IejCL41NdiZ2 7igyzisvdEjj1Tl2MtKTOt0ifBysJKApV+JkJ+cVXWDhelFhEPsTMrwpbevXILbHUhcA tL9MqlgzAaQypbeVSbYdcHTBX2wxSimnFrTsLQr9jDdhMq3Z27w/9HpWHGn6uDAnjVDu b9Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:message-id:to:from:subject; bh=GcEe4wwM927J/CadopKIW5vXipBjYOHuv+zWoc6D6D0=; b=I3Gr9wSaqE14wlg9mAIT1+uEJcPadLtjjLEwpirZtltZ9g1EzoRAuLiygMCPTt9L+K 3/D8cGTAe7uqemxYXdvXexvuR0pR0UfvuiI7i5FNbhLvwgAC1G2M4iY5geoUjcK26xP1 25kjlniFb+iX6dqAJHNHFWFsKu6mPwR0AQAPtTEhiKv5GWBfL1B49UpQrnW7T6rR1Mxb uH8WXy+S09y7gr0/NY6e3KUcq2st9kB9ttx8Zf4DU4GU+w4vTpZDm2NzCbc7xO7d77ji pvZeao9KNnNTpXHenVnGKWNxYQijfP0N4Lp8NZYSfXTKMtLiqY2rxCzwruEYZvaHAdjT OXPg== X-Gm-Message-State: AEkoouvE9E3N8xtD7dexoPnj0pz/Ecw43RdXvJfOvcirxDu8+Hjka2S0gcDRpl01qApjJQ== X-Received: by 10.55.137.70 with SMTP id l67mr8294187qkd.132.1470888693021; Wed, 10 Aug 2016 21:11:33 -0700 (PDT) Received: from Andrews-MacBook-Pro.local.ahyatt-laptop (cpe-74-73-128-199.nyc.res.rr.com. [74.73.128.199]) by smtp.gmail.com with ESMTPSA id m10sm441814qta.31.2016.08.10.21.11.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Aug 2016 21:11:32 -0700 (PDT) Date: Thu, 11 Aug 2016 00:11:31 -0400 Message-Id: To: control@debbugs.gnu.org From: Andrew Hyatt Subject: control message for bug #5718 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) severity 5718 wishlist From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 11 08:03:17 2016 Received: (at 5718) by debbugs.gnu.org; 11 Aug 2016 12:03:17 +0000 Received: from localhost ([127.0.0.1]:53077 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bXohh-00034f-4W for submit@debbugs.gnu.org; Thu, 11 Aug 2016 08:03:17 -0400 Received: from mail-it0-f52.google.com ([209.85.214.52]:38613) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bXohg-00034T-3I for 5718@debbugs.gnu.org; Thu, 11 Aug 2016 08:03:16 -0400 Received: by mail-it0-f52.google.com with SMTP id x130so3812107ite.1 for <5718@debbugs.gnu.org>; Thu, 11 Aug 2016 05:03:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=FV9muWqJGd3TARkqp3dv0VJismJlkc/xT2NS2vmegqU=; b=LUSECsk2IYbWaECCC44G09ldRTVjua0Syik8AXwk/LneY3e12xU25ijaTdgyBo0yc3 YdiAm0/wa/eX2dI2RtSh4n1x9+1/IdEANFjgSplP+IlCc0yP1+8fpP4e9HF4Zb+33Tzo 08TMppqle+BfQal9Whm1+0muE1Nk7PPnsR2WVvpORTNsF4KQ63pId/FQAnC5Lyga3+lh WXpLPu0fvGlH/XG6MwfZEuJt8H4mYCEbr88tD5B9phQFiLSS2ccVXUZSMxtI4Yn1YzH7 vhwPvjaufgcaNFK8rxDnIj0/HRVDZNioASohXIjU/xbC7j70aQ3F9WdmM/oc9Q/dyn9I uo+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=FV9muWqJGd3TARkqp3dv0VJismJlkc/xT2NS2vmegqU=; b=kDfFrxp9gDgqLXqpx+gB6xWMD/jnIDKh5pinWKBTjiHCmpiovkz3X3xWlAzKa1vI6n vCuThdmGcFrMyCvxkbmZ0XDCZ+OuuzJzVoiAPzeO7aFk4t0mTNGpcQQft67yDjCVRFu4 Ad6qvA0rhRF/LxMIuMlzXCcPBy5VtcJIbhfxpeJGzxiVmbeRC7jGwrtIoYnJzKrnfhLg bGtCnswXIYumsCCnH9PJJUoaJlCo1/wriCwmTj4j6enBZkOGP2eGoqh2IsyByaRd+G8x tpYJBDRXwV/V0BwLiBISXVhnYhwmesdMx0+yLTu7bPK07Q+vc086yyBezt+drBsN7lPm Aekw== X-Gm-Message-State: AEkoouuW5SXCrBiScDtEwNVny7N59n7H9hA3dahWR50QMBzdMO7lWjntBw8oE1AWg5mnVQ== X-Received: by 10.36.129.213 with SMTP id q204mr9549079itd.38.1470916990479; Thu, 11 Aug 2016 05:03:10 -0700 (PDT) Received: from zony (206-188-64-44.cpe.distributel.net. [206.188.64.44]) by smtp.googlemail.com with ESMTPSA id b66sm5987258itd.0.2016.08.11.05.03.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Aug 2016 05:03:09 -0700 (PDT) From: npostavs@users.sourceforge.net To: Andrew Hyatt Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> Date: Thu, 11 Aug 2016 08:03:18 -0400 In-Reply-To: (Andrew Hyatt's message of "Thu, 11 Aug 2016 00:11:22 -0400") Message-ID: <87mvkjy0l5.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 5718 Cc: 5718@debbugs.gnu.org, Oleksandr Gavenko X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Andrew Hyatt writes: > Oleksandr Gavenko writes: > >> I have official Emacs 22.3 from FSF ftp server for Windows. >> >> When set >> >> (setq scroll-margin 4) >> >> in buffer with window width 6 lines real margin value is 1 >> (so real line scrolling done when press on second line >> or when press on fifth line). >> >> Experiment show such dependence of real margin on line count: >> >> lines real-scroll-margin >> 3,4,5,6 1 >> 7,8,9,10 2 >> 11,12,13,14 3 >>>15 4 >> >> I count from 3 as when try make less lines Emacs warn. >> >> I think that whose modify scroll-margin want to see as many >> as possible margin value up to its customization value. >> >> This formula produce such values: >> >> best-scroll-margin = min( (line_count - 1)/2, scroll-margin) >> >> So previous table changed to: >> >> lines best-scroll-margin >> 3,4 1 >> 5,6 2 >> 7,8 3 >>>9 4 >> >> Also as you can see in proposal case >> user switch start work from 9 lines in window, not 15! >> >> Please implement described behaviour. > > I'm having a hard time understanding this report. However, it seems > like more like a wishlist request than a bug: you want to change the > scrolling behavior. I'm going to change this to wishlist for now, but > let me know if I've misunderstood, please. I think the complaint is that the `scroll-margin' effective value is capped at a 1/4 of the window height, as seen in this window_scroll_pixel_based (window.c): this_scroll_margin = max (0, scroll_margin); this_scroll_margin = min (this_scroll_margin, window_total_lines / 4); Whereas, it seems more logical to cap it at half window height. I seem to recall another feature request that I can't find now about always keeping the cursor in the middle of the window. If this restriction were loosened it might be possible to implement by setting scroll-margin to a very high number. There might well be some important reason to divide by 4 though (I haven't looked at the following code). From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 11 09:06:06 2016 Received: (at 5718) by debbugs.gnu.org; 11 Aug 2016 13:06:06 +0000 Received: from localhost ([127.0.0.1]:53170 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bXpgU-0006Es-Fp for submit@debbugs.gnu.org; Thu, 11 Aug 2016 09:06:06 -0400 Received: from mail-wm0-f52.google.com ([74.125.82.52]:36215) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bXpgS-0006EN-PH for 5718@debbugs.gnu.org; Thu, 11 Aug 2016 09:06:05 -0400 Received: by mail-wm0-f52.google.com with SMTP id q128so28924769wma.1 for <5718@debbugs.gnu.org>; Thu, 11 Aug 2016 06:06:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:organization:references:date:in-reply-to :message-id:user-agent:mime-version; bh=D2/aPv5PiOl7OmwWl4bUAZfABvOtIKlwAqeBcDf9eY4=; b=OZNLOnhEy17nFgTz3u0Env+DmhFtzInx5RSKObapqEod98h1XyZBk1VM9C0QjTAFOV f5aTxpDS9b4iDfUZm+FlBx7YH/f0F2gQLA3RCVYpvI8F8IM62JNY5CtZtFY7zr5f1OUO N0ilsNHglnKTeJTx8EKSNCXAEFo6YcoTODvP2FfmuywyS4sLawewRKISWq5kl2LQQJX0 KbpPP0zKCIKBwIjumh7Qv0/lrg0lGpFB1LBOvoqHZut6fMrCToZktrOiHATs7f3C/RzS ttaKFC1I6Xj1A6f4vhDCa1wPhZnbnuA6/ZulAqlzoqybGxfgzDXdlGjsYziHCnQ1Fr5g 68ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:organization:references:date :in-reply-to:message-id:user-agent:mime-version; bh=D2/aPv5PiOl7OmwWl4bUAZfABvOtIKlwAqeBcDf9eY4=; b=fROogGKfuC09wlmSOYmq3bmhOWSFyoVZdjuuJddcG9UcSLCpzz86cPL/A/+YSziFQk IZtu8i+4Fdl41mmnMWC+lNEryjMQGI4YMuR3Ao4wbgyvBcB0zAs/vyFWNhpM5GeJFxM/ 0zjWqDBtFESLFKjgZoO+0F4IgeTw/riqCWmQEfgp3wa91Q4WOuC3k71qfqxVmrWiqIgX ygJkSDVV6ICRwm+uxadyI6lo4BNi0gQQJIrq4f2oa3e7QT1LZTr6s6lPObNvYHvo3wM5 4PwfVi7GaB3aIJIcl7CC9BNA57jjoUlFzqQjMcNUo+9Lnr4/pLWAgviSJhlQnyChzoEn ENbQ== X-Gm-Message-State: AEkoouseyMgGu3N/2ETyVTDEIQjEnNTEazKRNL6f2qkVUpu22ssbALBYQjlaoEfrPXLmHA== X-Received: by 10.25.21.197 with SMTP id 66mr1469111lfv.99.1470920759040; Thu, 11 Aug 2016 06:05:59 -0700 (PDT) Received: from desktop ([46.185.21.165]) by smtp.gmail.com with ESMTPSA id 35sm564457ljb.10.2016.08.11.06.05.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Aug 2016 06:05:58 -0700 (PDT) From: Oleksandr Gavenko To: npostavs@users.sourceforge.net Subject: Re: bug#5718: scroll-margin in buffer with small line count. Organization: Oleksandr Gavenko , http://defun.work/ References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> Date: Thu, 11 Aug 2016 16:05:57 +0300 In-Reply-To: <87mvkjy0l5.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net's message of "Thu, 11 Aug 2016 08:03:18 -0400") Message-ID: <874m6rv4ju.fsf@gavenkoa.example.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 5718 Cc: Andrew Hyatt , 5718@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 2016-08-11, npostavs@users.sourceforge.net wrote: > I think the complaint is that the `scroll-margin' effective value is > capped at a 1/4 of the window height, as seen in this > window_scroll_pixel_based (window.c): > > this_scroll_margin = max (0, scroll_margin); > this_scroll_margin > = min (this_scroll_margin, window_total_lines / 4); > > Whereas, it seems more logical to cap it at half window height. > Yes, that was what I meant! Setting this_scroll_margin to 'window_total_lines / 2' keeps current line centered for short buffers. I think it is most desired behavior because it takes more surrounding context in small buffer. Many recipes suggest to set 'scroll-margin' to very large number to keep current line always centered. ================================================================ On reporting day I removed: (setq-default scroll-margin 4) from ~/.emacs because in "M-x calendar" UP/DOWN navigation become broken. Even in Emacs 24.5.1 setting (setq scroll-margin 4) in Calendar buffer hide month names on UP/DOWN moves. Since that time I selectively set scroll-margin: (make-variable-buffer-local 'scroll-margin) (defun my-set-scroll-margin () (setq scroll-margin 4)) (mapc (lambda (hook) (add-hook hook #'my-set-scroll-margin)) (delete-dups (append my-text-mode-hook-list my-devel-mode-hook-list)) ) to avoid setting 'scroll-margin' in Calendar. In order just to use: (setq-default scroll-margin 4) Emacs should not take in a count 'scroll-margin' when all lines are visible. Those are all my discoveries about 'scroll-margin' that makes Emacs usage experience less delightful. -- http://defun.work/ From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 11 09:25:07 2016 Received: (at 5718) by debbugs.gnu.org; 11 Aug 2016 13:25:07 +0000 Received: from localhost ([127.0.0.1]:53194 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bXpyt-0006lB-AA for submit@debbugs.gnu.org; Thu, 11 Aug 2016 09:25:07 -0400 Received: from mail-oi0-f47.google.com ([209.85.218.47]:35924) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bXpyr-0006ki-SU for 5718@debbugs.gnu.org; Thu, 11 Aug 2016 09:25:06 -0400 Received: by mail-oi0-f47.google.com with SMTP id f189so4545028oig.3 for <5718@debbugs.gnu.org>; Thu, 11 Aug 2016 06:25:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=ISN63DvgRT4VyVHeHUe4ynJOonxP4ujTHr2xkA+DpjY=; b=ojAraNDaNPXeT+ZH+hqt22k1hwBhcLgN8UZS2/KvHQq0Io7kuoH4/2AhBHL+Jl8qTy 3JqRjKdSTkRqcVD09babD3/sHukRytmZrc/QhwnbmTPwgYYm324MQKNEnVv6i9b60rvY COdA6ZZ8JXHxH3s3ddTDj+lASVcCRabEkxISvmWwt93A5QjAhphjvn1SnneWTFKBqEJ8 12VXyZqJHpxk7NKxLH3lmLnjvL3DbH6aD21GJcCdZ9nErmTDkJEwsKYJ8We/Nb1ZkcI4 T6Q1QZU+wGHmMN6vbr2759xdshRPE4/fKH7InLrj9ib8+5t6up5psVfhXUeqHq+8wRU6 V9/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=ISN63DvgRT4VyVHeHUe4ynJOonxP4ujTHr2xkA+DpjY=; b=Rbke+HoRwzE6K0zIPwQmOUYmzA/J/PIvxFCvASxIj9ZykRIyjKugIbzSCTKsA27Xmb dlA859/EjCEbDT6JWv9J5PwWq5yTacXuTUK6AJ8+Y8qY15IuDwCeJT16zeLT4CKbnnu+ 3PMK01SlZpwChnyxKX5GkTCe2K2GeoMm81RC2TqelosBXANpkd/7/CHWdPCqDy1y9ID+ olLxxcn2CpuDr4oNfCja/nVyudhYRzj7yOKcF8kZRV2CKQQydnkd/CjBi+wbgmtWE0e4 68t7VN5NPr8yK/4nsnQ12By9dB5zVBPoVKFEVIs0gEnWVi2q2pGzbG9WRchWuoq8ls5z 1Lgg== X-Gm-Message-State: AEkoousyHuE4pZHVYAxXJ+QCdl//8S/xK4OOCcatCe8eOlaG7HRHi23KT5m+kr/5ydJSfVIMvK6qVazcBsKZxA== X-Received: by 10.202.220.215 with SMTP id t206mr1936450oig.143.1470921900295; Thu, 11 Aug 2016 06:25:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.7.161 with HTTP; Thu, 11 Aug 2016 06:24:59 -0700 (PDT) In-Reply-To: <874m6rv4ju.fsf@gavenkoa.example.com> References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <874m6rv4ju.fsf@gavenkoa.example.com> From: Noam Postavsky Date: Thu, 11 Aug 2016 09:24:59 -0400 X-Google-Sender-Auth: G6cRaTt-Z7FSVqw9lQQ-YPde1mw Message-ID: Subject: Re: bug#5718: scroll-margin in buffer with small line count. To: Oleksandr Gavenko Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 5718 Cc: Andrew Hyatt , 5718@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Thu, Aug 11, 2016 at 9:05 AM, Oleksandr Gavenko wrote: > On reporting day I removed: > > (setq-default scroll-margin 4) > > from ~/.emacs because in "M-x calendar" UP/DOWN navigation become broken. > > Even in Emacs 24.5.1 setting > > (setq scroll-margin 4) > > in Calendar buffer hide month names on UP/DOWN moves. This sounds like Bug #10379 which should be fixed as of 24.1 by calendar mode resetting scroll-margin locally to 0. calendar.el:1748: (define-derived-mode calendar-mode nil "Calendar" ... (set (make-local-variable 'scroll-margin) 0) ; bug#10379 From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 11 11:28:59 2016 Received: (at 5718) by debbugs.gnu.org; 11 Aug 2016 15:28:59 +0000 Received: from localhost ([127.0.0.1]:54177 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bXrul-0001eX-Ic for submit@debbugs.gnu.org; Thu, 11 Aug 2016 11:28:59 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39170) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bXrui-0001eJ-T4 for 5718@debbugs.gnu.org; Thu, 11 Aug 2016 11:28:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXruZ-0007VF-TI for 5718@debbugs.gnu.org; Thu, 11 Aug 2016 11:28:51 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:60745) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXruV-0007UJ-9X; Thu, 11 Aug 2016 11:28:43 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1699 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bXruT-0005r9-DC; Thu, 11 Aug 2016 11:28:41 -0400 Date: Thu, 11 Aug 2016 18:28:32 +0300 Message-Id: <83fuqbfhpb.fsf@gnu.org> From: Eli Zaretskii To: npostavs@users.sourceforge.net In-reply-to: <87mvkjy0l5.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net) Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.5 (-----) X-Debbugs-Envelope-To: 5718 Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.5 (-----) > From: npostavs@users.sourceforge.net > Date: Thu, 11 Aug 2016 08:03:18 -0400 > Cc: 5718@debbugs.gnu.org, Oleksandr Gavenko > > >> lines real-scroll-margin > >> 3,4,5,6 1 > >> 7,8,9,10 2 > >> 11,12,13,14 3 > >>>15 4 > >> > >> I count from 3 as when try make less lines Emacs warn. > >> > >> I think that whose modify scroll-margin want to see as many > >> as possible margin value up to its customization value. > >> > >> This formula produce such values: > >> > >> best-scroll-margin = min( (line_count - 1)/2, scroll-margin) > >> > >> So previous table changed to: > >> > >> lines best-scroll-margin > >> 3,4 1 > >> 5,6 2 > >> 7,8 3 > >>>9 4 > >> > >> Also as you can see in proposal case > >> user switch start work from 9 lines in window, not 15! > >> > >> Please implement described behaviour. > > > > I'm having a hard time understanding this report. However, it seems > > like more like a wishlist request than a bug: you want to change the > > scrolling behavior. I'm going to change this to wishlist for now, but > > let me know if I've misunderstood, please. > > I think the complaint is that the `scroll-margin' effective value is > capped at a 1/4 of the window height, as seen in this > window_scroll_pixel_based (window.c): > > this_scroll_margin = max (0, scroll_margin); > this_scroll_margin > = min (this_scroll_margin, window_total_lines / 4); Which reveals a subtle bug: the actual scroll margin should be 1 for 7 lines, 2 for 11, etc. The problem is that the value of window_total_lines includes the mode line, which it shouldn't. Maybe this should be fixed. > Whereas, it seems more logical to cap it at half window height. No, I think it would leave too few lines for moving the cursor. This has been Emacs behavior since time immemoriam, so if we want to have a different behavior, it should be implemented an opt-in option, not the default. From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 12 10:54:22 2016 Received: (at 5718) by debbugs.gnu.org; 12 Aug 2016 14:54:22 +0000 Received: from localhost ([127.0.0.1]:55291 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYDqo-0004Yp-LY for submit@debbugs.gnu.org; Fri, 12 Aug 2016 10:54:22 -0400 Received: from mail-wm0-f54.google.com ([74.125.82.54]:34632) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYDqm-0004Yc-TD for 5718@debbugs.gnu.org; Fri, 12 Aug 2016 10:54:21 -0400 Received: by mail-wm0-f54.google.com with SMTP id q128so5029941wma.1 for <5718@debbugs.gnu.org>; Fri, 12 Aug 2016 07:54:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:organization:references:date:in-reply-to :message-id:user-agent:mime-version; bh=QwQOtDpHWSinKkfNSyTeJAfJwrxOjrD1+4/fbQWHS1I=; b=qIaYpR0fvX/1bn3T9vVt5Pfq2d4DA4B9H6Xf/wj9KIdFrXowALXYz3B5hVn8SBhKni GzerAUCs2q09o5S+MrpJlfJjMHCGq+BZiEH425ATKLk7WVskLMsyCjPHNqNzCgs16DlV IGdpdFvAmCzwoOGgdw4UMRdaFcAAnW3Uz2au504k/PCVOVe7qjBN/1pE8x7XFit7gojC LRH1CpQah4wIJz/rmAMdnnvVzmVdFr/x5+YY/rBpIBoWwWhdupq+ilGWu7F6MQKPlWEa sL+ZGwev+v879U0quLbwCNxXYlx0EDf2fdnCMkRJ5ecMgJAgEf9c13rafTi9Xusg9ouw TPLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:organization:references:date :in-reply-to:message-id:user-agent:mime-version; bh=QwQOtDpHWSinKkfNSyTeJAfJwrxOjrD1+4/fbQWHS1I=; b=NvQRf9YPAlkc7HDI5PpMHAFuBrtmqBK16MqFrBvWmQ+EeWiVtlizwcvrxgMihSYEzP MNnyajzE8ynaxgNDJgl9PyeKA6BV4wOLFuJHI+kkXPtto5oRoPgYgOXsiljwA0tqI8ZC 48lXKeFYqEU6Di9bELB9Snm6d/wOJftBzrEfq9DNqMwQh90rM1zpZ7z9Lg86LEeSEvKm rtB+lTgyhQATCcW6M0oKRaJ63Hs2wf60mYhXaZrMAKZ8J4Elzy9F9S9BRUuJgZbdojT+ rF6noZk53Eq1avj6ddMwM5e93fKtDhoqN5dNX///qGYfBGCY01J3oWxMO+zLIl74BIrk IDmA== X-Gm-Message-State: AEkooutENtib9fZmBY+gOgXSwEcMF1jT3uJlpfQzDANk2LLr3RGOiNhx+vWGLe+rbWKzcQ== X-Received: by 10.46.9.71 with SMTP id 68mr2270984ljj.0.1470988479809; Fri, 12 Aug 2016 00:54:39 -0700 (PDT) Received: from desktop ([46.185.21.165]) by smtp.gmail.com with ESMTPSA id n128sm718412lfb.45.2016.08.12.00.54.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 12 Aug 2016 00:54:38 -0700 (PDT) From: Oleksandr Gavenko To: Noam Postavsky Subject: Re: bug#5718: scroll-margin in buffer with small line count. Organization: Oleksandr Gavenko , http://defun.work/ References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <874m6rv4ju.fsf@gavenkoa.example.com> Date: Fri, 12 Aug 2016 10:54:37 +0300 In-Reply-To: (Noam Postavsky's message of "Thu, 11 Aug 2016 09:24:59 -0400") Message-ID: <87zioitoaq.fsf@gavenkoa.example.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 5718 Cc: Andrew Hyatt , 5718@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 2016-08-11, Noam Postavsky wrote: > On Thu, Aug 11, 2016 at 9:05 AM, Oleksandr Gavenko wrote: >> On reporting day I removed: >> >> (setq-default scroll-margin 4) >> >> from ~/.emacs because in "M-x calendar" UP/DOWN navigation become broken. >> >> Even in Emacs 24.5.1 setting >> >> (setq scroll-margin 4) >> >> in Calendar buffer hide month names on UP/DOWN moves. > > This sounds like Bug #10379 which should be fixed as of 24.1 by > calendar mode resetting scroll-margin locally to 0. > > calendar.el:1748: > > (define-derived-mode calendar-mode nil "Calendar" > ... > (set (make-local-variable 'scroll-margin) 0) ; bug#10379 I am agree, this was fixed. I made improperly test. -- http://defun.work/ From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 13 18:01:42 2016 Received: (at 5718) by debbugs.gnu.org; 13 Aug 2016 22:01:42 +0000 Received: from localhost ([127.0.0.1]:56610 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYgzu-0001Qt-D8 for submit@debbugs.gnu.org; Sat, 13 Aug 2016 18:01:42 -0400 Received: from mail-it0-f48.google.com ([209.85.214.48]:38088) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYgzs-0001Qf-5B for 5718@debbugs.gnu.org; Sat, 13 Aug 2016 18:01:40 -0400 Received: by mail-it0-f48.google.com with SMTP id c13so1912098ith.1 for <5718@debbugs.gnu.org>; Sat, 13 Aug 2016 15:01:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=muawG+T2jJzpoEfZ9t7cc2R9yD9Uo6iHSF+t4I8SW04=; b=DsEGcaL2J11fO8ID+bZdaOipSYPRf9MlC8kq2g7/SqtlPcHCxeLAehlXQpSCoxMzxj /b3YR1gk1EhJN6Ki6d7QMZAUKDKQvdfz6oWGIuIMrZH+bGJOIF1sFMsGs57KwV+Iae+q E0EbI/sDDJuI09U3ElCLp3VW7px2H1Zpoa2LbnQvxrZqmjEWWhiEny2auzJIoljNcUPe SrGyAUt8ZOtyct9ukxiX/KKrzFhzAW/H6Bm02DiIAEF18fb1NbSiOfyROEe65zwCsa18 dfamMaRvUqDbuQu9ftD7QpiK8xW4ZfcEcROKg6PE8bJSAnTN/iwnmTzgK6dZEUXl/iTq qRcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=muawG+T2jJzpoEfZ9t7cc2R9yD9Uo6iHSF+t4I8SW04=; b=XXci+Lkawhv/5c6/MsM4KQ95n0249BJuYuANWX/nsWWsVHh6b0trpro0cj1tyNev5m nS2A9KIJ4mgLeipf4Z3YOK37aawk6hiqbKXjKvUJhDmFhESbfgmMR59o2+0EVSbR7mzd PO+8MMLiFj16M2Yt9JDWl4OlELEuYvBiO4+kbyQrckB6agCTVQ2/n/1W1MycajgKN/lk M+DYYrdxpHWEP7DTVZD/4wGQq3a6XAZgawBT1lMgsBq+P3ZdSE81pVcUe0M1rii8qTNf rIq3Ci+YH5KYiCVzkAkMyjcZpAVJvBGURFVBNDq+mIAPDbPb2VpBDXebxChhEToQYUUB U6ug== X-Gm-Message-State: AEkoousfiyQCMaccYtYLM63/nkL5tsSuR2u0UUzPqGwyoxbAM6krZYnxsUgPztRLd4bWjQ== X-Received: by 10.36.17.140 with SMTP id 134mr5903551itf.70.1471125694602; Sat, 13 Aug 2016 15:01:34 -0700 (PDT) Received: from zony (206-188-64-44.cpe.distributel.net. [206.188.64.44]) by smtp.googlemail.com with ESMTPSA id o15sm5127869ith.2.2016.08.13.15.01.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 13 Aug 2016 15:01:33 -0700 (PDT) From: npostavs@users.sourceforge.net To: Eli Zaretskii Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> Date: Sat, 13 Aug 2016 18:01:43 -0400 In-Reply-To: <83fuqbfhpb.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 11 Aug 2016 18:28:32 +0300") Message-ID: <87a8ggwcoo.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 5718 Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Eli Zaretskii writes: >> >> I think the complaint is that the `scroll-margin' effective value is >> capped at a 1/4 of the window height, as seen in this >> window_scroll_pixel_based (window.c): >> >> this_scroll_margin = max (0, scroll_margin); >> this_scroll_margin >> = min (this_scroll_margin, window_total_lines / 4); > > Which reveals a subtle bug: the actual scroll margin should be 1 for 7 > lines, 2 for 11, etc. The problem is that the value of > window_total_lines includes the mode line, which it shouldn't. Maybe > this should be fixed. I was looking at fixing it, but I got confused by this comment in window.h: /* Height in pixels, and in lines, of the mode line. May be zero if W doesn't have a mode line. */ #define WINDOW_MODE_LINE_HEIGHT(W) \ How is the height "in pixels, and in lines"? Doesn't it have to be one or the other? > >> Whereas, it seems more logical to cap it at half window height. > > No, I think it would leave too few lines for moving the cursor. This > has been Emacs behavior since time immemoriam, so if we want to have a > different behavior, it should be implemented an opt-in option, not the > default. Yes, sure. This is about Emacs' behaviour after the user has customized scroll-margin, so the default isn't in question anyway. I imagine something like this: DEFVAR_LISP ("minimum-non-scroll-lines", Vminimum_non_scroll_lines, doc: /* Lines around window's center where `scoll-margin' doesn't apply. If point is within this many lines from the window's center, it will not cause scrolling regardless of the value of `scroll-margin'. If this is a float then it represents a fraction of the current window's lines. */); Vminimum_non_scroll_lines = make_float (1.0/4.0); And then setting this to 1 would make scroll-margin have the effect that the OP expects. From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 13 22:36:37 2016 Received: (at 5718) by debbugs.gnu.org; 14 Aug 2016 02:36:37 +0000 Received: from localhost ([127.0.0.1]:56670 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYlHw-0008Og-UW for submit@debbugs.gnu.org; Sat, 13 Aug 2016 22:36:37 -0400 Received: from eggs.gnu.org ([208.118.235.92]:50627) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYlHv-0008OV-Tg for 5718@debbugs.gnu.org; Sat, 13 Aug 2016 22:36:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bYlHp-0007zy-SX for 5718@debbugs.gnu.org; Sat, 13 Aug 2016 22:36:30 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_40,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:40114) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bYlHj-0007wt-O0; Sat, 13 Aug 2016 22:36:23 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2123 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bYlHi-0001Zi-Pv; Sat, 13 Aug 2016 22:36:23 -0400 Date: Sun, 14 Aug 2016 05:36:19 +0300 Message-Id: <83inv4cc0s.fsf@gnu.org> From: Eli Zaretskii To: npostavs@users.sourceforge.net In-reply-to: <87a8ggwcoo.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net) Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> <87a8ggwcoo.fsf@users.sourceforge.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.6 (-----) X-Debbugs-Envelope-To: 5718 Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.6 (-----) > From: npostavs@users.sourceforge.net > Cc: 5718@debbugs.gnu.org, ahyatt@gmail.com, gavenkoa@gmail.com > Date: Sat, 13 Aug 2016 18:01:43 -0400 > > >> this_scroll_margin = max (0, scroll_margin); > >> this_scroll_margin > >> = min (this_scroll_margin, window_total_lines / 4); > > > > Which reveals a subtle bug: the actual scroll margin should be 1 for 7 > > lines, 2 for 11, etc. The problem is that the value of > > window_total_lines includes the mode line, which it shouldn't. Maybe > > this should be fixed. > > I was looking at fixing it, but I got confused by this comment in > window.h: > > /* Height in pixels, and in lines, of the mode line. > May be zero if W doesn't have a mode line. */ > #define WINDOW_MODE_LINE_HEIGHT(W) \ > > How is the height "in pixels, and in lines"? Doesn't it have to be one > or the other? It's in pixels. The comment should be fixed. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 11 16:57:57 2016 Received: (at 5718) by debbugs.gnu.org; 11 Sep 2016 20:57:57 +0000 Received: from localhost ([127.0.0.1]:56811 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjBp6-0002Ae-TT for submit@debbugs.gnu.org; Sun, 11 Sep 2016 16:57:57 -0400 Received: from mail-oi0-f51.google.com ([209.85.218.51]:33768) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjBp4-0002AP-67 for 5718@debbugs.gnu.org; Sun, 11 Sep 2016 16:57:54 -0400 Received: by mail-oi0-f51.google.com with SMTP id y2so269225578oie.0 for <5718@debbugs.gnu.org>; Sun, 11 Sep 2016 13:57:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=BTypXMY/hhKelU3k1ShGbVOaLcMjqXbCf2RCePlQ1xU=; b=g8/Oxs3y/kiPTT9/LCyX6zkSclMxhXclLmHF4NCtD/e7HjjuDNdBOfvzKWTPeGZr4z ezrJcVl5dfNtAG/IQF69rhTrMxQEvAymo/01tdsgutA+IzBxwilI4iirgdTL8frcy+re H/0nEX8lPaI4SyddJLyslsi+T+MVZnBFroI790szx/ffPXbbcVhOcoidnAgQFsxSwuof Xp9GX+J0oJV1DOL0D18iOueYOi01VulKHVsWYjdhMAi6OVZ2vJGtM7etHCmkiowZQojw lXicaUImgZTv6KlnncY84FGHITfWs55wrWm5GJMRilmMLZ6W4qoDVm0Oe57AiSfaO9FW iqKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=BTypXMY/hhKelU3k1ShGbVOaLcMjqXbCf2RCePlQ1xU=; b=Ut93Nx9dm9fMi38X8C8YQNR6MrKUwnv+pt6I60FAcgxjrSqfHoDzgdlEALfaKoi683 4c9jaZFIl7Utwjh8EMMfehr5MUVgcufWubGLQ5se35KKmHfNf6OwqLmPoTzPTFVoB+KC xx1cDq/YZVxM6kW3NiGpt4QMV7Tm6oNSvdmjKGrVUTFvEW8/U4uoWXeXBFkfC42uGwgd tiNwpRvoYBlB1ah+b/B1Gw2jcXaGqD9bP6WwgFCP0W34dLtzQNZrIVtTWmtDFBKuPXyG X8e7qAxRo9KbYY2Iav7JCXA8VxRPEOEvs1NCp1bV0nohy6MN+PsEzsPu0x+SfV/jyl/n hqLw== X-Gm-Message-State: AE9vXwN3/A2udXdkcKMwCDYGvOpb4VY/wFeROgGq3dajZH3BWdzkDtSvu2Erp+20xMDXPg== X-Received: by 10.157.38.167 with SMTP id l36mr19681855otb.59.1473627468375; Sun, 11 Sep 2016 13:57:48 -0700 (PDT) Received: from zony ([45.2.7.130]) by smtp.googlemail.com with ESMTPSA id z125sm13713621itc.0.2016.09.11.13.57.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 11 Sep 2016 13:57:47 -0700 (PDT) From: npostavs@users.sourceforge.net To: Eli Zaretskii Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> <87a8ggwcoo.fsf@users.sourceforge.net> <83inv4cc0s.fsf@gnu.org> Date: Sun, 11 Sep 2016 16:58:08 -0400 In-Reply-To: <83inv4cc0s.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 14 Aug 2016 05:36:19 +0300") Message-ID: <87d1ka17dr.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 5718 Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: npostavs@users.sourceforge.net >> Cc: 5718@debbugs.gnu.org, ahyatt@gmail.com, gavenkoa@gmail.com >> Date: Sat, 13 Aug 2016 18:01:43 -0400 >> >> >> this_scroll_margin = max (0, scroll_margin); >> >> this_scroll_margin >> >> = min (this_scroll_margin, window_total_lines / 4); >> > >> > Which reveals a subtle bug: the actual scroll margin should be 1 for 7 >> > lines, 2 for 11, etc. The problem is that the value of >> > window_total_lines includes the mode line, which it shouldn't. Maybe >> > this should be fixed. I have a patch set for fixing this and allowing the user to change the maximum margin from 0.25. The latter doesn't quite work perfectly, for some reason when setting the maximum margin to 0.5 and scroll-margin to 100, `scroll-down-command' doesn't keep point centered in the window, even though other commands (e.g. `scroll-up-command') do. The patches come with tests demonstrating this (the tests only work in interactive mode). --=-=-= Content-Type: application/octet-stream Content-Disposition: attachment; filename=v1-0001-Refactor-uses-of-scroll_margin-to-a-function.patch.gz Content-Transfer-Encoding: base64 Content-Description: compressed patch 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 dTIYKpSNafsRi3xAh2lGYcotpSAMsLkyBnS5wN+xQdSQWnsg875fgTa3eToeabbijrmu/auHE4ZY ntSjFk084ubkbokEteErL84cuQJ7EtcKKFQNdqm+ExWhdkM2T9iyuxFuvMdox4awEgkx1vBtuQ25 n+7uNNueEjLPgi/tONRm++D79FWq8tswDbEW+tM9sx+izsARy77ZDoeXc1uxfw/X24uBl5aXKBN/ /eVxomVtd47HnoorjalxllDj5hsjsl7vw9Hp4TXKRSMRZ+Pn48UGg4SnKaqT/LIMXa4+/MlYq9qm s1NXXNZ0zO7o87jss4TpihDCX0gampHK4ki/PzaWNGc+ns+Kqcl4Ke9wVqwOcJSEqNEJHhzsly/G M5lvpGF3ajYwX4RZdc7kL2Ztm+Di0u312VdzluY2vaYn2/Om1/Bm/eVDgS5tfKWYi9ggrZT2vsuC UBKCtDEvDeEb+2/76UeV5nCPfeJAmaM2pu8Kh3N5pzt3OrF4JPGPOIyqs/xDL1Sq8Pr3znH+debj dqvqKifvNGed4jOdTPy5Lr/CC+hc/+7rJDo6PT761Vegu6mYhH/xAn64OLs8M6O0gFkm2jJF9Dfx 8P+JYn3O+diyapVhnnHDlIjBWUMEkxKc/e8AwuuaivP84Jdl50cSla1tLPbuNqKytb3tKtVa+A9i yxutlYXTn0idzYDufLDXgTCeU6L5WblJJw20VQ2l7lkLdfk5XeJDO0mPrTqoYb6C2/JjVtBa/IGj unKUmof4dpzS6IILgf7PTuf67KN/LXc57YOApyGWczSUJeF9daHmVOyDgiD+LkDOLX2vpenMWMqL UqhjTmBGFFVSBenk9fHb35BRbLC8WrtWt6z/AVq7qodhKwAA --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=v1-0002-Don-t-count-mode-line-for-scroll-margin-limit.patch Content-Description: patch >From 0f3a50fa311e6ec1ccb1a0d03d521cc2ef9b309a Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sun, 28 Aug 2016 17:23:04 -0400 Subject: [PATCH v1 2/3] Don't count mode line for scroll-margin limit * src/window.c (window_scroll_margin): Subtract mode line height from upper limit applied to scroll margin (Bug #5718). * test/src/window-tests.el: New tests for scroll-margin behavior. --- src/window.c | 3 +- test/src/window-tests.el | 86 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 test/src/window-tests.el diff --git a/src/window.c b/src/window.c index 2046fe7..dbda435 100644 --- a/src/window.c +++ b/src/window.c @@ -4800,7 +4800,8 @@ window_scroll_margin (struct window *window, enum margin_unit unit) { int frame_line_height = default_line_pixel_height (window); int window_total_lines - = window->total_lines * WINDOW_FRAME_LINE_HEIGHT (window) + = (window->total_lines * WINDOW_FRAME_LINE_HEIGHT (window) + - WINDOW_MODE_LINE_HEIGHT (window)) / frame_line_height; int margin = min (scroll_margin, window_total_lines / 4); if (unit == MARGIN_IN_PIXELS) diff --git a/test/src/window-tests.el b/test/src/window-tests.el new file mode 100644 index 0000000..88ded18 --- /dev/null +++ b/test/src/window-tests.el @@ -0,0 +1,86 @@ +;;; window-tests.el -- tests for window.c -*- lexical-binding: t -*- + +;; Copyright (C) 2016 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Code: + +(require 'ert) + +(defun window-test-scrolling (margin &optional effective-margin) + (unless effective-margin + (setq effective-margin margin)) + (erase-buffer) + (insert (mapconcat #'number-to-string + (number-sequence 1 200) "\n")) + (goto-char 1) + (sit-for 0) + (let ((scroll-margin margin) + (mode-lines (/ (window-mode-line-height) (line-pixel-height))) + (wstart (window-start))) + ;; Stopping before `scroll-margin' so we shouldn't have + ;; scrolled. + (let ((current-prefix-arg (- (window-height) + mode-lines (window-start) effective-margin))) + (call-interactively 'next-line)) + (sit-for 0) + (should (= wstart (window-start))) + ;; Passing `scroll-margin' should trigger scrolling. + (call-interactively 'next-line) + (sit-for 0) + (should (/= wstart (window-start))) + ;; Scroll back to top. + (let ((current-prefix-arg (window-start))) + (call-interactively 'scroll-down-command)) + (sit-for 0) + (should (= 1 (window-start))))) + +(defmacro window-with-test-buffer-window (&rest body) + (let ((bufvar (make-symbol "buf"))) + `(let ((,bufvar (get-buffer-create "*test*"))) + (with-selected-window (display-buffer ,bufvar) + (with-current-buffer ,bufvar + ,@body))))) + +(ert-deftest window-test-scroll-margin-0 () + (skip-unless (not noninteractive)) + (window-with-test-buffer-window + (window-test-scrolling 0))) + +(ert-deftest window-test-scroll-margin-negative () + "A negative `scroll-margin' should be the same as 0." + (skip-unless (not noninteractive)) + (window-with-test-buffer-window + (window-test-scrolling -10 0))) + +(ert-deftest window-test-scroll-margin-max () + (skip-unless (not noninteractive)) + (window-with-test-buffer-window + (let* ((mode-lines (/ (window-mode-line-height) (line-pixel-height))) + (max-margin (/ (- (window-height) mode-lines) 4))) + (window-test-scrolling max-margin)))) + +(ert-deftest window-test-scroll-margin-over-max () + "A `scroll-margin' more than max should be the same as max." + (skip-unless (not noninteractive)) + (window-with-test-buffer-window + ;; Check that mode line is not counted for determining max margin. + (set-window-text-height nil 7) + (let* ((mode-lines (/ (window-mode-line-height) (line-pixel-height))) + (max-margin (/ (- (window-height) mode-lines) 4))) + (window-test-scrolling (+ max-margin 1) max-margin) + (window-test-scrolling (+ max-margin 2) max-margin)))) -- 2.9.3 --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=v1-0003-BROKEN-Make-limit-on-scroll-margin-variable.patch Content-Description: patch >From 0697341a9cdc1f9962a7b984e2a8ffe5150831f5 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sun, 11 Sep 2016 11:09:57 -0400 Subject: [PATCH v1 3/3] [BROKEN] Make limit on scroll-margin variable [BROKEN]: The `scroll-down-command' doesn't stay in the middle of the window. * src/xdisp.c (maximum-scroll-margin): New variable. * src/window.c (window_scroll_pixel_based): Use it instead of hardcoding division by 4 (Bug #5718). * test/src/window-tests.el (window-test-scroll-margin-whole-window): Test it. --- src/window.c | 13 ++++++++++++- src/xdisp.c | 5 +++++ test/src/window-tests.el | 30 ++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/src/window.c b/src/window.c index dbda435..20a7f3a 100644 --- a/src/window.c +++ b/src/window.c @@ -4803,7 +4803,18 @@ window_scroll_margin (struct window *window, enum margin_unit unit) = (window->total_lines * WINDOW_FRAME_LINE_HEIGHT (window) - WINDOW_MODE_LINE_HEIGHT (window)) / frame_line_height; - int margin = min (scroll_margin, window_total_lines / 4); + + int margin, max_margin; + double ratio = 0.25; + if (FLOATP (Vmaximum_scroll_margin)) + { + ratio = XFLOAT_DATA (Vmaximum_scroll_margin); + ratio = max (0.0, ratio); + ratio = min (ratio, 0.5); + } + max_margin = (int) (window_total_lines * ratio); + margin = max (0, scroll_margin); + margin = min (scroll_margin, max_margin); if (unit == MARGIN_IN_PIXELS) return margin * frame_line_height; else diff --git a/src/xdisp.c b/src/xdisp.c index 3602025..b22242a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -31451,6 +31451,11 @@ Recenter the window whenever point gets within this many lines of the top or bottom of the window. */); scroll_margin = 0; + DEFVAR_LISP ("maximum-scroll-margin", Vmaximum_scroll_margin, + doc: /* Maximum effective value of `scroll-margin'. +Given as a fraction of the current window's lines. */); + Vmaximum_scroll_margin = make_float (0.25); + DEFVAR_LISP ("display-pixels-per-inch", Vdisplay_pixels_per_inch, doc: /* Pixels per inch value for non-window system displays. Value is a number or a cons (WIDTH-DPI . HEIGHT-DPI). */); diff --git a/test/src/window-tests.el b/test/src/window-tests.el index 88ded18..c6152c8 100644 --- a/test/src/window-tests.el +++ b/test/src/window-tests.el @@ -50,6 +50,7 @@ window-test-scrolling (should (= 1 (window-start))))) (defmacro window-with-test-buffer-window (&rest body) + (declare (debug t)) (let ((bufvar (make-symbol "buf"))) `(let ((,bufvar (get-buffer-create "*test*"))) (with-selected-window (display-buffer ,bufvar) @@ -84,3 +85,32 @@ window-with-test-buffer-window (max-margin (/ (- (window-height) mode-lines) 4))) (window-test-scrolling (+ max-margin 1) max-margin) (window-test-scrolling (+ max-margin 2) max-margin)))) + +(defun window-test--point-in-middle-of-window-p () + (= (count-lines (window-start) (window-point)) + (- (count-lines (window-point) (window-end)) 1 + (if (pos-visible-in-window-p (window-end)) 0 1)))) + +(ert-deftest window-test-scroll-margin-whole-window () + "Test `maximum-scroll-margin' at 0.5. +With a high `scroll-margin', this should keep cursor in the +middle of the window." + (skip-unless (not noninteractive)) + (let ((maximum-scroll-margin 0.5) + (scroll-margin 100)) + (window-with-test-buffer-window + (set-window-text-height nil 7) + (erase-buffer) + (insert (mapconcat #'number-to-string + (number-sequence 1 200) "\n")) + (goto-char 1) + (sit-for 0) + (call-interactively 'scroll-up-command) + (sit-for 0) + (should (window-test--point-in-middle-of-window-p)) + (call-interactively 'scroll-up-command) + (sit-for 0) + (should (window-test--point-in-middle-of-window-p)) + (call-interactively 'scroll-down-command) + (sit-for 0) + (should (window-test--point-in-middle-of-window-p))))) -- 2.9.3 --=-=-= Content-Type: text/plain >> >> >> /* Height in pixels, and in lines, of the mode line. >> May be zero if W doesn't have a mode line. */ >> #define WINDOW_MODE_LINE_HEIGHT(W) \ >> >> How is the height "in pixels, and in lines"? Doesn't it have to be one >> or the other? > > It's in pixels. The comment should be fixed. Fixed pushed as ea0f750e, "Fix comments on window height macros" --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 12 02:20:29 2016 Received: (at 5718) by debbugs.gnu.org; 12 Sep 2016 06:20:29 +0000 Received: from localhost ([127.0.0.1]:56968 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjKbU-00075m-Ul for submit@debbugs.gnu.org; Mon, 12 Sep 2016 02:20:29 -0400 Received: from mout.gmx.net ([212.227.17.21]:59765) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjKbT-00075Z-Pa for 5718@debbugs.gnu.org; Mon, 12 Sep 2016 02:20:28 -0400 Received: from [192.168.1.100] ([212.95.7.85]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0MCxfb-1brtJt44wd-009kcI; Mon, 12 Sep 2016 08:20:07 +0200 Message-ID: <57D6490F.1000103@gmx.at> Date: Mon, 12 Sep 2016 08:19:59 +0200 From: martin rudalics MIME-Version: 1.0 To: npostavs@users.sourceforge.net, Eli Zaretskii Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> <87a8ggwcoo.fsf@users.sourceforge.net> <83inv4cc0s.fsf@gnu.org> <87d1ka17dr.fsf@users.sourceforge.net> In-Reply-To: <87d1ka17dr.fsf@users.sourceforge.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K0:szjuv+g3ZTxjuwTB/BMxB+NDSSpScmEXweih1I75Zy202oj656c YqJFpdIHcUTiNRV5X8pySa+RILOYCqZZFQw/Ejn/jM76rFa3TJwgqG/ctPev+ZC3LPsXlPJ iiokfR6y7oSPXcbXW0F7sBFo9r36WWahILzO+c2JavPeY4Bfz0e7UxpuSo07CPdWKFuBW8T do8xVSZafhvf6ATsM+PQA== X-UI-Out-Filterresults: notjunk:1;V01:K0:9V0MozD7ww0=:7CDKmFA4INMLy+okVlAvIA NYbtoUxjC7y+GyiCfJWRScyb1+Ns0WdzhJniyu9Eu6siwJ7ER7VorfNml1xtGIe5fGTcWnYQ2 /oIZod7742Z4jDnJw1xFyuThuNlxpOrEz/U+R+ctn5M+CDzerbOsyF5maIfGfdRM4OMuP+Ktk rN7BUXG/UlbR4wrwkZeMBr7CdflCi7nMoa2qfS7+LW3/DE2r1ldMTNefE21QRvsz5QMj4r+y4 g91SN2SxODQyikTVCXI+HXqk7nRGgactA0cr90ns0XCc9NlyDkrA0fqqMEc99xBsVHVj5OZLW CoFu35hhEr+09GrukpNPcbVnoz8whaT00LBwSP3/UhygZQGtk6S6TuVCKR0s0x3tylu4ZYslr nlCyZyRA569VcHW+WIIB17pdXArzIFjqe3WX1H/MfQ5kB493m7btYgdBs40LVqvrn9uTYVsuU sXq9NIhTE4RGgxyv4lRCJl6z736ulSh1+lbArQRVyQkXhb6QiWxrBKYq4XnsQhf4qVfWjOLGj cMEGaDjpRJDeVvqZFxkBFI1l+QGKzZZ8L2DZjD1+cEtP5rYgpfGa4nvAm3U2mB38BVMwjM2de yuWS9Gv2VnwKJ1uVn0YE4tx0cr/kHt4gE9WSfe8D6N3w1ATuJk2HdE0td02757VVrKy7B167V Hct85kR8ch7wJjFX9eUUfTd9NTiWSj8egB/QRjuHjIvE8JWy1e3f2gQ18SqeD/ulMjhqi8/5z LzEYbw2wT4k/5SiGtUvs/dZfZHT1aAXi5zt01tJxGLqYb9LQxZLDN0uFPXHzuZtTQfoRKwftT H0HCSink+CDv9Q35hAKIdQC6uRjxQ== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 5718 Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) > I have a patch set for fixing this and allowing the user to change the= > maximum margin from 0.25. The latter doesn't quite work perfectly, fo= r > some reason when setting the maximum margin to 0.5 and scroll-margin t= o > 100, `scroll-down-command' doesn't keep point centered in the window, > even though other commands (e.g. `scroll-up-command') do. The patches= > come with tests demonstrating this (the tests only work in interactive= > mode). Thank you. int window_total_lines - =3D window->total_lines * WINDOW_FRAME_LINE_HEIGHT (window) + =3D (window->total_lines * WINDOW_FRAME_LINE_HEIGHT (window) + - WINDOW_MODE_LINE_HEIGHT (window)) Please use another name instead of "window_total_lines" here. And please explain why you can't use Fwindow_text_height here (i.e., why header lines, horizontal scrollbars and window dividers apparently don't count). +(defmacro window-with-test-buffer-window (&rest body) Please call it =E2=80=98window-test-with-test-buffer-window=E2=80=99 to c= onsistentlyy keep the =E2=80=98window-test-=E2=80=99 prefix on everything defined in t= his file. martin From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 12 13:36:51 2016 Received: (at 5718) by debbugs.gnu.org; 12 Sep 2016 17:36:51 +0000 Received: from localhost ([127.0.0.1]:57890 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjVA3-00011V-3D for submit@debbugs.gnu.org; Mon, 12 Sep 2016 13:36:51 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36651) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjVA1-00011J-9G for 5718@debbugs.gnu.org; Mon, 12 Sep 2016 13:36:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjV9u-0007B3-6J for 5718@debbugs.gnu.org; Mon, 12 Sep 2016 13:36:43 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:40401) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjV9n-00077l-Kt; Mon, 12 Sep 2016 13:36:35 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1902 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bjV9h-00074M-5t; Mon, 12 Sep 2016 13:36:34 -0400 Date: Mon, 12 Sep 2016 20:36:14 +0300 Message-Id: <834m5l9g1d.fsf@gnu.org> From: Eli Zaretskii To: npostavs@users.sourceforge.net In-reply-to: <87d1ka17dr.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net) Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> <87a8ggwcoo.fsf@users.sourceforge.net> <83inv4cc0s.fsf@gnu.org> <87d1ka17dr.fsf@users.sourceforge.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -7.3 (-------) X-Debbugs-Envelope-To: 5718 Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -7.3 (-------) > From: npostavs@users.sourceforge.net > Cc: 5718@debbugs.gnu.org, ahyatt@gmail.com, gavenkoa@gmail.com > Date: Sun, 11 Sep 2016 16:58:08 -0400 > > >> >> this_scroll_margin = max (0, scroll_margin); > >> >> this_scroll_margin > >> >> = min (this_scroll_margin, window_total_lines / 4); > >> > > >> > Which reveals a subtle bug: the actual scroll margin should be 1 for 7 > >> > lines, 2 for 11, etc. The problem is that the value of > >> > window_total_lines includes the mode line, which it shouldn't. Maybe > >> > this should be fixed. > > I have a patch set for fixing this and allowing the user to change the > maximum margin from 0.25. The latter doesn't quite work perfectly, for > some reason when setting the maximum margin to 0.5 and scroll-margin to > 100, `scroll-down-command' doesn't keep point centered in the window, > even though other commands (e.g. `scroll-up-command') do. Thanks, LGTM. However, I think we need to solve those glitches as part of introducing the feature. Setting a margin to half the window size makes centering point difficult, but since some commands do succeed, I'm guessing that those commands which succeed have a bug, i.e. they leave point inside the margin. Is that indeed so? Also, did you test these changes with scroll-conservatively set to 101? If not, please do, as that setting activates some code parts that no other option does. A few comments below. > @@ -16527,10 +16507,8 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) > /* Some people insist on not letting point enter the scroll > margin, even though this part handles windows that didn't > scroll at all. */ > - int window_total_lines > - = WINDOW_TOTAL_LINES (w) * FRAME_LINE_HEIGHT (f) / frame_line_height; > - int margin = min (scroll_margin, window_total_lines / 4); > - int pixel_margin = margin * frame_line_height; > + int margin = window_scroll_margin (w, MARGIN_IN_LINES); > + int pixel_margin = margin * frame_line_height; > bool header_line = WINDOW_WANTS_HEADER_LINE_P (w); > /* Note: We add an extra FRAME_LINE_HEIGHT, because the loop > @@ -16814,12 +16792,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) > it.current_y = it.last_visible_y; > if (centering_position < 0) > { > - int window_total_lines > - = WINDOW_TOTAL_LINES (w) * FRAME_LINE_HEIGHT (f) / frame_line_height; > - int margin > - = scroll_margin > 0 > - ? min (scroll_margin, window_total_lines / 4) > - : 0; > + int margin = window_scroll_margin (w, MARGIN_IN_LINES); > ptrdiff_t margin_pos = CHARPOS (startp); > Lisp_Object aggressive; > bool scrolling_up; > @@ -17063,10 +17036,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) > { > int window_total_lines > = WINDOW_TOTAL_LINES (w) * FRAME_LINE_HEIGHT (f) / frame_line_height; > - int margin = > - scroll_margin > 0 > - ? min (scroll_margin, window_total_lines / 4) > - : 0; > + int margin = window_scroll_margin (w, MARGIN_IN_LINES); > bool move_down = w->cursor.vpos >= window_total_lines / 2; Here you call window_scroll_margin 3 times in the same function. Any way of doing that only once and reusing the result? > @@ -17298,17 +17267,7 @@ try_window (Lisp_Object window, struct text_pos pos, int flags) > if ((flags & TRY_WINDOW_CHECK_MARGINS) > && !MINI_WINDOW_P (w)) > { > - int this_scroll_margin; > - int window_total_lines > - = WINDOW_TOTAL_LINES (w) * FRAME_LINE_HEIGHT (f) / frame_line_height; > - > - if (scroll_margin > 0) > - { > - this_scroll_margin = min (scroll_margin, window_total_lines / 4); > - this_scroll_margin *= frame_line_height; > - } > - else > - this_scroll_margin = 0; > + int this_scroll_margin = window_scroll_margin (w, MARGIN_IN_PIXELS); > if ((w->cursor.y >= 0 /* not vscrolled */ > && w->cursor.y < this_scroll_margin > @@ -18592,15 +18551,8 @@ try_window_id (struct window *w) > /* Don't let the cursor end in the scroll margins. */ > { > - int this_scroll_margin, cursor_height; > - int frame_line_height = default_line_pixel_height (w); > - int window_total_lines > - = WINDOW_TOTAL_LINES (w) * FRAME_LINE_HEIGHT (it.f) / frame_line_height; > - > - this_scroll_margin = > - max (0, min (scroll_margin, window_total_lines / 4)); > - this_scroll_margin *= frame_line_height; > - cursor_height = MATRIX_ROW (w->desired_matrix, w->cursor.vpos)->height; > + int this_scroll_margin = window_scroll_margin (w, MARGIN_IN_PIXELS); > + int cursor_height = MATRIX_ROW (w->desired_matrix, w->cursor.vpos)->height; > if ((w->cursor.y < this_scroll_margin > && CHARPOS (start) > BEGV) Same here (in another function). > diff --git a/src/window.c b/src/window.c > index dbda435..20a7f3a 100644 > --- a/src/window.c > +++ b/src/window.c > @@ -4803,7 +4803,18 @@ window_scroll_margin (struct window *window, enum margin_unit unit) > = (window->total_lines * WINDOW_FRAME_LINE_HEIGHT (window) > - WINDOW_MODE_LINE_HEIGHT (window)) > / frame_line_height; > - int margin = min (scroll_margin, window_total_lines / 4); > + > + int margin, max_margin; > + double ratio = 0.25; > + if (FLOATP (Vmaximum_scroll_margin)) > + { > + ratio = XFLOAT_DATA (Vmaximum_scroll_margin); > + ratio = max (0.0, ratio); > + ratio = min (ratio, 0.5); > + } > + max_margin = (int) (window_total_lines * ratio); > + margin = max (0, scroll_margin); > + margin = min (scroll_margin, max_margin); > if (unit == MARGIN_IN_PIXELS) > return margin * frame_line_height; > else > diff --git a/src/xdisp.c b/src/xdisp.c > index 3602025..b22242a 100644 > --- a/src/xdisp.c > +++ b/src/xdisp.c > @@ -31451,6 +31451,11 @@ Recenter the window whenever point gets within this many lines > of the top or bottom of the window. */); > scroll_margin = 0; > > + DEFVAR_LISP ("maximum-scroll-margin", Vmaximum_scroll_margin, > + doc: /* Maximum effective value of `scroll-margin'. > +Given as a fraction of the current window's lines. */); "as a fraction of the current window's height" sounds better, I think. (It doesn't matter if the height is in lines or in pixels, for this purpose.) > + Vmaximum_scroll_margin = make_float (0.25); > + We usually call such variables "max-SOMETHING", not "maximum-SOMETHING". Also, the actual value is limited by 0.5, but the doc string doesn't tell that. It also doesn't say that any non-float value is ignored. Finally, the new variable needs to be documented in the user manual and in NEWS. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 13 22:22:54 2016 Received: (at 5718) by debbugs.gnu.org; 14 Sep 2016 02:22:54 +0000 Received: from localhost ([127.0.0.1]:59027 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjzqf-0002u0-RH for submit@debbugs.gnu.org; Tue, 13 Sep 2016 22:22:54 -0400 Received: from mail-it0-f52.google.com ([209.85.214.52]:38108) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjzqc-0002tl-RL for 5718@debbugs.gnu.org; Tue, 13 Sep 2016 22:22:51 -0400 Received: by mail-it0-f52.google.com with SMTP id n143so4264311ita.1 for <5718@debbugs.gnu.org>; Tue, 13 Sep 2016 19:22:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=43BUcs29/BqNyhd1aWG60d5jrXUaXADu1r222yTMqP0=; b=OuvrlaqeicyojNsBvErVzxmYUUstxfGQONKVBEApX9LaTKMZoujsmhCPM7FX4EvvDg wbjd2r6qyaAgXIOsQDozTWSdCxAA3iOZhr1+OKlX0pyS6g46f2Ks8IpjleCNwAEyJunH 90q6E5x+sploOZE/d1pYdwK9vMFO8gSlY5Bpymt7rMmXTmK1t/Y24Tke56OzElF4rcpN L5QYGRdzuwI5dK8XDRLjrG9ff4jSbq0qSHis+SpwHTEB0lL1nyzwd7cERemHg6EZ64yY SYJutjVnmaJ8xvx0SoVRG7gtGs1EqvErQMUaRhQyW5zFsdkDBPFQmpOrhATdTKFjlPEp NjyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version :content-transfer-encoding; bh=43BUcs29/BqNyhd1aWG60d5jrXUaXADu1r222yTMqP0=; b=RxeXBzjjg0F+GQz9373Nv1+Kdde1x5nkrqP7QIZZjC1MosAs7Q0kh6Lgy0EYwJLMY5 hm7gf3WNE98QXahZP6xaUbsxntv5JxTECSCfGjw3yd0ghYlOfS9OCL20EQAe5Q6GQlWF ogdL2wmEfvdgJWKOvkbWyGJtviYqR+gae5yws7nFOOoKSTye4CO5+G1/BxogdHwlcuWi L/4kQyaQBocryYZLzxOg/ErRnj+hzBI/5svnlSYwDAnEiqj0tD5UMHpShKkGe7Ty0B8m ZhCrLKkMFFe8t/C6qP813nVh6GHwmULmEmAEEsFCb6WEZvxh1L6cGVuYFbEFkk+EDKTl ev4A== X-Gm-Message-State: AE9vXwOAG2VF9ZfuKx/LEg3BQRChRu03/Lsvb4uMnTf+KWCrjLkcopQMBkQVcg0zU484FA== X-Received: by 10.107.180.200 with SMTP id d191mr1510261iof.36.1473819765196; Tue, 13 Sep 2016 19:22:45 -0700 (PDT) Received: from zony ([45.2.7.130]) by smtp.googlemail.com with ESMTPSA id r123sm17980585ith.1.2016.09.13.19.22.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Sep 2016 19:22:44 -0700 (PDT) From: npostavs@users.sourceforge.net To: martin rudalics Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> <87a8ggwcoo.fsf@users.sourceforge.net> <83inv4cc0s.fsf@gnu.org> <87d1ka17dr.fsf@users.sourceforge.net> <57D6490F.1000103@gmx.at> Date: Tue, 13 Sep 2016 22:23:07 -0400 In-Reply-To: <57D6490F.1000103@gmx.at> (martin rudalics's message of "Mon, 12 Sep 2016 08:19:59 +0200") Message-ID: <877faf1apg.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.2 (/) X-Debbugs-Envelope-To: 5718 Cc: ahyatt@gmail.com, Eli Zaretskii , 5718@debbugs.gnu.org, gavenkoa@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.2 (/) martin rudalics writes: > int window_total_lines > - =3D window->total_lines * WINDOW_FRAME_LINE_HEIGHT (window) > + =3D (window->total_lines * WINDOW_FRAME_LINE_HEIGHT (window) > + - WINDOW_MODE_LINE_HEIGHT (window)) > > Please use another name instead of "window_total_lines" here. And > please explain why you can't use Fwindow_text_height here (i.e., why > header lines, horizontal scrollbars and window dividers apparently don't > count). Oh, I just didn't think of those, I don't think there is a reason not to use it. How about this (I use window_box_height instead of Fwindow_text_height just to save the bother of struct window* to Lisp_Object conversion): @@ -4799,10 +4799,7 @@ window_scroll_margin (struct window *window, enum ma= rgin_unit unit) if (scroll_margin > 0) { int frame_line_height =3D default_line_pixel_height (window); - int window_total_lines - =3D (window->total_lines * WINDOW_FRAME_LINE_HEIGHT (window) - - WINDOW_MODE_LINE_HEIGHT (window)) - / frame_line_height; + int window_lines =3D window_box_height (window) / frame_line_height; int margin, max_margin; double ratio =3D 0.25; @@ -4812,7 +4809,7 @@ window_scroll_margin (struct window *window, enum mar= gin_unit unit) ratio =3D max (0.0, ratio); ratio =3D min (ratio, 0.5); } - max_margin =3D (int) (window_total_lines * ratio); + max_margin =3D (int) (window_lines * ratio); margin =3D max (0, scroll_margin); margin =3D min (scroll_margin, max_margin); > > +(defmacro window-with-test-buffer-window (&rest body) > > Please call it =E2=80=98window-test-with-test-buffer-window=E2=80=99 to c= onsistentlyy > keep the =E2=80=98window-test-=E2=80=99 prefix on everything defined in t= his file. Oops, right. From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 13 22:40:14 2016 Received: (at 5718) by debbugs.gnu.org; 14 Sep 2016 02:40:14 +0000 Received: from localhost ([127.0.0.1]:59032 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bk07S-0003JT-Bx for submit@debbugs.gnu.org; Tue, 13 Sep 2016 22:40:14 -0400 Received: from mail-it0-f51.google.com ([209.85.214.51]:37621) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bk07Q-0003JA-NQ for 5718@debbugs.gnu.org; Tue, 13 Sep 2016 22:40:13 -0400 Received: by mail-it0-f51.google.com with SMTP id 186so4735961itf.0 for <5718@debbugs.gnu.org>; Tue, 13 Sep 2016 19:40:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=pLN30J/bRnO6gdoGvxRXK0S15QqjBWbN0y+ySybJPdk=; b=aqjapFw6nKV/U/SGz3xGKAdl2gyU/S58I/iJB+ph5EqCVsfC0Q2zOXtpwDNDXo+pJf xGg1geca2mKK67jmmXD6B1/jYIKeiViU+b/8qF9GQ7E6DrjeC95ZnevaorvgdPtlVUKy w7adQl48ld8ZzwQfPET8urfDvvOz/dW4p+UPG+6HUQ+px7e35cCXbfRQ1QGU7Kdcb+BX NyOaAUubjKOvUhQEr4jj0m56N1Knr8MZN7PmGfxec9Q2dHNZi1lSva++F2gFRB2KywPj VnBHRriS62drxKfUu1vBLn0GF/ehLzplnESuyQqFiOEEluY2Fi186KzGIL8U1ocMqZ8S eYdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=pLN30J/bRnO6gdoGvxRXK0S15QqjBWbN0y+ySybJPdk=; b=MeACq1RRmIuLa7jAVQVQfVaIKNaozlWaIR7e4BLKFEmFD1LUriuCYwP1909T7H5eOw fZHYNvP6K/O8oqzfBNXZsfwW82lgBKxT7UMROiQCpwmELLXIASg2AR37SUYLfxOpojYf YtEZpLaZWZqNp4tvo9s+YbHSsjqL03NgbJxi+56+wSLRW3qsDcOKYydVwRIZv5AgjZuh 4WL2asCUKDIg4XYhaE3Ecvoq1pXoP9rup5pDQxJNVy7JPAolPX6wWJgJ6POCBr0wxFM6 ZyA3cV/hjqJXuujXFozQbZ0tUK9+UAr6g6CK51oNufAqokJpIcIV50SRDVh2U42oyFUd UNDw== X-Gm-Message-State: AE9vXwMtcBsWhGz/vbE1X0jXgh7J/dntPEhxgP1n974vRX9weCmOK3oEo9sSSBiowFJ77A== X-Received: by 10.107.11.101 with SMTP id v98mr13353ioi.145.1473820806963; Tue, 13 Sep 2016 19:40:06 -0700 (PDT) Received: from zony ([45.2.7.130]) by smtp.googlemail.com with ESMTPSA id f68sm724293iod.35.2016.09.13.19.40.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Sep 2016 19:40:06 -0700 (PDT) From: npostavs@users.sourceforge.net To: Eli Zaretskii Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> <87a8ggwcoo.fsf@users.sourceforge.net> <83inv4cc0s.fsf@gnu.org> <87d1ka17dr.fsf@users.sourceforge.net> <834m5l9g1d.fsf@gnu.org> Date: Tue, 13 Sep 2016 22:40:29 -0400 In-Reply-To: <834m5l9g1d.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 12 Sep 2016 20:36:14 +0300") Message-ID: <874m5j19wi.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.2 (/) X-Debbugs-Envelope-To: 5718 Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.2 (/) Eli Zaretskii writes: >> I have a patch set for fixing this and allowing the user to change the >> maximum margin from 0.25. The latter doesn't quite work perfectly, for >> some reason when setting the maximum margin to 0.5 and scroll-margin to >> 100, `scroll-down-command' doesn't keep point centered in the window, >> even though other commands (e.g. `scroll-up-command') do. > > However, I think we need to solve those glitches as part of > introducing the feature. Setting a margin to half the window size > makes centering point difficult, but since some commands do succeed, > I'm guessing that those commands which succeed have a bug, i.e. they > leave point inside the margin. Is that indeed so? I'm not sure what you mean by "succeed" here. `next-line', `previous-line', and `scroll-up-command' are able to keep point ouside of the margin (thus keeping it centered); `scroll-down-command' leaves it one line down from where it should be. Actually, the above applies to windows with an odd number of lines, I realized I didn't account for the case of an even number of lines, which currently has 0 lines that are outside the margin. I need to change the cap on `max-scroll-margin' to account for this. > > Also, did you test these changes with scroll-conservatively set to > 101? If not, please do, as that setting activates some code parts > that no other option does. I hadn't; trying it out now, it seems to cause `next-line' to also have the bad behaviour of `scroll-down-command' where point is one line too far down. > > A few comments below. > >> @@ -16527,10 +16507,8 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) >> /* Some people insist on not letting point enter the scroll >> margin, even though this part handles windows that didn't >> scroll at all. */ >> - int window_total_lines >> - = WINDOW_TOTAL_LINES (w) * FRAME_LINE_HEIGHT (f) / frame_line_height; >> - int margin = min (scroll_margin, window_total_lines / 4); >> - int pixel_margin = margin * frame_line_height; >> + int margin = window_scroll_margin (w, MARGIN_IN_LINES); >> + int pixel_margin = margin * frame_line_height; >> bool header_line = WINDOW_WANTS_HEADER_LINE_P (w); > >> /* Note: We add an extra FRAME_LINE_HEIGHT, because the loop >> @@ -16814,12 +16792,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) >> it.current_y = it.last_visible_y; >> if (centering_position < 0) >> { >> - int window_total_lines >> - = WINDOW_TOTAL_LINES (w) * FRAME_LINE_HEIGHT (f) / frame_line_height; >> - int margin >> - = scroll_margin > 0 >> - ? min (scroll_margin, window_total_lines / 4) >> - : 0; >> + int margin = window_scroll_margin (w, MARGIN_IN_LINES); >> ptrdiff_t margin_pos = CHARPOS (startp); >> Lisp_Object aggressive; >> bool scrolling_up; >> @@ -17063,10 +17036,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) >> { >> int window_total_lines >> = WINDOW_TOTAL_LINES (w) * FRAME_LINE_HEIGHT (f) / frame_line_height; >> - int margin = >> - scroll_margin > 0 >> - ? min (scroll_margin, window_total_lines / 4) >> - : 0; >> + int margin = window_scroll_margin (w, MARGIN_IN_LINES); >> bool move_down = w->cursor.vpos >= window_total_lines / 2; > > Here you call window_scroll_margin 3 times in the same function. Any > way of doing that only once and reusing the result? Yes, this seems to work: @@ -16173,7 +16173,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) int centering_position = -1; bool last_line_misfit = false; ptrdiff_t beg_unchanged, end_unchanged; - int frame_line_height; + int frame_line_height, margin; bool use_desired_matrix; void *itdata = NULL; @@ -16203,6 +16203,8 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) restart: reconsider_clip_changes (w); frame_line_height = default_line_pixel_height (w); + margin = window_scroll_margin (w, MARGIN_IN_LINES); + /* Has the mode line to be updated? */ update_mode_line = (w->update_mode_line @@ -16507,7 +16509,6 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) /* Some people insist on not letting point enter the scroll margin, even though this part handles windows that didn't scroll at all. */ - int margin = window_scroll_margin (w, MARGIN_IN_LINES); int pixel_margin = margin * frame_line_height; bool header_line = WINDOW_WANTS_HEADER_LINE_P (w); @@ -16792,7 +16793,6 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) it.current_y = it.last_visible_y; if (centering_position < 0) { - int margin = window_scroll_margin (w, MARGIN_IN_LINES); ptrdiff_t margin_pos = CHARPOS (startp); Lisp_Object aggressive; bool scrolling_up; @@ -17036,7 +17036,6 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) { int window_total_lines = WINDOW_TOTAL_LINES (w) * FRAME_LINE_HEIGHT (f) / frame_line_height; - int margin = window_scroll_margin (w, MARGIN_IN_LINES); bool move_down = w->cursor.vpos >= window_total_lines / 2; move_it_by_lines (&it, move_down ? margin + 1 : -(margin + 1)); > > >> @@ -17298,17 +17267,7 @@ try_window (Lisp_Object window, struct text_pos pos, int flags) >> if ((flags & TRY_WINDOW_CHECK_MARGINS) >> && !MINI_WINDOW_P (w)) >> { >> - int this_scroll_margin; >> - int window_total_lines >> - = WINDOW_TOTAL_LINES (w) * FRAME_LINE_HEIGHT (f) / frame_line_height; >> - >> - if (scroll_margin > 0) >> - { >> - this_scroll_margin = min (scroll_margin, window_total_lines / 4); >> - this_scroll_margin *= frame_line_height; >> - } >> - else >> - this_scroll_margin = 0; >> + int this_scroll_margin = window_scroll_margin (w, MARGIN_IN_PIXELS); > >> if ((w->cursor.y >= 0 /* not vscrolled */ >> && w->cursor.y < this_scroll_margin >> @@ -18592,15 +18551,8 @@ try_window_id (struct window *w) > >> /* Don't let the cursor end in the scroll margins. */ >> { >> - int this_scroll_margin, cursor_height; >> - int frame_line_height = default_line_pixel_height (w); >> - int window_total_lines >> - = WINDOW_TOTAL_LINES (w) * FRAME_LINE_HEIGHT (it.f) / frame_line_height; >> - >> - this_scroll_margin = >> - max (0, min (scroll_margin, window_total_lines / 4)); >> - this_scroll_margin *= frame_line_height; >> - cursor_height = MATRIX_ROW (w->desired_matrix, w->cursor.vpos)->height; >> + int this_scroll_margin = window_scroll_margin (w, MARGIN_IN_PIXELS); >> + int cursor_height = MATRIX_ROW (w->desired_matrix, w->cursor.vpos)->height; > >> if ((w->cursor.y < this_scroll_margin >> && CHARPOS (start) > BEGV) > > Same here (in another function). These are 2 different functions: try_window and try_window_id. >> + DEFVAR_LISP ("maximum-scroll-margin", Vmaximum_scroll_margin, >> + doc: /* Maximum effective value of `scroll-margin'. >> +Given as a fraction of the current window's lines. */); > > "as a fraction of the current window's height" sounds better, I > think. (It doesn't matter if the height is in lines or in pixels, > for this purpose.) Makes sense. > >> + Vmaximum_scroll_margin = make_float (0.25); >> + > > We usually call such variables "max-SOMETHING", not > "maximum-SOMETHING". > > Also, the actual value is limited by 0.5, but the doc string doesn't > tell that. It also doesn't say that any non-float value is ignored. > > Finally, the new variable needs to be documented in the user manual > and in NEWS. Okay. From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 14 01:31:26 2016 Received: (at 5718) by debbugs.gnu.org; 14 Sep 2016 05:31:27 +0000 Received: from localhost ([127.0.0.1]:59059 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bk2n8-0007T5-Mw for submit@debbugs.gnu.org; Wed, 14 Sep 2016 01:31:26 -0400 Received: from mout.gmx.net ([212.227.17.20]:63418) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bk2n6-0007Sr-MH for 5718@debbugs.gnu.org; Wed, 14 Sep 2016 01:31:25 -0400 Received: from [192.168.1.100] ([212.95.7.66]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0LcWSI-1bL86Y0b0I-00juNn; Wed, 14 Sep 2016 07:31:04 +0200 Message-ID: <57D8E08D.5020100@gmx.at> Date: Wed, 14 Sep 2016 07:30:53 +0200 From: martin rudalics MIME-Version: 1.0 To: npostavs@users.sourceforge.net Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> <87a8ggwcoo.fsf@users.sourceforge.net> <83inv4cc0s.fsf@gnu.org> <87d1ka17dr.fsf@users.sourceforge.net> <57D6490F.1000103@gmx.at> <877faf1apg.fsf@users.sourceforge.net> In-Reply-To: <877faf1apg.fsf@users.sourceforge.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:JpgNNHeiyFSBuuxF0WM71kMNy0NcHVuB1ZtDgt0k7A6w6PEdeDi n9UAEhSzr8DUlp2P3V7ddIhq8QmBx2ZBZthPDKc+EIxMFHAmOVOPL79g6bG2sC8HA8us2Vf SdIe5D1GJCc5vBhs1l2qwdY/kVES2NRst+5hjWj3j9Jy+/eSvpyG2ZxL359l3ilOnaNLZLn ki4mjgFwc8zGZENHWkbwg== X-UI-Out-Filterresults: notjunk:1;V01:K0:XEjYupwyJ+E=:QLFVr3GHDwiPBfUnQ5R0Zp E3swuJPf5WKtQlt/fiTx3PRus/qZ6wAhp32K9bMKgGNbnBbAXCOpAAXZIv4w6q0QTDgrDv8ti PmW4COVqFvoXKPdoH0K3pVJMNJtJMJW3KZPDsYsg4MWCNDKsyNi99o7UozF16bjWsOY5SHGHa FLZHdYNsGfo13oBfmWQZKr1LJ7nLMbHuqI5YxTDo20oysVsiftgi3Noi2TFN9srGUl3Qjqqru z55+06NXX/G1i0TTEbHBY1nyupMRLJysmDWeoRfO8XBzS5VGvdQmO3gSbCnlHXlne/nJU4L+V CfsAebDT3H5O7z6hJx41SlRqqWtUhXWHAtqLrQ+NP5XlhN291Efpohddn8dmPoD2p9FG8Au5d z8EufoRdgK9qYWp8HXpaTVMgPtEJILymQPBC0YQcZJpthKtfg2kUANg78kZRZPbgEDpk502h5 TeCEStm2JZePPOZYopdtpKzXo+FcaUGj5YH95sf/wr7k0lEuVxWi2/Rry8MyIQ2SnUvp3Iti1 ZUdTq94G6W546CYT98lxSFS/C5S/5SYRxl4E3zTqkQ2TGSeiwGor/7+Xnlu0JqFsODkljYF1d nP7ZDphHF3yVpEiwVqzuZpv4d57VLHwLD1hVfq42u3nPX3Dd8gCG1ZjG0UGzz1ZcEEKYVr4eu Wnk2M9GaPfH44dWnptSV/RM+8jQRjCW6ul0DATXUa/3GkWWoVWZ/FTtnmFwedZzLSnIVbF1T3 1v2GbUUdtWVlECLQF+kIxEYQNPC5tyz+C3MoJemqkVX/IRWGe9qF1Yj64VsGChuNc9qeTf8fc ZisDfeH X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 5718 Cc: ahyatt@gmail.com, Eli Zaretskii , 5718@debbugs.gnu.org, gavenkoa@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) > How about this (I use window_box_height instead of > Fwindow_text_height just to save the bother of struct window* to > Lisp_Object conversion): No more complaints. Thank you, martin From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 14 13:27:24 2016 Received: (at 5718) by debbugs.gnu.org; 14 Sep 2016 17:27:24 +0000 Received: from localhost ([127.0.0.1]:59744 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkDxz-0003ll-Od for submit@debbugs.gnu.org; Wed, 14 Sep 2016 13:27:23 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58418) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkDxx-0003lZ-9x for 5718@debbugs.gnu.org; Wed, 14 Sep 2016 13:27:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bkDxr-00085S-1U for 5718@debbugs.gnu.org; Wed, 14 Sep 2016 13:27:16 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:51970) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkDxj-0007yv-Ok; Wed, 14 Sep 2016 13:27:07 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3767 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bkDxf-0001oS-TK; Wed, 14 Sep 2016 13:27:06 -0400 Date: Wed, 14 Sep 2016 20:26:57 +0300 Message-Id: <83zina75pa.fsf@gnu.org> From: Eli Zaretskii To: npostavs@users.sourceforge.net In-reply-to: <874m5j19wi.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net) Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> <87a8ggwcoo.fsf@users.sourceforge.net> <83inv4cc0s.fsf@gnu.org> <87d1ka17dr.fsf@users.sourceforge.net> <834m5l9g1d.fsf@gnu.org> <874m5j19wi.fsf@users.sourceforge.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -7.2 (-------) X-Debbugs-Envelope-To: 5718 Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -7.2 (-------) > From: npostavs@users.sourceforge.net > Cc: 5718@debbugs.gnu.org, ahyatt@gmail.com, gavenkoa@gmail.com > Date: Tue, 13 Sep 2016 22:40:29 -0400 > > Eli Zaretskii writes: > >> I have a patch set for fixing this and allowing the user to change the > >> maximum margin from 0.25. The latter doesn't quite work perfectly, for > >> some reason when setting the maximum margin to 0.5 and scroll-margin to > >> 100, `scroll-down-command' doesn't keep point centered in the window, > >> even though other commands (e.g. `scroll-up-command') do. > > > > However, I think we need to solve those glitches as part of > > introducing the feature. Setting a margin to half the window size > > makes centering point difficult, but since some commands do succeed, > > I'm guessing that those commands which succeed have a bug, i.e. they > > leave point inside the margin. Is that indeed so? > > I'm not sure what you mean by "succeed" here. `next-line', > `previous-line', and `scroll-up-command' are able to keep point ouside > of the margin (thus keeping it centered); `scroll-down-command' leaves > it one line down from where it should be. I assumed that when maximum margin is set to 0.5, there's no way Emacs can center point in the window, because wherever it puts point will be inside the margin. So therefore, if it sometimes does succeed to position point, there must be a bug. However, ... > Actually, the above applies to windows with an odd number of lines, I > realized I didn't account for the case of an even number of lines, which > currently has 0 lines that are outside the margin. I need to change the > cap on `max-scroll-margin' to account for this. ... given the above, I now understand that your interpretation of 0.5 is "half the window minus one line", which leaves the center line for point. Is that so? > I hadn't; trying it out now, it seems to cause `next-line' to also have > the bad behaviour of `scroll-down-command' where point is one line too > far down. Some code involved in this probably assumes the margin cannot be that large. > > Same here (in another function). > > These are 2 different functions: try_window and try_window_id. Oops. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 02 19:47:09 2017 Received: (at 5718) by debbugs.gnu.org; 3 Jan 2017 00:47:09 +0000 Received: from localhost ([127.0.0.1]:39860 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cODFs-0000m5-RC for submit@debbugs.gnu.org; Mon, 02 Jan 2017 19:47:09 -0500 Received: from mail-io0-f169.google.com ([209.85.223.169]:35625) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cODFq-0000lb-21 for 5718@debbugs.gnu.org; Mon, 02 Jan 2017 19:47:06 -0500 Received: by mail-io0-f169.google.com with SMTP id n85so187108995ioi.2 for <5718@debbugs.gnu.org>; Mon, 02 Jan 2017 16:47:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=75g+1e5lLfBnLL9t/13kvmqEsPd4EwFnYfTROHOMX90=; b=U/CHEsce4JXNEJ5JS35KvoOE2emxEo1XWgZLNvPbe2i8yUkjVHfQv7SJ6kD1OnXePx XMhJdoUVIn3uLG1NLdYwE3itailb0NAgc3CxZYAUNUx5o+58+EKCkf9hvsFkFcsY4v4s y8w9x2vd0xSVw4C5c1nUw14kqhsMKTugozbrxI8cyUET9pc6AOzI6y4KCUUa5RNG3wJQ kMAdX5y+4QNJqMAq7T+SO2jqKGYg28pi4L6GwjFMb2HLC9svjYAGytj0ewuzRM945XYr KIB4Sbpmxrip9TLWq92rzQZTuMzMDeRQRl6ATTa8j9q2W23zWrPzPeu29Wqsydavet46 Fing== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=75g+1e5lLfBnLL9t/13kvmqEsPd4EwFnYfTROHOMX90=; b=Ved+MnKJpNwT+bkKazBsC6Uv8QdlW4fFH/DarXa1xuis/isoAFtLT7q/Ng3DgcKvER aarDuEBY77svYRThyKU8hpOxcricxiLvm+eKbBsFmU9QTPJ5fK6Y2OthikthyoKHEyh9 RjlSRYJkGfoo0gdxf6mbXnmSiwqlgzGWah1LwhYgwjkDS7uaOk2Rv3ckHKH4wWSkP59+ AN1qxWT935AJ8kIyDtdiE6opl3SMGXZTh2TfIRliCPkNnYK7X7EM/A5dNQC2b9G8KQca 0ifLvEUqt5ZyHIM3rqNBK7iQOvVPLucrblLC6iJmru5DwJgSFIQtPRuSzZ8PL8GhgMic suFA== X-Gm-Message-State: AIkVDXKalYJQFkniWcJdl5967z1F5BuwcOkB1OIN1fFniS00IJaVpHwa6q1kBBAyqdSk0Q== X-Received: by 10.107.1.138 with SMTP id 132mr46376349iob.72.1483404420587; Mon, 02 Jan 2017 16:47:00 -0800 (PST) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id p20sm31717331itc.2.2017.01.02.16.46.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Jan 2017 16:46:59 -0800 (PST) From: npostavs@users.sourceforge.net To: Eli Zaretskii Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> <87a8ggwcoo.fsf@users.sourceforge.net> <83inv4cc0s.fsf@gnu.org> <87d1ka17dr.fsf@users.sourceforge.net> <834m5l9g1d.fsf@gnu.org> <874m5j19wi.fsf@users.sourceforge.net> <83zina75pa.fsf@gnu.org> Date: Mon, 02 Jan 2017 19:48:03 -0500 In-Reply-To: <83zina75pa.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 14 Sep 2016 20:26:57 +0300") Message-ID: <87pok555q4.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -1.8 (-) X-Debbugs-Envelope-To: 5718 Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.8 (-) --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: npostavs@users.sourceforge.net >> Cc: 5718@debbugs.gnu.org, ahyatt@gmail.com, gavenkoa@gmail.com >> Date: Tue, 13 Sep 2016 22:40:29 -0400 >> >> Eli Zaretskii writes: >> >> I have a patch set for fixing this and allowing the user to change the >> >> maximum margin from 0.25. The latter doesn't quite work perfectly, for >> >> some reason when setting the maximum margin to 0.5 and scroll-margin to >> >> 100, `scroll-down-command' doesn't keep point centered in the window, >> >> even though other commands (e.g. `scroll-up-command') do. [...] > > ... given the above, I now understand that your interpretation of 0.5 > is "half the window minus one line", which leaves the center line for > point. Is that so? Yes, I hadn't quite thought it through, but that was my intention. I've updated the code to clarify this. --=-=-= Content-Type: application/octet-stream Content-Disposition: attachment; filename=v2-0001-Refactor-uses-of-scroll_margin-to-a-function.patch.gz Content-Transfer-Encoding: base64 Content-Description: patch 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 UWywqpVOpWZZ/wMqp1QPYC0AAA== --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=v2-0002-Don-t-count-mode-line-for-scroll-margin-limit.patch Content-Description: patch >From 4293c63254fe9ae38391aed1896436c79ebb8f00 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sun, 28 Aug 2016 17:23:04 -0400 Subject: [PATCH v2 2/3] Don't count mode line for scroll-margin limit * src/window.c (window_scroll_margin): Use window_box_height to avoid counting header line, scrollbars for scroll-margin limit (Bug #5718). * test/src/window-tests.el: New tests for scroll-margin behavior. --- src/window.c | 6 ++-- test/src/window-tests.el | 84 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 test/src/window-tests.el diff --git a/src/window.c b/src/window.c index 3cea9d0..b710333 100644 --- a/src/window.c +++ b/src/window.c @@ -4801,10 +4801,8 @@ window_scroll_margin (struct window *window, enum margin_unit unit) if (scroll_margin > 0) { int frame_line_height = default_line_pixel_height (window); - int window_total_lines - = window->total_lines * WINDOW_FRAME_LINE_HEIGHT (window) - / frame_line_height; - int margin = min (scroll_margin, window_total_lines / 4); + int window_lines = window_box_height (window) / frame_line_height; + int margin = min (scroll_margin, window_lines / 4); if (unit == MARGIN_IN_PIXELS) return margin * frame_line_height; else diff --git a/test/src/window-tests.el b/test/src/window-tests.el new file mode 100644 index 0000000..f5cca73 --- /dev/null +++ b/test/src/window-tests.el @@ -0,0 +1,84 @@ +;;; window-tests.el -- tests for window.c -*- lexical-binding: t -*- + +;; Copyright (C) 2016 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Code: + +(require 'ert) + +(defun window-tests-scrolling (margin &optional effective-margin) + (unless effective-margin + (setq effective-margin margin)) + (erase-buffer) + (insert (mapconcat #'number-to-string + (number-sequence 1 200) "\n")) + (goto-char 1) + (sit-for 0) + (let ((scroll-margin margin) + (wstart (window-start))) + ;; Stopping before `scroll-margin' so we shouldn't have + ;; scrolled. + (let ((current-prefix-arg (- (window-text-height) 1 effective-margin))) + (call-interactively 'next-line)) + (sit-for 0) + (should (= wstart (window-start))) + ;; Passing `scroll-margin' should trigger scrolling. + (call-interactively 'next-line) + (sit-for 0) + (should (/= wstart (window-start))) + ;; Scroll back to top. + (let ((current-prefix-arg (window-start))) + (call-interactively 'scroll-down-command)) + (sit-for 0) + (should (= 1 (window-start))))) + +(defmacro window-tests-with-buffer-window (&rest body) + (declare (debug t)) + (let ((bufvar (make-symbol "buf"))) + `(let ((,bufvar (get-buffer-create "*test*"))) + (with-selected-window (display-buffer ,bufvar) + (with-current-buffer ,bufvar + ,@body))))) + +(ert-deftest window-tests-scroll-margin-0 () + (skip-unless (not noninteractive)) + (window-tests-with-buffer-window + (window-tests-scrolling 0))) + +(ert-deftest window-tests-scroll-margin-negative () + "A negative `scroll-margin' should be the same as 0." + (skip-unless (not noninteractive)) + (window-tests-with-buffer-window + (window-tests-scrolling -10 0))) + +(ert-deftest window-tests-scroll-margin-max () + (skip-unless (not noninteractive)) + (window-tests-with-buffer-window + (let ((max-margin (/ (window-text-height) 4))) + (window-tests-scrolling max-margin)))) + +(ert-deftest window-tests-scroll-margin-over-max () + "A `scroll-margin' more than max should be the same as max." + (skip-unless (not noninteractive)) + (window-tests-with-buffer-window + (set-window-text-height nil 7) + (let ((max-margin (/ (window-text-height) 4))) + (window-tests-scrolling (+ max-margin 1) max-margin) + (window-tests-scrolling (+ max-margin 2) max-margin)))) + +;;; window-tests.el ends here -- 2.9.3 --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=v2-0003-Make-limit-on-scroll-margin-variable.patch Content-Description: patch >From 87ad96cc13ca45eb5c78e3773cfb1458001f9d83 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sun, 11 Sep 2016 11:09:57 -0400 Subject: [PATCH v2 3/3] Make limit on scroll-margin variable TODO: `scroll-down-command' doesn't stay in the middle of the window. * src/xdisp.c (maximum-scroll-margin): New variable. * etc/NEWS: Mention it. * src/window.c (window_scroll_pixel_based): Use it instead of hardcoding division by 4 (Bug #5718). * test/src/window-tests.el (window-tests-scroll-margin-whole-window): (window-tests--point-in-middle-of-window-p): New test and helper function. --- etc/NEWS | 4 ++++ src/window.c | 19 ++++++++++++++----- src/xdisp.c | 8 ++++++++ test/src/window-tests.el | 27 +++++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 5 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index d91204b..f4fa98a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -298,6 +298,10 @@ local part of a remote file name. Thus, if you have a directory named "/~" on the remote host "foo", you can prevent it from being substituted by a home directory by writing it as "/foo:/:/~/file". +** The new variable 'maximum-scroll-margin' allows having effective +settings of 'scroll-margin' up to half the window size, instead of +always restricting the margin to a quarter of the window. + * Editing Changes in Emacs 26.1 diff --git a/src/window.c b/src/window.c index b710333..f664597 100644 --- a/src/window.c +++ b/src/window.c @@ -4802,11 +4802,20 @@ window_scroll_margin (struct window *window, enum margin_unit unit) { int frame_line_height = default_line_pixel_height (window); int window_lines = window_box_height (window) / frame_line_height; - int margin = min (scroll_margin, window_lines / 4); - if (unit == MARGIN_IN_PIXELS) - return margin * frame_line_height; - else - return margin; + + double ratio = 0.25; + if (FLOATP (Vmaximum_scroll_margin)) + { + ratio = XFLOAT_DATA (Vmaximum_scroll_margin); + ratio = max (0.0, ratio); + ratio = min (ratio, 0.5); + } + int max_margin = min ((window_lines - 1)/2, + (int) (window_lines * ratio)); + int margin = clip_to_bounds (0, scroll_margin, max_margin); + return (unit == MARGIN_IN_PIXELS) + ? margin * frame_line_height + : margin; } else return 0; diff --git a/src/xdisp.c b/src/xdisp.c index 0fd2a7c..55bb34a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -31520,6 +31520,14 @@ syms_of_xdisp (void) of the top or bottom of the window. */); scroll_margin = 0; + DEFVAR_LISP ("maximum-scroll-margin", Vmaximum_scroll_margin, + doc: /* Maximum effective value of `scroll-margin'. +Given as a fraction of the current window's lines. The value should +be a floating point number between 0.0 and 0.5. The effective maximum +is limited to (/ (1- window-lines) 2). Non-float values for this +variable are ignored and the default 0.25 is used instead. */); + Vmaximum_scroll_margin = make_float (0.25); + DEFVAR_LISP ("display-pixels-per-inch", Vdisplay_pixels_per_inch, doc: /* Pixels per inch value for non-window system displays. Value is a number or a cons (WIDTH-DPI . HEIGHT-DPI). */); diff --git a/test/src/window-tests.el b/test/src/window-tests.el index f5cca73..1dcebef 100644 --- a/test/src/window-tests.el +++ b/test/src/window-tests.el @@ -81,4 +81,31 @@ window-tests-with-buffer-window (window-tests-scrolling (+ max-margin 1) max-margin) (window-tests-scrolling (+ max-margin 2) max-margin)))) +(defun window-tests--point-in-middle-of-window-p () + (= (count-lines (window-start) (window-point)) + (/ (1- (window-text-height)) 2))) + +(ert-deftest window-tests-scroll-margin-whole-window () + "Test `maximum-scroll-margin' at 0.5. +With a high `scroll-margin', this should keep cursor in the +middle of the window." + (skip-unless (not noninteractive)) + (let ((maximum-scroll-margin 0.5) + (scroll-margin 100)) + (window-tests-with-buffer-window + (set-window-text-height nil 7) + (erase-buffer) + (insert (mapconcat #'number-to-string + (number-sequence 1 200) "\n")) + (goto-char 1) + (sit-for 0) + (call-interactively 'scroll-up-command) + (sit-for 0) + (should (window-tests--point-in-middle-of-window-p)) + (call-interactively 'scroll-up-command) + (sit-for 0) + (should (window-tests--point-in-middle-of-window-p)) + (call-interactively 'scroll-down-command) + (sit-for 0) + (should (window-tests--point-in-middle-of-window-p))))) ;;; window-tests.el ends here -- 2.9.3 --=-=-= Content-Type: text/plain The issues with `scroll-down-command' (and `next-line', below) remain. I find the following change fixes the problem for `scroll-down-command', though I'm not sure whether it's the right thing to do. --- a/src/window.c +++ b/src/window.c @@ -5148,7 +5148,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, bool noerror) in the scroll margin at the bottom. */ move_it_to (&it, PT, -1, (it.last_visible_y - WINDOW_HEADER_LINE_HEIGHT (w) - - this_scroll_margin - 1), + - this_scroll_margin - 1 - frame_line_height), -1, MOVE_TO_POS | MOVE_TO_Y); >>> >>> Also, did you test these changes with scroll-conservatively set to >>> 101? If not, please do, as that setting activates some code parts >>> that no other option does. >> >> I hadn't; trying it out now, it seems to cause `next-line' to also have >> the bad behaviour of `scroll-down-command' where point is one line too >> far down. For `next-line', the initial difference seems to be in `line-move'. When `scroll-conservatively' is non-zero (I found no change at 101, in particular), it calls `vertical-motion` (via `line-move-visual'), otherwise `line-move-partial'. (defun line-move (arg &optional noerror _to-end try-vscroll) ... (unless (and auto-window-vscroll try-vscroll ;; Only vscroll for single line moves (= (abs arg) 1) ;; Under scroll-conservatively, the display engine ;; does this better. (zerop scroll-conservatively) ... (line-move-partial arg noerror)) ... (prog1 (line-move-visual arg noerror) The problem involves partial lines. In a window where (window-screen-lines) returns 7.222, doing M-: (vertical-motion '(0.0 . 1)) does not scroll the window, which lets point end up 1 line away from the center. Doing M-: (vertical-motion '(0.0 . -1)) does scroll the window, keeping the point in the center (as expected). Adjusting the window so that (window-screen-lines) returns 7.0, there is no discrepancy between up and down motion. I guess there is some incorrect boundary condition in try_scrolling, though I haven't worked out where. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 07 03:17:30 2017 Received: (at 5718) by debbugs.gnu.org; 7 Jan 2017 08:17:30 +0000 Received: from localhost ([127.0.0.1]:45548 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cPmBt-0007u8-Pu for submit@debbugs.gnu.org; Sat, 07 Jan 2017 03:17:30 -0500 Received: from eggs.gnu.org ([208.118.235.92]:39121) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cPmBr-0007tt-Qf for 5718@debbugs.gnu.org; Sat, 07 Jan 2017 03:17:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cPmBi-0004df-4L for 5718@debbugs.gnu.org; Sat, 07 Jan 2017 03:17:22 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:43917) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cPmBX-0004Zr-IR; Sat, 07 Jan 2017 03:17:07 -0500 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1964 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cPmBW-0005gq-91; Sat, 07 Jan 2017 03:17:06 -0500 Date: Sat, 07 Jan 2017 10:17:28 +0200 Message-Id: <831swfcmhz.fsf@gnu.org> From: Eli Zaretskii To: npostavs@users.sourceforge.net In-reply-to: <87pok555q4.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net) Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> <87a8ggwcoo.fsf@users.sourceforge.net> <83inv4cc0s.fsf@gnu.org> <87d1ka17dr.fsf@users.sourceforge.net> <834m5l9g1d.fsf@gnu.org> <874m5j19wi.fsf@users.sourceforge.net> <83zina75pa.fsf@gnu.org> <87pok555q4.fsf@users.sourceforge.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -8.2 (--------) X-Debbugs-Envelope-To: 5718 Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -8.2 (--------) > From: npostavs@users.sourceforge.net > Cc: 5718@debbugs.gnu.org, ahyatt@gmail.com, gavenkoa@gmail.com > Date: Mon, 02 Jan 2017 19:48:03 -0500 > > > [1:text/plain Hide] > > Eli Zaretskii writes: > > >> From: npostavs@users.sourceforge.net > >> Cc: 5718@debbugs.gnu.org, ahyatt@gmail.com, gavenkoa@gmail.com > >> Date: Tue, 13 Sep 2016 22:40:29 -0400 > >> > >> Eli Zaretskii writes: > >> >> I have a patch set for fixing this and allowing the user to change the > >> >> maximum margin from 0.25. The latter doesn't quite work perfectly, for > >> >> some reason when setting the maximum margin to 0.5 and scroll-margin to > >> >> 100, `scroll-down-command' doesn't keep point centered in the window, > >> >> even though other commands (e.g. `scroll-up-command') do. > [...] > > > > ... given the above, I now understand that your interpretation of 0.5 > > is "half the window minus one line", which leaves the center line for > > point. Is that so? > > Yes, I hadn't quite thought it through, but that was my intention. I've > updated the code to clarify this. Thanks. I think the remaining issues are minor (modulo the couple of questions below), so I think you should install your changes > The issues with `scroll-down-command' (and `next-line', below) remain. > I find the following change fixes the problem for `scroll-down-command', > though I'm not sure whether it's the right thing to do. > > --- a/src/window.c > +++ b/src/window.c > @@ -5148,7 +5148,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, bool noerror) > in the scroll margin at the bottom. */ > move_it_to (&it, PT, -1, > (it.last_visible_y - WINDOW_HEADER_LINE_HEIGHT (w) > - - this_scroll_margin - 1), > + - this_scroll_margin - 1 - frame_line_height), > -1, > MOVE_TO_POS | MOVE_TO_Y); Can you explain why this fixes the problem? IOW, what was the problem with the original code, and why moving to the previous screen line here solves the problem? Also, does this correction need to be conditional on the new variable in some way, or is it correct in the general case as well? > (defun line-move (arg &optional noerror _to-end try-vscroll) > ... > (unless (and auto-window-vscroll try-vscroll > ;; Only vscroll for single line moves > (= (abs arg) 1) > ;; Under scroll-conservatively, the display engine > ;; does this better. > (zerop scroll-conservatively) > ... > (line-move-partial arg noerror)) > ... > (prog1 (line-move-visual arg noerror) > > The problem involves partial lines. In a window where > (window-screen-lines) returns 7.222, doing M-: (vertical-motion '(0.0 > . 1)) does not scroll the window, which lets point end up 1 line away > from the center. Doing M-: (vertical-motion '(0.0 . -1)) does scroll > the window, keeping the point in the center (as expected). > > Adjusting the window so that (window-screen-lines) returns 7.0, there is > no discrepancy between up and down motion. > > I guess there is some incorrect boundary condition in try_scrolling, > though I haven't worked out where. Could be some off-by-one error when comparing with the window height. This sounds like a minor issue in an extreme (and thus rare) situation, so I'm not sure it should prevent installing this. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 23:18:00 2017 Received: (at 5718) by debbugs.gnu.org; 14 Jan 2017 04:18:00 +0000 Received: from localhost ([127.0.0.1]:53247 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cSFmx-0005bk-VZ for submit@debbugs.gnu.org; Fri, 13 Jan 2017 23:18:00 -0500 Received: from mail-io0-f196.google.com ([209.85.223.196]:35427) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cSFmv-0005bV-Qy for 5718@debbugs.gnu.org; Fri, 13 Jan 2017 23:17:58 -0500 Received: by mail-io0-f196.google.com with SMTP id m98so7542540iod.2 for <5718@debbugs.gnu.org>; Fri, 13 Jan 2017 20:17:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=U5xTCcZvs0G+wUZJPtVceL2CSl7qUiQWalo3vu996dg=; b=Q9GMNxBynb4qZiCGDcpyEG8mbILzfpprRqkO6JjKgBBFGRMPFq7cmrCBrjwkh8ecaK DNuk4MqoWcawp3BesFed35bQeQlQx6RaoSGOm4pH2KsYFEA0MG5Ae7LverW50t5unkLx nwvHFZDl9zECkIMp6W/Ltz8zfwyEKnANE7R8kZxpYm/XhqgeLn8RwwLY9YzXyt/qvABP GTCFP2wOByXg+EvwbPeixlrhk/Hh6jJmPnWxQuDphS5FMWs/32+A8DN2PNLJgCOvNxhg BABG5io7yATbJrM+DVYqTGrb98LNj9WYwlCAGrqkKTOmRHjpjSp83S0dcG/yH61UiBLv 4Swg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=U5xTCcZvs0G+wUZJPtVceL2CSl7qUiQWalo3vu996dg=; b=rmI18PGyHLNIQ9mNEDBEzoCE6V+s87esHX7VOB6JVUZgy0/VP7BWKaIBn9h8ig3zsq s7jy1HKz6x+Bf89sok/NSNj8Hfmb1QrnWJ4c17MUErXI5e/AelAOPdf3msPgp0uXqs90 IbFvajVEzIvT3nxSSTbRNKPIt+VsfDEr6PumryOtid6u9nw0rSwRgK5rWRVaxZMWwraG q0fEPhVj72wBJk3+iMGygUnA11DhCxsSBSrvkoJyWoObDZ0MS+vaR6qo4OQf5uzLSC76 1J7ztgcVpRjzfEm3TV0RdWnkhV2Se73hVRE3mfCTBUx7abRWiS5CGfTN4gpZf8YXfIUL EN6A== X-Gm-Message-State: AIkVDXIrBJJX+Nk+zCAb2djvWBH8LzitMyagYS6HMVHZAXIhDGb2O3f3tV7asiNAw99wyA== X-Received: by 10.107.195.204 with SMTP id t195mr21183333iof.46.1484367472188; Fri, 13 Jan 2017 20:17:52 -0800 (PST) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id s1sm2104774itb.21.2017.01.13.20.17.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Jan 2017 20:17:51 -0800 (PST) From: npostavs@users.sourceforge.net To: Eli Zaretskii Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> <87a8ggwcoo.fsf@users.sourceforge.net> <83inv4cc0s.fsf@gnu.org> <87d1ka17dr.fsf@users.sourceforge.net> <834m5l9g1d.fsf@gnu.org> <874m5j19wi.fsf@users.sourceforge.net> <83zina75pa.fsf@gnu.org> <87pok555q4.fsf@users.sourceforge.net> <831swfcmhz.fsf@gnu.org> Date: Fri, 13 Jan 2017 23:18:56 -0500 In-Reply-To: <831swfcmhz.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 07 Jan 2017 10:17:28 +0200") Message-ID: <871sw6z32n.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.6 (/) X-Debbugs-Envelope-To: 5718 Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.6 (/) Eli Zaretskii writes: > >> The issues with `scroll-down-command' (and `next-line', below) remain. >> I find the following change fixes the problem for `scroll-down-command', >> though I'm not sure whether it's the right thing to do. >> >> --- a/src/window.c >> +++ b/src/window.c >> @@ -5148,7 +5148,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, bool noerror) >> in the scroll margin at the bottom. */ >> move_it_to (&it, PT, -1, >> (it.last_visible_y - WINDOW_HEADER_LINE_HEIGHT (w) >> - - this_scroll_margin - 1), >> + - this_scroll_margin - 1 - frame_line_height), >> -1, >> MOVE_TO_POS | MOVE_TO_Y); > > Can you explain why this fixes the problem? IOW, what was the problem > with the original code, and why moving to the previous screen line > here solves the problem? > > Also, does this correction need to be conditional on the new variable > in some way, or is it correct in the general case as well? Actually, this is also a problem with partial lines. I didn't notice at first, because Emacs produces a window with a partial line by default when I do `C-x 2'. AFAICT, it's not related with the new variable, except that the problem becomes more obvious with maximal margins. In Emacs 25.1, using a window where (window-screen-lines) => 20.22, and a scroll-margin of 100, doing `scroll-down-command' leaves 5 full lines above point, while `scroll-up-command' leaves 4 full lines (and the partial one) below point. So in the code, I think the problem is that it.last_visible_y includes the partial line, while this_scroll_margin is just the integer scroll_margin multiplied by pixels per line. I guess to fix it, subtracting the partial line height would be more correct than frame_line_height. >> >> The problem involves partial lines. In a window where >> (window-screen-lines) returns 7.222, doing M-: (vertical-motion '(0.0 >> . 1)) does not scroll the window, which lets point end up 1 line away >> from the center. Doing M-: (vertical-motion '(0.0 . -1)) does scroll >> the window, keeping the point in the center (as expected). >> >> Adjusting the window so that (window-screen-lines) returns 7.0, there is >> no discrepancy between up and down motion. >> >> I guess there is some incorrect boundary condition in try_scrolling, >> though I haven't worked out where. Looks like the same kind of problem as the other case, I can fix it again by subtracting frame_line_height, though again, subtracting the partial height is probably more correct. --- i/src/xdisp.c +++ w/src/xdisp.c @@ -15369,7 +15369,7 @@ try_scrolling (Lisp_Object window, bool just_this_one_p, either that ypos or PT, whichever comes first. */ start_display (&it, w, startp); scroll_margin_y = it.last_visible_y - this_scroll_margin - - frame_line_height * extra_scroll_margin_lines; + - frame_line_height * (1 + extra_scroll_margin_lines); move_it_to (&it, PT, -1, scroll_margin_y - 1, -1, (MOVE_TO_POS | MOVE_TO_Y)); From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 14 02:58:43 2017 Received: (at 5718) by debbugs.gnu.org; 14 Jan 2017 07:58:43 +0000 Received: from localhost ([127.0.0.1]:53300 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cSJEZ-0002FG-LS for submit@debbugs.gnu.org; Sat, 14 Jan 2017 02:58:43 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52939) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cSJEY-0002F5-Bb for 5718@debbugs.gnu.org; Sat, 14 Jan 2017 02:58:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cSJES-0001uc-94 for 5718@debbugs.gnu.org; Sat, 14 Jan 2017 02:58:37 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_20,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:52020) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cSJEL-0001rZ-FH; Sat, 14 Jan 2017 02:58:29 -0500 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4434 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cSJEK-0004Wk-7P; Sat, 14 Jan 2017 02:58:28 -0500 Date: Sat, 14 Jan 2017 09:58:38 +0200 Message-Id: <83o9zaax8x.fsf@gnu.org> From: Eli Zaretskii To: npostavs@users.sourceforge.net In-reply-to: <871sw6z32n.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net) Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> <87a8ggwcoo.fsf@users.sourceforge.net> <83inv4cc0s.fsf@gnu.org> <87d1ka17dr.fsf@users.sourceforge.net> <834m5l9g1d.fsf@gnu.org> <874m5j19wi.fsf@users.sourceforge.net> <83zina75pa.fsf@gnu.org> <87pok555q4.fsf@users.sourceforge.net> <831swfcmhz.fsf@gnu.org> <871sw6z32n.fsf@users.sourceforge.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -8.2 (--------) X-Debbugs-Envelope-To: 5718 Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -8.2 (--------) > From: npostavs@users.sourceforge.net > Cc: 5718@debbugs.gnu.org, ahyatt@gmail.com, gavenkoa@gmail.com > Date: Fri, 13 Jan 2017 23:18:56 -0500 > > Looks like the same kind of problem as the other case, I can fix it > again by subtracting frame_line_height, though again, subtracting the > partial height is probably more correct. I think you are right on both counts. Computing the partial height of the last visible line shouldn't be hard, I think. Let me know if you need help with that. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 15 16:42:36 2017 Received: (at 5718) by debbugs.gnu.org; 15 Jan 2017 21:42:36 +0000 Received: from localhost ([127.0.0.1]:55083 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cSsZP-0003wZ-RJ for submit@debbugs.gnu.org; Sun, 15 Jan 2017 16:42:36 -0500 Received: from mail-it0-f67.google.com ([209.85.214.67]:35211) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cSsZO-0003wN-P8 for 5718@debbugs.gnu.org; Sun, 15 Jan 2017 16:42:35 -0500 Received: by mail-it0-f67.google.com with SMTP id 203so10528048ith.2 for <5718@debbugs.gnu.org>; Sun, 15 Jan 2017 13:42:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=D4VNRE4pybcYskMG8nABVQkkmVVgQ4CfQCDPBi0pCZY=; b=B1OXbhq0YTUgxS91B2aQqah9Ap91+s5+r1rBxgIv+k4F0Enf2o5cD1N2WENd953RHl +BbtrC8JLYZKm0SDZJEW7LgvIcKNgm+T8kLGOqe3fJvvgcbP1hk7zyVSqLBqvOQWNYTL fiGG5YJutGmAMbxY2Nw9aKJtrq9mty4LPYtuZrh+eDDDC9nEN84wbAwHQl344eU34W0M Autu+8y9wsOFIoqTYI3/gSSBiIU6b2LVycVGs4p4nlNYkx/0EFXQZTQIzOgiJIiOcRaQ kVsBpYHH44rnWNm/I3rq4Ew0yp2lOwqS39a/LcWIXhPDcZkQ3Mgu4yUO23TOn6AYOZjP ybMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=D4VNRE4pybcYskMG8nABVQkkmVVgQ4CfQCDPBi0pCZY=; b=ickxsJPTmgsp56qzONVfvvZrCYKGvSjJ/sMq5ZKDRpo8veIel+ZPkituasdk5aJEba HfnwvfKu+s1NxC9l2gV+ljwH6bBZ9aze+RvZk8nTq35984mybml262SRhd6r3LiwihWn Hjuj49edMWt6VwdggQeJfqEvBTi/mLdFNyp02umlIwkfyYv9tIIVfsN/HcZi+uL6S0uH beKB/NGi1rgFkDegw0JRpCtS/HQqppAukWeK5C4RStrmikJQ3eCksz7lzHPT0XpdpMsh wK662ME93jYwsYsIYvhK4JNYotbmutcI1NcXXsBcO54doB7lhCAxXHKp2iXd7Pnttb8D 32ZQ== X-Gm-Message-State: AIkVDXINkkbQQ4KIxMzQnQ5W5hIqF7h8EgcFeR1ZQUAGlh1G00u0Ya8/l3tsgJwOdrypAA== X-Received: by 10.36.139.133 with SMTP id g127mr12277485ite.4.1484516549137; Sun, 15 Jan 2017 13:42:29 -0800 (PST) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id 98sm10378105iol.5.2017.01.15.13.42.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 15 Jan 2017 13:42:28 -0800 (PST) From: npostavs@users.sourceforge.net To: Eli Zaretskii Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> <87a8ggwcoo.fsf@users.sourceforge.net> <83inv4cc0s.fsf@gnu.org> <87d1ka17dr.fsf@users.sourceforge.net> <834m5l9g1d.fsf@gnu.org> <874m5j19wi.fsf@users.sourceforge.net> <83zina75pa.fsf@gnu.org> <87pok555q4.fsf@users.sourceforge.net> <831swfcmhz.fsf@gnu.org> <871sw6z32n.fsf@users.sourceforge.net> <83o9zaax8x.fsf@gnu.org> Date: Sun, 15 Jan 2017 16:43:34 -0500 In-Reply-To: <83o9zaax8x.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 14 Jan 2017 09:58:38 +0200") Message-ID: <87k29wxam1.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 5718 Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) Eli Zaretskii writes: >> From: npostavs@users.sourceforge.net >> Cc: 5718@debbugs.gnu.org, ahyatt@gmail.com, gavenkoa@gmail.com >> Date: Fri, 13 Jan 2017 23:18:56 -0500 >> >> Looks like the same kind of problem as the other case, I can fix it >> again by subtracting frame_line_height, though again, subtracting the >> partial height is probably more correct. > > I think you are right on both counts. Computing the partial height of > the last visible line shouldn't be hard, I think. Let me know if you > need help with that. Yeah, I'm still a bit lost in all the different structures. It seems (it.last_visible_y % frame_line_height) might work. The matrix row stuff in xdisp seems a more direct way of getting it, though I guess that's not really usable from window.c? What would be the idiomatic way of doing this? #define MR_PARTIALLY_VISIBLE(ROW) \ ((ROW)->height != (ROW)->visible_height) By the way, in window_scroll_pixel_based (lines 5139 to 5158) the position of "it" is saved twice, and it looks like the first one of these can never be used (because the second overwrites it), correct? ptrdiff_t charpos, bytepos; bool partial_p; /* Save our position, for the <---------------- Useless? window_scroll_pixel_based_preserve_y case. */ charpos = IT_CHARPOS (it); bytepos = IT_BYTEPOS (it); /* We moved the window start towards BEGV, so PT may be now in the scroll margin at the bottom. */ move_it_to (&it, PT, -1, (it.last_visible_y - WINDOW_HEADER_LINE_HEIGHT (w) - this_scroll_margin - 1 - frame_line_height), -1, MOVE_TO_POS | MOVE_TO_Y); /* Save our position, in case it's correct. */ charpos = IT_CHARPOS (it); bytepos = IT_BYTEPOS (it); From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 16 12:09:12 2017 Received: (at 5718) by debbugs.gnu.org; 16 Jan 2017 17:09:12 +0000 Received: from localhost ([127.0.0.1]:55888 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cTAmO-0008UY-59 for submit@debbugs.gnu.org; Mon, 16 Jan 2017 12:09:12 -0500 Received: from eggs.gnu.org ([208.118.235.92]:41245) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cTAmM-0008UL-QB for 5718@debbugs.gnu.org; Mon, 16 Jan 2017 12:09:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cTAmC-0003IX-Gc for 5718@debbugs.gnu.org; Mon, 16 Jan 2017 12:09:05 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:53044) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cTAm0-0003Ei-CA; Mon, 16 Jan 2017 12:08:48 -0500 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3452 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cTAly-0007UA-T5; Mon, 16 Jan 2017 12:08:48 -0500 Date: Mon, 16 Jan 2017 19:08:37 +0200 Message-Id: <83a8ar9bl6.fsf@gnu.org> From: Eli Zaretskii To: npostavs@users.sourceforge.net In-reply-to: <87k29wxam1.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net) Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> <87a8ggwcoo.fsf@users.sourceforge.net> <83inv4cc0s.fsf@gnu.org> <87d1ka17dr.fsf@users.sourceforge.net> <834m5l9g1d.fsf@gnu.org> <874m5j19wi.fsf@users.sourceforge.net> <83zina75pa.fsf@gnu.org> <87pok555q4.fsf@users.sourceforge.net> <831swfcmhz.fsf@gnu.org> <871sw6z32n.fsf@users.sourceforge.net> <83o9zaax8x.fsf@gnu.org> <87k29wxam1.fsf@users.sourceforge.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -8.2 (--------) X-Debbugs-Envelope-To: 5718 Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -8.2 (--------) > From: npostavs@users.sourceforge.net > Cc: 5718@debbugs.gnu.org, ahyatt@gmail.com, gavenkoa@gmail.com > Date: Sun, 15 Jan 2017 16:43:34 -0500 > > Yeah, I'm still a bit lost in all the different structures. It seems > (it.last_visible_y % frame_line_height) might work. That would only be correct if all the screen lines use the default font. Otherwise, the last line could be only partially visible even if the above is zero. > The matrix row stuff in xdisp seems a more direct way of getting it, > though I guess that's not really usable from window.c? If by "matrix row" you meant the glyph matrix prepared by the previous redisplay, then using that is unreliable, because that matrix might not be up to date. You can see that window_scroll_pixel_based already uses the move_it_* family of functions, which is the right way of doing this stuff -- these functions simulate redisplay without actually displaying anything, so you can compute the metrics of anything on display using them. > What would be the idiomatic way of doing this? > > #define MR_PARTIALLY_VISIBLE(ROW) \ > ((ROW)->height != (ROW)->visible_height) There's already such a calculation in window_scroll_pixel_based: /* See if point is on a partially visible line at the end. */ if (it.what == IT_EOB) partial_p = it.current_y + it.ascent + it.descent > it.last_visible_y; else { move_it_by_lines (&it, 1); partial_p = it.current_y > it.last_visible_y; } (This is preceded by moving the iterator to the point's screen line or to EOB, whichever comes first.) The value it.current_y is the Y coordinate of the top edge of a glyph row (the value is zero for the first screen line), so if it.last_visible_y is farther away from that than the height of the glyph row, that glyph row is fully visible; otherwise it isn't. > By the way, in window_scroll_pixel_based (lines 5139 to 5158) the > position of "it" is saved twice, and it looks like the first one of > these can never be used (because the second overwrites it), correct? Yep, good catch. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 21 13:45:38 2017 Received: (at 5718) by debbugs.gnu.org; 21 Jan 2017 18:45:38 +0000 Received: from localhost ([127.0.0.1]:37745 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cV0fR-0007Pv-MA for submit@debbugs.gnu.org; Sat, 21 Jan 2017 13:45:37 -0500 Received: from mail-io0-f176.google.com ([209.85.223.176]:33167) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cV0fP-0007Ph-Rx for 5718@debbugs.gnu.org; Sat, 21 Jan 2017 13:45:36 -0500 Received: by mail-io0-f176.google.com with SMTP id v96so21310156ioi.0 for <5718@debbugs.gnu.org>; Sat, 21 Jan 2017 10:45:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=rFAnjbRCxGYWEbi/5bRbNFGji3PeJc6PbtS4E9Qu+QM=; b=TT2Vzl2GfGW8l6Wyk5SSGeNSZNSMMl8+kX4KWw8M9M9OSH/aIH7Epgbuyf4x+XWniG 702G9YrjVZXKMcIzb279wYh6576vy2O+ZqobZJ56GiHeRglOr7hJsOTuqMrxLqmmjbaO 0guM6JNN3LFuYjLSOGEuCm89rmQH+ddDoQFpRiRce7TYsSfJs6tw5n45LS64VuJKZQoh 7+5ZgvwdtdiP08sgRclVDGAHXJcpqUnFwk3apqZCq3mfU+RlOWCKu9z+fSrwVTg6xvh1 oeFIZ2+PXjs/QRKxH+vBmUBaNrRIy09XiF+TVO5x3yUuNZ/6uUXTUVmWfviss44NPTge 24/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=rFAnjbRCxGYWEbi/5bRbNFGji3PeJc6PbtS4E9Qu+QM=; b=uVVPgkwv5RIYA8cg0IX2Fljy7c3LC1iBPSvnvQgNI3FwJJkZXu+iJHYGvIcjGa2Pk5 ibrEX8s1r7DudHr9oEQ64NqeGgk+SxXYyqmFRGeKS9vd4uAmqIoZ+kSboiKJhZ3OYoVs 2dKTG0OLLvgZ8MPCzZBYWsjupx7/TMgjBuyVtINyFqf7SIe9tc47FwHUPYRWIYyQzHyJ 8X1mWtOx2vkWO2LicqlE1kJSsWXyLUgcEUWX/PkEcg9zHwSLLpxFO6Q/IrUyjZNcf5Do LrPwoJMhwJ2aQchWMR2xqerAkNDJLt4njWzmlqphyw0bk5f+q4vD+XpwdLxb9P757PJy A3rQ== X-Gm-Message-State: AIkVDXJW3Pte3HZd6drUEaF3LIBMmanbWbr9Qr5IzH3k547ZH2um7y0QFn4Ql2icxhVYBQ== X-Received: by 10.107.134.36 with SMTP id i36mr18344424iod.168.1485024330253; Sat, 21 Jan 2017 10:45:30 -0800 (PST) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id p20sm5825153itc.2.2017.01.21.10.45.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Jan 2017 10:45:29 -0800 (PST) From: npostavs@users.sourceforge.net To: Eli Zaretskii Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> <87a8ggwcoo.fsf@users.sourceforge.net> <83inv4cc0s.fsf@gnu.org> <87d1ka17dr.fsf@users.sourceforge.net> <834m5l9g1d.fsf@gnu.org> <874m5j19wi.fsf@users.sourceforge.net> <83zina75pa.fsf@gnu.org> <87pok555q4.fsf@users.sourceforge.net> <831swfcmhz.fsf@gnu.org> <871sw6z32n.fsf@users.sourceforge.net> <83o9zaax8x.fsf@gnu.org> <87k29wxam1.fsf@users.sourceforge.net> <83a8ar9bl6.fsf@gnu.org> Date: Sat, 21 Jan 2017 13:46:37 -0500 In-Reply-To: <83a8ar9bl6.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 16 Jan 2017 19:08:37 +0200") Message-ID: <87pojguu7m.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.6 (/) X-Debbugs-Envelope-To: 5718 Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.6 (/) --=-=-= Content-Type: text/plain Eli Zaretskii writes: > > There's already such a calculation in window_scroll_pixel_based: > > /* See if point is on a partially visible line at the end. */ > if (it.what == IT_EOB) > partial_p = it.current_y + it.ascent + it.descent > it.last_visible_y; > else > { > move_it_by_lines (&it, 1); > partial_p = it.current_y > it.last_visible_y; > } > > (This is preceded by moving the iterator to the point's screen line or > to EOB, whichever comes first.) The value it.current_y is the Y > coordinate of the top edge of a glyph row (the value is zero for the > first screen line), so if it.last_visible_y is farther away from that > than the height of the glyph row, that glyph row is fully visible; > otherwise it isn't. I'm not entirely clear why there is a branch in that code. I came up with this; it works, though I'm not sure if it's the best way: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v3-0001-Fix-scrolling-with-partial-lines.patch Content-Description: patch >From 6944c7badade2477f381acf3b0922e5309e063d8 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 21 Jan 2017 13:24:47 -0500 Subject: [PATCH v3] Fix scrolling with partial lines * src/xdisp.c (partial_line_height): New function. (try_scrolling): * src/window.c (window_scroll_pixel_based): Use it for calculating the pixel scroll margin correctly in a window with partial lines. --- src/dispextern.h | 1 + src/window.c | 2 +- src/xdisp.c | 14 +++++++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/dispextern.h b/src/dispextern.h index 51222e6..470330a 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3263,6 +3263,7 @@ void move_it_past_eol (struct it *); void move_it_in_display_line (struct it *it, ptrdiff_t to_charpos, int to_x, enum move_operation_enum op); +int partial_line_height (const struct it *it_origin); bool in_display_vector_p (struct it *); int frame_mode_line_height (struct frame *); extern bool redisplaying_p; diff --git a/src/window.c b/src/window.c index f664597..300472e 100644 --- a/src/window.c +++ b/src/window.c @@ -5148,7 +5148,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, bool noerror) in the scroll margin at the bottom. */ move_it_to (&it, PT, -1, (it.last_visible_y - WINDOW_HEADER_LINE_HEIGHT (w) - - this_scroll_margin - 1), + - partial_line_height (&it)- this_scroll_margin - 1), -1, MOVE_TO_POS | MOVE_TO_Y); diff --git a/src/xdisp.c b/src/xdisp.c index 55bb34a..9dc65b8 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -9859,6 +9859,17 @@ move_it_by_lines (struct it *it, ptrdiff_t dvpos) } } +int +partial_line_height (const struct it *it_origin) +{ + struct it it = *it_origin; + move_it_to (&it, ZV, -1, it.last_visible_y, -1, + MOVE_TO_POS | MOVE_TO_Y); + int vis_height = it.last_visible_y - it.current_y; + int log_height = it.ascent + it.descent; + return max (0, log_height - vis_height); +} + /* Return true if IT points into the middle of a display vector. */ bool @@ -15368,7 +15379,8 @@ try_scrolling (Lisp_Object window, bool just_this_one_p, /* Compute the pixel ypos of the scroll margin, then move IT to either that ypos or PT, whichever comes first. */ start_display (&it, w, startp); - scroll_margin_y = it.last_visible_y - this_scroll_margin + scroll_margin_y = it.last_visible_y - partial_line_height (&it) + - this_scroll_margin - frame_line_height * extra_scroll_margin_lines; move_it_to (&it, PT, -1, scroll_margin_y - 1, -1, (MOVE_TO_POS | MOVE_TO_Y)); -- 2.9.3 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 21 14:17:40 2017 Received: (at 5718) by debbugs.gnu.org; 21 Jan 2017 19:17:40 +0000 Received: from localhost ([127.0.0.1]:37751 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cV1AS-00089W-F5 for submit@debbugs.gnu.org; Sat, 21 Jan 2017 14:17:40 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52820) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cV1AQ-00089F-VU for 5718@debbugs.gnu.org; Sat, 21 Jan 2017 14:17:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cV1AI-0001sC-KY for 5718@debbugs.gnu.org; Sat, 21 Jan 2017 14:17:33 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:34178) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cV1A3-0001n5-GO; Sat, 21 Jan 2017 14:17:15 -0500 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3313 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cV1A2-00062b-1T; Sat, 21 Jan 2017 14:17:15 -0500 Date: Sat, 21 Jan 2017 21:17:05 +0200 Message-Id: <83d1fg5iku.fsf@gnu.org> From: Eli Zaretskii To: npostavs@users.sourceforge.net In-reply-to: <87pojguu7m.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net) Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> <87a8ggwcoo.fsf@users.sourceforge.net> <83inv4cc0s.fsf@gnu.org> <87d1ka17dr.fsf@users.sourceforge.net> <834m5l9g1d.fsf@gnu.org> <874m5j19wi.fsf@users.sourceforge.net> <83zina75pa.fsf@gnu.org> <87pok555q4.fsf@users.sourceforge.net> <831swfcmhz.fsf@gnu.org> <871sw6z32n.fsf@users.sourceforge.net> <83o9zaax8x.fsf@gnu.org> <87k29wxam1.fsf@users.sourceforge.net> <83a8ar9bl6.fsf@gnu.org> <87pojguu7m.fsf@users.sourceforge.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -8.2 (--------) X-Debbugs-Envelope-To: 5718 Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -8.2 (--------) > From: npostavs@users.sourceforge.net > Cc: 5718@debbugs.gnu.org, ahyatt@gmail.com, gavenkoa@gmail.com > Date: Sat, 21 Jan 2017 13:46:37 -0500 > > > /* See if point is on a partially visible line at the end. */ > > if (it.what == IT_EOB) > > partial_p = it.current_y + it.ascent + it.descent > it.last_visible_y; > > else > > { > > move_it_by_lines (&it, 1); > > partial_p = it.current_y > it.last_visible_y; > > } > > > > (This is preceded by moving the iterator to the point's screen line or > > to EOB, whichever comes first.) The value it.current_y is the Y > > coordinate of the top edge of a glyph row (the value is zero for the > > first screen line), so if it.last_visible_y is farther away from that > > than the height of the glyph row, that glyph row is fully visible; > > otherwise it isn't. > > I'm not entirely clear why there is a branch in that code. Because of line-spacing, perhaps? Did you test your code when line-spacing is at non-default value? In general, it is safer to go to the next screen line than reason about where it will start. > +int > +partial_line_height (const struct it *it_origin) > +{ > + struct it it = *it_origin; When you copy the iterator structure and modify the copy, you need to save and restore the bidi cache, using SAVE_IT and RESTORE_IT macros. Otherwise, the code which calls this function will work incorrectly if it uses the original iterator after the call, because the bidi cache is not restored to its state before the call. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 22 12:20:23 2017 Received: (at 5718) by debbugs.gnu.org; 22 Jan 2017 17:20:23 +0000 Received: from localhost ([127.0.0.1]:38452 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cVLoV-0007vM-Ej for submit@debbugs.gnu.org; Sun, 22 Jan 2017 12:20:23 -0500 Received: from mail-io0-f196.google.com ([209.85.223.196]:34157) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cVLoS-0007v7-G1 for 5718@debbugs.gnu.org; Sun, 22 Jan 2017 12:20:20 -0500 Received: by mail-io0-f196.google.com with SMTP id c80so12866861iod.1 for <5718@debbugs.gnu.org>; Sun, 22 Jan 2017 09:20:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=AHy9RIW5UQ7vk7JoZWaTif8NQ0ozkp92fC6B3BvDbNA=; b=ddVjVRr7yXzsjNAUpwwMOft6+nIKgJryepnJ1ibCP/6Q5j1w272bsEx0eqheKzlPHC UESJPKirF3UOfoYmfMJbNiHNpqkOG44QbQkFYvDI9lT29fcrhz5CRGAB4WWh/ckQBAnL c9MU6O+65MStr/Dewro8C3thSbG0cQ2Ieo9bu/e1Il3V2W0zyQorENWrfHL8XuL0QegB mH55Z8TuHGewbQQEjlIMFgIIYBFgcDHt0QVyJ04ViHaXtWRYNgz2j5RPp67Q6143MZvU d5I10CKbKjO3UGkaiU6D5KhepXExMIAIy28+yq0XuR2GFoqZhmu5kTn6JizcFFoKj5tb 9oXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=AHy9RIW5UQ7vk7JoZWaTif8NQ0ozkp92fC6B3BvDbNA=; b=fpD3cHFRqQ4y8iFm8MVxJHTFZWFloral62uUBD7hWQ1RQx4esj8ZaoPihk6aPK1dYx adAgbbH6lh7hrHN0TV0w118wf7z7c1k+QFJ1no1SKKT6KysD0mCZRkZ5KBNdWmyXxLE2 Z13YAsW3aLxX5EFvNSFgYAi/4ZtJQuHD+m1ZXSxQZUiA/yID/sSfnfa2O3JrVsrPIbHT KnWKfcucMClqaVSPOpdAZDZ44HBhsqpc3CotJNMu90ZFvMuTk4zdQxV1fa3mWF2BuH9o k2IepMdxIRbTNrgUC0+EkPYmljJ3SiqwVvdHvSTdDLvlRjLbcFVMH0FRGqHAnByBZKvJ hVcg== X-Gm-Message-State: AIkVDXJBJMv4kTDlDC8WcM+Q0RdrMSN4kG+fdKZaPU5TthvQ1gfuV8JW9xd0k9FwPlUAuQ== X-Received: by 10.107.178.151 with SMTP id b145mr22006570iof.69.1485105614635; Sun, 22 Jan 2017 09:20:14 -0800 (PST) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id p20sm7596126itc.2.2017.01.22.09.20.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 22 Jan 2017 09:20:13 -0800 (PST) From: npostavs@users.sourceforge.net To: Eli Zaretskii Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> <87a8ggwcoo.fsf@users.sourceforge.net> <83inv4cc0s.fsf@gnu.org> <87d1ka17dr.fsf@users.sourceforge.net> <834m5l9g1d.fsf@gnu.org> <874m5j19wi.fsf@users.sourceforge.net> <83zina75pa.fsf@gnu.org> <87pok555q4.fsf@users.sourceforge.net> <831swfcmhz.fsf@gnu.org> <871sw6z32n.fsf@users.sourceforge.net> <83o9zaax8x.fsf@gnu.org> <87k29wxam1.fsf@users.sourceforge.net> <83a8ar9bl6.fsf@gnu.org> <87pojguu7m.fsf@users.sourceforge.net> <83d1fg5iku.fsf@gnu.org> Date: Sun, 22 Jan 2017 12:21:20 -0500 In-Reply-To: <83d1fg5iku.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 21 Jan 2017 21:17:05 +0200") Message-ID: <87inp7ui27.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.6 (/) X-Debbugs-Envelope-To: 5718 Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.6 (/) npostavs@users.sourceforge.net writes: > > I came up with this; it works Actually, that doesn't work, I must have not compiled before testing. Eli Zaretskii writes: >> >> I'm not entirely clear why there is a branch in that code. > > Because of line-spacing, perhaps? Did you test your code when > line-spacing is at non-default value? In general, it is safer to go > to the next screen line than reason about where it will start. > >> +int >> +partial_line_height (const struct it *it_origin) >> +{ >> + struct it it = *it_origin; > > When you copy the iterator structure and modify the copy, you need to > save and restore the bidi cache, using SAVE_IT and RESTORE_IT macros. > Otherwise, the code which calls this function will work incorrectly if > it uses the original iterator after the call, because the bidi cache > is not restored to its state before the call. I came up with this modified version of partial_line_height, which does actually work. Having to do RESTORE_IT (&it, &it, it_data) is a bit unintuitive though. I don't understand what the typical use case of this macro is, if it's going to copy back the new state into the original `it', then why use a separate `it' in the first place? By the way, while testing I noticed that `set-window-text-height' doesn't take `line-spacing' into account, should it? int partial_line_height (struct it *it_origin) { int partial_height; void *it_data = NULL; struct it it; SAVE_IT (it, *it_origin, it_data); move_it_to (&it, ZV, -1, it.last_visible_y, -1, MOVE_TO_POS | MOVE_TO_Y); if (it.what == IT_EOB) { int vis_height = it.last_visible_y - it.current_y; int height = it.ascent + it.descent; partial_height = (vis_height < height) ? vis_height : 0; } else { int last_line_y = it.current_y; move_it_by_lines (&it, 1); partial_height = (it.current_y > it.last_visible_y) ? it.last_visible_y - last_line_y : 0; } RESTORE_IT (&it, &it, it_data); return partial_height; } From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 22 12:59:02 2017 Received: (at 5718) by debbugs.gnu.org; 22 Jan 2017 17:59:02 +0000 Received: from localhost ([127.0.0.1]:38457 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cVMPu-0000PV-Ku for submit@debbugs.gnu.org; Sun, 22 Jan 2017 12:59:02 -0500 Received: from eggs.gnu.org ([208.118.235.92]:43054) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cVMPt-0000P3-Hn for 5718@debbugs.gnu.org; Sun, 22 Jan 2017 12:59:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cVMPl-0003DD-3k for 5718@debbugs.gnu.org; Sun, 22 Jan 2017 12:58:56 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:43528) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cVMPY-00035b-TB; Sun, 22 Jan 2017 12:58:40 -0500 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3917 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cVMPU-0008Gy-P5; Sun, 22 Jan 2017 12:58:37 -0500 Date: Sun, 22 Jan 2017 19:58:32 +0200 Message-Id: <83shob3rjr.fsf@gnu.org> From: Eli Zaretskii To: npostavs@users.sourceforge.net In-reply-to: <87inp7ui27.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net) Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> <87a8ggwcoo.fsf@users.sourceforge.net> <83inv4cc0s.fsf@gnu.org> <87d1ka17dr.fsf@users.sourceforge.net> <834m5l9g1d.fsf@gnu.org> <874m5j19wi.fsf@users.sourceforge.net> <83zina75pa.fsf@gnu.org> <87pok555q4.fsf@users.sourceforge.net> <831swfcmhz.fsf@gnu.org> <871sw6z32n.fsf@users.sourceforge.net> <83o9zaax8x.fsf@gnu.org> <87k29wxam1.fsf@users.sourceforge.net> <83a8ar9bl6.fsf@gnu.org> <87pojguu7m.fsf@users.sourceforge.net> <83d1fg5iku.fsf@gnu.org> <87inp7ui27.fsf@users.sourceforge.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -8.2 (--------) X-Debbugs-Envelope-To: 5718 Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -8.2 (--------) > From: npostavs@users.sourceforge.net > Cc: 5718@debbugs.gnu.org, ahyatt@gmail.com, gavenkoa@gmail.com > Date: Sun, 22 Jan 2017 12:21:20 -0500 > > > When you copy the iterator structure and modify the copy, you need to > > save and restore the bidi cache, using SAVE_IT and RESTORE_IT macros. > > Otherwise, the code which calls this function will work incorrectly if > > it uses the original iterator after the call, because the bidi cache > > is not restored to its state before the call. > > I came up with this modified version of partial_line_height, which does > actually work. It looks good to me, thanks. > Having to do RESTORE_IT (&it, &it, it_data) is a bit > unintuitive though. I don't understand what the typical use case of > this macro is, if it's going to copy back the new state into the > original `it', then why use a separate `it' in the first place? If you don't modify the original iterator object, then you indeed don't need to copy back, you only need to restore the bidi cache state, by calling bidi_unshelve_cache directly, as some code fragments actually do. (The macro refrains from copying if the two arguments point to the same object, so it transparently does this for you.) More generally, two separate arguments are needed because some of the macro uses choose one of several copies to copy back. For example: if (result == MOVE_LINE_CONTINUED && it->line_wrap == WORD_WRAP && wrap_it.sp >= 0 && ((atpos_it.sp >= 0 && wrap_it.current_x < atpos_it.current_x) || (atx_it.sp >= 0 && wrap_it.current_x < atx_it.current_x))) RESTORE_IT (it, &wrap_it, wrap_data); else if (atpos_it.sp >= 0) RESTORE_IT (it, &atpos_it, atpos_data); else if (atx_it.sp >= 0) RESTORE_IT (it, &atx_it, atx_data); The general paradigm is: . save 'it' in some local variable . modify 'it' . restore 'it' from the local variable . continue using 'it' as if the modification never happened > By the way, while testing I noticed that `set-window-text-height' > doesn't take `line-spacing' into account, should it? No, because it returns its value in canonical line units, which means no line-spacing. From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 28 19:56:23 2017 Received: (at 5718) by debbugs.gnu.org; 29 Jan 2017 00:56:23 +0000 Received: from localhost ([127.0.0.1]:49579 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cXdn4-00053x-Qw for submit@debbugs.gnu.org; Sat, 28 Jan 2017 19:56:23 -0500 Received: from mail-io0-f177.google.com ([209.85.223.177]:34810) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cXdn1-00053Z-5W; Sat, 28 Jan 2017 19:56:19 -0500 Received: by mail-io0-f177.google.com with SMTP id l66so86136085ioi.1; Sat, 28 Jan 2017 16:56:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=cK0iK/GIgw9rGNxc4xkfEey0b7FVOwtKtgGsDCJYFnU=; b=B90JCnpFHToVnzCDdZnN//I1JiH5cESdXXRaBTKJhNvCUDOBqvkKo7vuQNiuy2M7T5 yKD30i4ZtpGdJ4rCezWyUyB1Q/P1qzyNr34B+v32wbxmF47+Q+CDhZMFAckq4wRAL+UW b2pMh+v8rzF+uT+n3aQL8S+v0Rx7yVCDmveWhdkEB9dsOgs/bggmRrovvD0iAixE1Esu 0jzG/HsOvTZEvrgjTDppR6TEuMTgs8N3M1eBYmpiFxMGnhqI/uGEeyIX9NqkhMBcimCL ZMiD7Bhh8UMUQ/XUnX9lg8GIrXFQ8myMS3MYUhebfx+yNTVzNCVVXdla8zZ4z0zrfyZs XQew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=cK0iK/GIgw9rGNxc4xkfEey0b7FVOwtKtgGsDCJYFnU=; b=pqMUbNK0VEbXBaf3qGbh+PLrm0XzaBAhUhw8TYEClAWV0X5NgFDgigWwC1YTNdjSuF hZWd9j+0vD07UKtYexmj47cg6CrmYjkHt08+VieXmKbR09q/KT4CrboffVjdqficoQhI zzDNvRRwI02nvvs1tFGpp/VFKYCMH9g9bjEs8Gi7Qvuj7YL8ZQAjUeONUO8Y42ZxO4t6 qCzj1plbDDJGhHHlE2Z0xmGK0i26PY+N5eAo4pu0P94DOtMvKyQWve7ZvNobTVwl9a7/ Gjcc1EZujizGMqJ1U2RuYtfDKYQ+zfhb8Ws96x9cO3qaEXjiRCQMP0gmiQ74Vyscd8CU 53cg== X-Gm-Message-State: AIkVDXIepOZKr/Sg0cUdF8S6D1FexxNBOZB4w86wWJz+HR5L7T7Se4g2nqkSs+2DSP8ENQ== X-Received: by 10.107.59.129 with SMTP id i123mr15565409ioa.232.1485651373521; Sat, 28 Jan 2017 16:56:13 -0800 (PST) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id m79sm5910993ioo.0.2017.01.28.16.56.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 28 Jan 2017 16:56:12 -0800 (PST) From: npostavs@users.sourceforge.net To: Eli Zaretskii Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> <87a8ggwcoo.fsf@users.sourceforge.net> <83inv4cc0s.fsf@gnu.org> <87d1ka17dr.fsf@users.sourceforge.net> <834m5l9g1d.fsf@gnu.org> <874m5j19wi.fsf@users.sourceforge.net> <83zina75pa.fsf@gnu.org> <87pok555q4.fsf@users.sourceforge.net> <831swfcmhz.fsf@gnu.org> <871sw6z32n.fsf@users.sourceforge.net> <83o9zaax8x.fsf@gnu.org> <87k29wxam1.fsf@users.sourceforge.net> <83a8ar9bl6.fsf@gnu.org> <87pojguu7m.fsf@users.sourceforge.net> <83d1fg5iku.fsf@gnu.org> <87inp7ui27.fsf@users.sourceforge.net> <83shob3rjr.fsf@gnu.org> Date: Sat, 28 Jan 2017 19:57:21 -0500 In-Reply-To: <83shob3rjr.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 22 Jan 2017 19:58:32 +0200") Message-ID: <87inoysmxa.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.6 (/) X-Debbugs-Envelope-To: 5718 Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.6 (/) --=-=-= Content-Type: text/plain tags 5718 patch quit Eli Zaretskii writes: >> >> I came up with this modified version of partial_line_height, which does >> actually work. > > It looks good to me, thanks. Okay, I think this is ready now, I'm posting the final patchset for reference. It's basically the same as the previous stuff, but I've made maximum-scroll-margin customizable, and renamed window-tests.el to test/manual/scroll-tests.el (since it only works in an interactive session). I'll push to master in a couple of days. --=-=-= Content-Type: application/octet-stream Content-Disposition: attachment; filename=v4-0001-Refactor-uses-of-scroll_margin-to-a-function.patch.gz Content-Transfer-Encoding: base64 Content-Description: patch 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 IqPYYFVK7VLVsv4H7XLOXGAtAAA= --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=v4-0002-Don-t-count-mode-line-for-scroll-margin-limit.patch Content-Description: patch >From 775da8da80acd65033624c57057015628a8f2bba Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sun, 28 Aug 2016 17:23:04 -0400 Subject: [PATCH v4 2/5] Don't count mode line for scroll-margin limit * src/window.c (window_scroll_margin): Use window_box_height to avoid counting header line, scrollbars for scroll-margin limit (Bug #5718). --- src/window.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/window.c b/src/window.c index 5333a6f..e499dfb 100644 --- a/src/window.c +++ b/src/window.c @@ -4802,10 +4802,8 @@ window_scroll_margin (struct window *window, enum margin_unit unit) if (scroll_margin > 0) { int frame_line_height = default_line_pixel_height (window); - int window_total_lines - = window->total_lines * WINDOW_FRAME_LINE_HEIGHT (window) - / frame_line_height; - int margin = min (scroll_margin, window_total_lines / 4); + int window_lines = window_box_height (window) / frame_line_height; + int margin = min (scroll_margin, window_lines / 4); if (unit == MARGIN_IN_PIXELS) return margin * frame_line_height; else -- 2.9.3 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=v4-0003-Make-limit-on-scroll-margin-variable.patch Content-Description: patch >From ae56bb9600019e2c2a6a5f8c22c36bd08a737d1c Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sun, 11 Sep 2016 11:09:57 -0400 Subject: [PATCH v4 3/5] Make limit on scroll-margin variable * src/xdisp.c (maximum-scroll-margin): New variable. * lisp/cus-start.el: Make it customizable. * etc/NEWS: Mention it. * src/window.c (window_scroll_pixel_based): Use it instead of hardcoding division by 4 (Bug #5718). --- etc/NEWS | 4 ++++ lisp/cus-start.el | 1 + src/window.c | 19 ++++++++++++++----- src/xdisp.c | 8 ++++++++ 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index b89e8e4..07b8051 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -307,6 +307,10 @@ local part of a remote file name. Thus, if you have a directory named "/~" on the remote host "foo", you can prevent it from being substituted by a home directory by writing it as "/foo:/:/~/file". +** The new variable 'maximum-scroll-margin' allows having effective +settings of 'scroll-margin' up to half the window size, instead of +always restricting the margin to a quarter of the window. + * Editing Changes in Emacs 26.1 diff --git a/lisp/cus-start.el b/lisp/cus-start.el index a790419..51c43c7 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -511,6 +511,7 @@ minibuffer-prompt-properties--setter (scroll-step windows integer) (scroll-conservatively windows integer) (scroll-margin windows integer) + (maximum-scroll-margin windows float "26.1") (hscroll-margin windows integer "22.1") (hscroll-step windows number "22.1") (truncate-partial-width-windows diff --git a/src/window.c b/src/window.c index e499dfb..7d86d9d 100644 --- a/src/window.c +++ b/src/window.c @@ -4803,11 +4803,20 @@ window_scroll_margin (struct window *window, enum margin_unit unit) { int frame_line_height = default_line_pixel_height (window); int window_lines = window_box_height (window) / frame_line_height; - int margin = min (scroll_margin, window_lines / 4); - if (unit == MARGIN_IN_PIXELS) - return margin * frame_line_height; - else - return margin; + + double ratio = 0.25; + if (FLOATP (Vmaximum_scroll_margin)) + { + ratio = XFLOAT_DATA (Vmaximum_scroll_margin); + ratio = max (0.0, ratio); + ratio = min (ratio, 0.5); + } + int max_margin = min ((window_lines - 1)/2, + (int) (window_lines * ratio)); + int margin = clip_to_bounds (0, scroll_margin, max_margin); + return (unit == MARGIN_IN_PIXELS) + ? margin * frame_line_height + : margin; } else return 0; diff --git a/src/xdisp.c b/src/xdisp.c index 8a450b7..134ef6c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -31520,6 +31520,14 @@ syms_of_xdisp (void) of the top or bottom of the window. */); scroll_margin = 0; + DEFVAR_LISP ("maximum-scroll-margin", Vmaximum_scroll_margin, + doc: /* Maximum effective value of `scroll-margin'. +Given as a fraction of the current window's lines. The value should +be a floating point number between 0.0 and 0.5. The effective maximum +is limited to (/ (1- window-lines) 2). Non-float values for this +variable are ignored and the default 0.25 is used instead. */); + Vmaximum_scroll_margin = make_float (0.25); + DEFVAR_LISP ("display-pixels-per-inch", Vdisplay_pixels_per_inch, doc: /* Pixels per inch value for non-window system displays. Value is a number or a cons (WIDTH-DPI . HEIGHT-DPI). */); -- 2.9.3 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=v4-0004-Fix-scrolling-with-partial-lines.patch Content-Description: patch >From 239fe08b7667e397913842fe4a7fc5784dd5ea27 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 21 Jan 2017 13:24:47 -0500 Subject: [PATCH v4 4/5] Fix scrolling with partial lines * src/xdisp.c (partial_line_height): New function. (try_scrolling): * src/window.c (window_scroll_pixel_based): Use it for calculating the pixel scroll margin correctly in a window with partial lines. --- src/dispextern.h | 1 + src/window.c | 2 +- src/xdisp.c | 29 ++++++++++++++++++++++++++++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/dispextern.h b/src/dispextern.h index 51222e6..eb71a82 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3263,6 +3263,7 @@ void move_it_past_eol (struct it *); void move_it_in_display_line (struct it *it, ptrdiff_t to_charpos, int to_x, enum move_operation_enum op); +int partial_line_height (struct it *it_origin); bool in_display_vector_p (struct it *); int frame_mode_line_height (struct frame *); extern bool redisplaying_p; diff --git a/src/window.c b/src/window.c index 7d86d9d..9feeede 100644 --- a/src/window.c +++ b/src/window.c @@ -5149,7 +5149,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, bool noerror) in the scroll margin at the bottom. */ move_it_to (&it, PT, -1, (it.last_visible_y - WINDOW_HEADER_LINE_HEIGHT (w) - - this_scroll_margin - 1), + - partial_line_height (&it) - this_scroll_margin - 1), -1, MOVE_TO_POS | MOVE_TO_Y); diff --git a/src/xdisp.c b/src/xdisp.c index 134ef6c..0e329df 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -9859,6 +9859,32 @@ move_it_by_lines (struct it *it, ptrdiff_t dvpos) } } +int +partial_line_height (struct it *it_origin) +{ + int partial_height; + void *it_data = NULL; + struct it it; + SAVE_IT (it, *it_origin, it_data); + move_it_to (&it, ZV, -1, it.last_visible_y, -1, + MOVE_TO_POS | MOVE_TO_Y); + if (it.what == IT_EOB) + { + int vis_height = it.last_visible_y - it.current_y; + int height = it.ascent + it.descent; + partial_height = (vis_height < height) ? vis_height : 0; + } + else + { + int last_line_y = it.current_y; + move_it_by_lines (&it, 1); + partial_height = (it.current_y > it.last_visible_y) + ? it.last_visible_y - last_line_y : 0; + } + RESTORE_IT (&it, &it, it_data); + return partial_height; +} + /* Return true if IT points into the middle of a display vector. */ bool @@ -15368,7 +15394,8 @@ try_scrolling (Lisp_Object window, bool just_this_one_p, /* Compute the pixel ypos of the scroll margin, then move IT to either that ypos or PT, whichever comes first. */ start_display (&it, w, startp); - scroll_margin_y = it.last_visible_y - this_scroll_margin + scroll_margin_y = it.last_visible_y - partial_line_height (&it) + - this_scroll_margin - frame_line_height * extra_scroll_margin_lines; move_it_to (&it, PT, -1, scroll_margin_y - 1, -1, (MOVE_TO_POS | MOVE_TO_Y)); -- 2.9.3 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=v4-0005-Add-tests-for-scrolling.patch Content-Description: patch >From 198d9ec8bbcc93ba676b09627b08ace1cd611a74 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 28 Jan 2017 16:54:33 -0500 Subject: [PATCH v4 5/5] Add tests for scrolling * test/manual/scroll-tests.el: New tests for scroll-margin behavior. --- test/manual/scroll-tests.el | 130 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 test/manual/scroll-tests.el diff --git a/test/manual/scroll-tests.el b/test/manual/scroll-tests.el new file mode 100644 index 0000000..1167efd --- /dev/null +++ b/test/manual/scroll-tests.el @@ -0,0 +1,130 @@ +;;; scroll-tests.el -- tests for scrolling -*- lexical-binding: t -*- + +;; Copyright (C) 2017 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; These are mostly automated ert tests, but they don't work in batch +;; mode which is why they are under test/manual. + +;;; Code: + +(require 'ert) +(eval-when-compile (require 'cl-lib)) + +(defun scroll-tests-up-and-down (margin &optional effective-margin) + (unless effective-margin + (setq effective-margin margin)) + (erase-buffer) + (insert (mapconcat #'number-to-string + (number-sequence 1 200) "\n")) + (goto-char 1) + (sit-for 0) + (let ((scroll-margin margin) + (wstart (window-start))) + ;; Stopping before `scroll-margin' so we shouldn't have + ;; scrolled. + (let ((current-prefix-arg (- (window-text-height) 1 effective-margin))) + (call-interactively 'next-line)) + (sit-for 0) + (should (= wstart (window-start))) + ;; Passing `scroll-margin' should trigger scrolling. + (call-interactively 'next-line) + (sit-for 0) + (should (/= wstart (window-start))) + ;; Scroll back to top. + (let ((current-prefix-arg (window-start))) + (call-interactively 'scroll-down-command)) + (sit-for 0) + (should (= 1 (window-start))))) + +(defmacro scroll-tests-with-buffer-window (&rest body) + (declare (debug t)) + `(with-temp-buffer + (with-selected-window (display-buffer (current-buffer)) + ,@body))) + +(ert-deftest scroll-tests-scroll-margin-0 () + (skip-unless (not noninteractive)) + (scroll-tests-with-buffer-window + (scroll-tests-up-and-down 0))) + +(ert-deftest scroll-tests-scroll-margin-negative () + "A negative `scroll-margin' should be the same as 0." + (skip-unless (not noninteractive)) + (scroll-tests-with-buffer-window + (scroll-tests-up-and-down -10 0))) + +(ert-deftest scroll-tests-scroll-margin-max () + (skip-unless (not noninteractive)) + (scroll-tests-with-buffer-window + (let ((max-margin (/ (window-text-height) 4))) + (scroll-tests-up-and-down max-margin)))) + +(ert-deftest scroll-tests-scroll-margin-over-max () + "A `scroll-margin' more than max should be the same as max." + (skip-unless (not noninteractive)) + (scroll-tests-with-buffer-window + (set-window-text-height nil 7) + (let ((max-margin (/ (window-text-height) 4))) + (scroll-tests-up-and-down (+ max-margin 1) max-margin) + (scroll-tests-up-and-down (+ max-margin 2) max-margin)))) + +(defun scroll-tests--point-in-middle-of-window-p () + (= (count-lines (window-start) (window-point)) + (/ (1- (window-text-height)) 2))) + +(cl-defun scroll-tests--scroll-margin-whole-window (&key with-line-spacing) + "Test `maximum-scroll-margin' at 0.5. +With a high `scroll-margin', this should keep cursor in the +middle of the window." + (let ((maximum-scroll-margin 0.5) + (scroll-margin 100)) + (scroll-tests-with-buffer-window + (setq-local line-spacing with-line-spacing) + ;; Choose an odd number, so there is one line in the middle. + (set-window-text-height nil 7) + ;; `set-window-text-height' doesn't count `line-spacing'. + (when with-line-spacing + (window-resize nil (* line-spacing 7) nil nil 'pixels)) + (erase-buffer) + (insert (mapconcat #'number-to-string + (number-sequence 1 200) "\n")) + (goto-char 1) + (sit-for 0) + (call-interactively 'scroll-up-command) + (sit-for 0) + (should (scroll-tests--point-in-middle-of-window-p)) + (call-interactively 'scroll-up-command) + (sit-for 0) + (should (scroll-tests--point-in-middle-of-window-p)) + (call-interactively 'scroll-down-command) + (sit-for 0) + (should (scroll-tests--point-in-middle-of-window-p))))) + +(ert-deftest scroll-tests-scroll-margin-whole-window () + (skip-unless (not noninteractive)) + (scroll-tests--scroll-margin-whole-window)) + +(ert-deftest scroll-tests-scroll-margin-whole-window-line-spacing () + ;; `line-spacing' has no effect on tty displays. + (skip-unless (display-graphic-p)) + (scroll-tests--scroll-margin-whole-window :with-line-spacing 3)) + + +;;; scroll-tests.el ends here -- 2.9.3 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 30 10:29:54 2017 Received: (at 5718) by debbugs.gnu.org; 30 Jan 2017 15:29:54 +0000 Received: from localhost ([127.0.0.1]:51284 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYDtx-000150-VG for submit@debbugs.gnu.org; Mon, 30 Jan 2017 10:29:54 -0500 Received: from eggs.gnu.org ([208.118.235.92]:47069) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYDtw-00014n-4R for 5718@debbugs.gnu.org; Mon, 30 Jan 2017 10:29:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cYDtl-0002q0-VZ for 5718@debbugs.gnu.org; Mon, 30 Jan 2017 10:29:46 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:60286) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYDta-0002m8-RB; Mon, 30 Jan 2017 10:29:30 -0500 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4027 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cYDtZ-00070h-TW; Mon, 30 Jan 2017 10:29:30 -0500 Date: Mon, 30 Jan 2017 17:29:26 +0200 Message-Id: <834m0gy3ah.fsf@gnu.org> From: Eli Zaretskii To: npostavs@users.sourceforge.net In-reply-to: <87inoysmxa.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net) Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> <87a8ggwcoo.fsf@users.sourceforge.net> <83inv4cc0s.fsf@gnu.org> <87d1ka17dr.fsf@users.sourceforge.net> <834m5l9g1d.fsf@gnu.org> <874m5j19wi.fsf@users.sourceforge.net> <83zina75pa.fsf@gnu.org> <87pok555q4.fsf@users.sourceforge.net> <831swfcmhz.fsf@gnu.org> <871sw6z32n.fsf@users.sourceforge.net> <83o9zaax8x.fsf@gnu.org> <87k29wxam1.fsf@users.sourceforge.net> <83a8ar9bl6.fsf@gnu.org> <87pojguu7m.fsf@users.sourceforge.net> <83d1fg5iku.fsf@gnu.org> <87inp7ui27.fsf@users.sourceforge.net> <83shob3rjr.fsf@gnu.org> <87inoysmxa.fsf@users.sourceforge.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -8.2 (--------) X-Debbugs-Envelope-To: 5718 Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -8.2 (--------) > From: npostavs@users.sourceforge.net > Cc: 5718@debbugs.gnu.org, ahyatt@gmail.com, gavenkoa@gmail.com > Date: Sat, 28 Jan 2017 19:57:21 -0500 > > Okay, I think this is ready now, I'm posting the final patchset for > reference. It's basically the same as the previous stuff, but I've made > maximum-scroll-margin customizable, and renamed window-tests.el to > test/manual/scroll-tests.el (since it only works in an interactive > session). > > I'll push to master in a couple of days. Thanks, it LGTM. Would you mind to mention the new option in the user manual? From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 30 23:51:22 2017 Received: (at 5718) by debbugs.gnu.org; 31 Jan 2017 04:51:22 +0000 Received: from localhost ([127.0.0.1]:51602 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYQPZ-00064Q-Rq for submit@debbugs.gnu.org; Mon, 30 Jan 2017 23:51:22 -0500 Received: from mail-io0-f195.google.com ([209.85.223.195]:35762) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYQPY-00064E-GD for 5718@debbugs.gnu.org; Mon, 30 Jan 2017 23:51:20 -0500 Received: by mail-io0-f195.google.com with SMTP id m98so16741917iod.2 for <5718@debbugs.gnu.org>; Mon, 30 Jan 2017 20:51:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=51WE/nQpwEvUgQAIvx1rUELfDokyhgyvobW3HjCZDr4=; b=AdRhdRYVZ4B9Jiny65sxOcPF0OeZDY2bIMMnstdsM829JBaVsCjTQFC7/jZ2/3DhEy b1fayKlLKxMObYwrA19Fnr7XgWQmtLZXMMcrTF+p8EeocRSqtTRqogn8M0efyMMPzX2z UMVUMKTGNPL/M02DSoT5DCfvjE+u0vIk9ZOx4lfhzamfXLIh0xtOwoH2OznPEkc9ffZS wR8g/yL0If/N8IabWKZ+XktnNxoix+ey2khYNK1xNH9fJsLRxvgtnoDZ4YDxzuJcs8w+ Dqr0JGGicncVLg8nipMSAorLONbPMZFSayiuRwDy8UVSnj5DLaffmbA8VW5zTtNslN6t ziPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=51WE/nQpwEvUgQAIvx1rUELfDokyhgyvobW3HjCZDr4=; b=YGtZvHxWDqPz85CnAb1zHWm9F+T961N5cIN7XBbHIeNL603NfIqjd3w6mM3e8JEOpz EQ/JAfqSTFfLVuXhlYQzZOxVvw+/qZwuOkPPmHhPluAa8MRhAyqbuztdG2Jd9nco+3j1 +r6+AoGU0fbEajQ52PCKNV/VwbqPwr+Qm+TrEtwDHmQK3ar/4vl+Baf42zdkExyV4Wva aVGjJpCdyxsQoAyVCKR+dYNh4E7PhN/7oEwIlBpvoZQaiiJc18Fr96i8KWEA1zhFprzF 05ttR7DeA4fN6/D9l9+Galc8hyZyA4yIslGEshaj7Fz5WESV3uF0MIUvwcXbSZENen+Y OZuA== X-Gm-Message-State: AIkVDXLC2mClHpgYRaTHOHPlUPDyu9/SRYpS92tyYEsC6S1OPYDkT+uyM/2nMDi3GcxGGg== X-Received: by 10.107.148.141 with SMTP id w135mr24240903iod.229.1485838274991; Mon, 30 Jan 2017 20:51:14 -0800 (PST) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id q89sm9565459ioi.42.2017.01.30.20.51.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jan 2017 20:51:13 -0800 (PST) From: npostavs@users.sourceforge.net To: Eli Zaretskii Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> <87a8ggwcoo.fsf@users.sourceforge.net> <83inv4cc0s.fsf@gnu.org> <87d1ka17dr.fsf@users.sourceforge.net> <834m5l9g1d.fsf@gnu.org> <874m5j19wi.fsf@users.sourceforge.net> <83zina75pa.fsf@gnu.org> <87pok555q4.fsf@users.sourceforge.net> <831swfcmhz.fsf@gnu.org> <871sw6z32n.fsf@users.sourceforge.net> <83o9zaax8x.fsf@gnu.org> <87k29wxam1.fsf@users.sourceforge.net> <83a8ar9bl6.fsf@gnu.org> <87pojguu7m.fsf@users.sourceforge.net> <83d1fg5iku.fsf@gnu.org> <87inp7ui27.fsf@users.sourceforge.net> <83shob3rjr.fsf@gnu.org> <87inoysmxa.fsf@users.sourceforge.net> <834m0gy3ah.fsf@gnu.org> Date: Mon, 30 Jan 2017 23:52:22 -0500 In-Reply-To: <834m0gy3ah.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 30 Jan 2017 17:29:26 +0200") Message-ID: <87bmunrfuh.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.6 (/) X-Debbugs-Envelope-To: 5718 Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.6 (/) Eli Zaretskii writes: >> From: npostavs@users.sourceforge.net >> Cc: 5718@debbugs.gnu.org, ahyatt@gmail.com, gavenkoa@gmail.com >> Date: Sat, 28 Jan 2017 19:57:21 -0500 >> >> Okay, I think this is ready now, I'm posting the final patchset for >> reference. It's basically the same as the previous stuff, but I've made >> maximum-scroll-margin customizable, and renamed window-tests.el to >> test/manual/scroll-tests.el (since it only works in an interactive >> session). >> >> I'll push to master in a couple of days. > > Thanks, it LGTM. Would you mind to mention the new option in the user > manual? Oh right, forgot about that. Does this look okay? diff --git c/doc/emacs/display.texi i/doc/emacs/display.texi index c6e990d..4c4d696 100644 --- c/doc/emacs/display.texi +++ i/doc/emacs/display.texi @@ -285,13 +285,17 @@ Auto Scrolling @code{scroll-up-aggressively} / @code{scroll-down-aggressively}. @vindex scroll-margin +@vindex maximum-scroll-margin The variable @code{scroll-margin} restricts how close point can come to the top or bottom of a window (even if aggressive scrolling specifies a fraction @var{f} that is larger than the window portion between the top and the bottom margins). Its value is a number of screen lines; if point comes within that many lines of the top or bottom of the window, Emacs performs automatic scrolling. By default, -@code{scroll-margin} is 0. +@code{scroll-margin} is 0. The effective margin size is limited to a +quarter of the window height by default, but this limit can be +increased up to half (or decreased down to zero) by customizing +@code{maximum-scroll-margin}. @node Horizontal Scrolling @section Horizontal Scrolling diff --git c/doc/lispref/windows.texi i/doc/lispref/windows.texi index 6f3de0c..affa28c 100644 --- c/doc/lispref/windows.texi +++ i/doc/lispref/windows.texi @@ -3924,6 +3924,21 @@ Textual Scrolling out of the margin, closer to the center of the window. @end defopt +@defopt maximum-scroll-margin +This variable limits the effective value of @code{scroll-margin} to a +fraction of the current window line height. For example, if the +current window has 20 lines and @code{maximum-scroll-margin} is 0.1, +then the scroll margins will never be larger than 2 lines, no matter +how big @code{scroll-margin} is. + +@code{maximum-scroll-margin} itself has a maximum value of 0.5, which +allows setting margins large to keep the cursor at the middle line of +the window (or two middle lines if the window has an even number of +lines). If it's set to a larger value (or any value other than a +float between 0.0 and 0.5) then the default value of 0.25 will be used +instead. +@end defopt + @defopt scroll-conservatively This variable controls how scrolling is done automatically when point moves off the screen (or into the scroll margin). If the value is a From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 31 10:33:56 2017 Received: (at 5718) by debbugs.gnu.org; 31 Jan 2017 15:33:56 +0000 Received: from localhost ([127.0.0.1]:52371 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYaRQ-00069I-A9 for submit@debbugs.gnu.org; Tue, 31 Jan 2017 10:33:56 -0500 Received: from eggs.gnu.org ([208.118.235.92]:42195) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYaRO-000694-Vf for 5718@debbugs.gnu.org; Tue, 31 Jan 2017 10:33:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cYaRI-0005NT-T4 for 5718@debbugs.gnu.org; Tue, 31 Jan 2017 10:33:49 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:48846) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYaRC-0005GG-17; Tue, 31 Jan 2017 10:33:42 -0500 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4905 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cYaRB-0004tp-6U; Tue, 31 Jan 2017 10:33:41 -0500 Date: Tue, 31 Jan 2017 17:33:21 +0200 Message-Id: <83inovw8fy.fsf@gnu.org> From: Eli Zaretskii To: npostavs@users.sourceforge.net In-reply-to: <87bmunrfuh.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net) Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> <87a8ggwcoo.fsf@users.sourceforge.net> <83inv4cc0s.fsf@gnu.org> <87d1ka17dr.fsf@users.sourceforge.net> <834m5l9g1d.fsf@gnu.org> <874m5j19wi.fsf@users.sourceforge.net> <83zina75pa.fsf@gnu.org> <87pok555q4.fsf@users.sourceforge.net> <831swfcmhz.fsf@gnu.org> <871sw6z32n.fsf@users.sourceforge.net> <83o9zaax8x.fsf@gnu.org> <87k29wxam1.fsf@users.sourceforge.net> <83a8ar9bl6.fsf@gnu.org> <87pojguu7m.fsf@users.sourceforge.net> <83d1fg5iku.fsf@gnu.org> <87inp7ui27.fsf@users.sourceforge.net> <83shob3rjr.fsf@gnu.org> <87inoysmxa.fsf@users.sourceforge.net> <834m0gy3ah.fsf@gnu.org> <87bmunrfuh.fsf@users.sourceforge.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 5718 Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > From: npostavs@users.sourceforge.net > Cc: 5718@debbugs.gnu.org, ahyatt@gmail.com, gavenkoa@gmail.com > Date: Mon, 30 Jan 2017 23:52:22 -0500 > > > Thanks, it LGTM. Would you mind to mention the new option in the user > > manual? > > Oh right, forgot about that. Does this look okay? Yes, thanks. From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 02 21:39:56 2017 Received: (at 5718) by debbugs.gnu.org; 3 Feb 2017 02:39:56 +0000 Received: from localhost ([127.0.0.1]:54349 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cZTn2-0005go-K1 for submit@debbugs.gnu.org; Thu, 02 Feb 2017 21:39:56 -0500 Received: from mail-qt0-f194.google.com ([209.85.216.194]:35189) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cZTn0-0005gW-Qa; Thu, 02 Feb 2017 21:39:55 -0500 Received: by mail-qt0-f194.google.com with SMTP id s58so1691644qtc.2; Thu, 02 Feb 2017 18:39:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=hwDG/IzRhiJbH52+ET+GQMoVqIVsW0w9iRLk2+Gy4MA=; b=cFWRj+ROo6b4jpUqiqMoEtsH28VtoInT3wsGJQwhXh+dfU8/okGQ22aawckm7gNgyh OXhh0onug/IE0DLv3PBChrgJquXvCwRF0Kk4tP3OHH2uWMxuXOymK8eWnUQM3PcxnL5Z t7VCIYadF7+38ErJjYLt5nOuAEL/A3HEhYtuVaxwy4KimUnqdnUeyW5Cff0LPm4ccGdA M0Jk+Z6VtdSAITh9kTQVM1BeUY+b7oUx51FbfI2S1My6GrbGCdFT0+VR+D8AKyh8w+/A Y6elrPRNDtHV0yPtJ67aiCe6yEyoDbdJgA3Z0jaeM4wh56LvmUBDpIwmxHAz8iVPNpMx FBFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=hwDG/IzRhiJbH52+ET+GQMoVqIVsW0w9iRLk2+Gy4MA=; b=UYcnxVD3F0nKl8bNtsrB4o3zWi3jLSYtRjECBtpQLZ2I55q/SjBkgtAI3v+thjnnDe /bq+lnMWwMicVFcgilg84NUHXksEa//2KQx5xfw6xcwZ6oETiklY6q2HrsdlbXIM3/OL 7GoLFuXy0fRvZj1FhqccKnQjvTUpAGndfzuOhqK0JUtLEmh/vw+QAhpsFpSFC+Ji3Mzr ZBN/0BDZu3r4iDCkZPaqoiHkiqRKUSKZPd3Fy+NjTAXf75LARdXZoW7vDZiS9SYBn8yy pmFAWdSvbh4JN4C+OvkTXNcbGIgOpy5wJQ8QE+7uYv8MobX8vUkFuXyIbnZzpZ6puLLG wusA== X-Gm-Message-State: AMke39nxwj1kWc9rtrKDDvYIGeEuTkFJopl5bvUeEOp10TvVgHjFL7ZD3s2IY+9KGp/kmw== X-Received: by 10.55.131.4 with SMTP id f4mr11366856qkd.1.1486089589343; Thu, 02 Feb 2017 18:39:49 -0800 (PST) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id a54sm23119278qta.48.2017.02.02.18.39.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Feb 2017 18:39:48 -0800 (PST) From: npostavs@users.sourceforge.net To: Eli Zaretskii Subject: Re: bug#5718: scroll-margin in buffer with small line count. References: <4B9D1C61.70903@gmail.com> <87a8ggwcoo.fsf@users.sourceforge.net> <83inv4cc0s.fsf@gnu.org> <87d1ka17dr.fsf@users.sourceforge.net> <834m5l9g1d.fsf@gnu.org> <874m5j19wi.fsf@users.sourceforge.net> <83zina75pa.fsf@gnu.org> <87pok555q4.fsf@users.sourceforge.net> <831swfcmhz.fsf@gnu.org> <871sw6z32n.fsf@users.sourceforge.net> <83o9zaax8x.fsf@gnu.org> <87k29wxam1.fsf@users.sourceforge.net> <83a8ar9bl6.fsf@gnu.org> <87pojguu7m.fsf@users.sourceforge.net> <83d1fg5iku.fsf@gnu.org> <87inp7ui27.fsf@users.sourceforge.net> <83shob3rjr.fsf@gnu.org> <87inoysmxa.fsf@users.sourceforge.net> <834m0gy3ah.fsf@gnu.org> <87bmunrfuh.fsf@users.sourceforge.net> <83inovw8fy.fsf@gnu.org> Date: Thu, 02 Feb 2017 21:40:57 -0500 In-Reply-To: <83inovw8fy.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 31 Jan 2017 17:33:21 +0200") Message-ID: <87poj0ov2e.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 5718 Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) tags 5718 fixed close 5718 26.1 quit Eli Zaretskii writes: >> From: npostavs@users.sourceforge.net >> Cc: 5718@debbugs.gnu.org, ahyatt@gmail.com, gavenkoa@gmail.com >> Date: Mon, 30 Jan 2017 23:52:22 -0500 >> >> > Thanks, it LGTM. Would you mind to mention the new option in the user >> > manual? >> >> Oh right, forgot about that. Does this look okay? > > Yes, thanks. Pushed to master [1: ce88155]. 1: 2017-02-02 21:35:51 -0500 ce88155d83ba84e84321ed69a39c82f40117dd1f ; Merge: fixes and updates to scroll margin (Bug#5718) From unknown Sat Aug 16 11:12:16 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 03 Mar 2017 12:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator