From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitrii Kuragin via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#57434: 28.1.91; Terminal Emacs Mac OS flickering. Date: Mon, 29 Aug 2022 07:18:43 -0700 Message-ID: References: <83edx1znjl.fsf@gnu.org> <83czclzms4.fsf@gnu.org> Reply-To: Dmitrii Kuragin Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000009421c105e761f174" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33009"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Gerd =?UTF-8?Q?M=C3=B6llmann?= , 57434@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 29 16:20:32 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oSfct-0008PN-Kb for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 29 Aug 2022 16:20:31 +0200 Original-Received: from localhost ([::1]:57998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSfcs-0002ce-NS for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 29 Aug 2022 10:20:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49952) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSfcQ-0002aZ-Cy for bug-gnu-emacs@gnu.org; Mon, 29 Aug 2022 10:20:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43587) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oSfcQ-000831-3h for bug-gnu-emacs@gnu.org; Mon, 29 Aug 2022 10:20:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oSfcP-0001qw-No for bug-gnu-emacs@gnu.org; Mon, 29 Aug 2022 10:20:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitrii Kuragin Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 29 Aug 2022 14:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57434 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 57434-submit@debbugs.gnu.org id=B57434.16617827437045 (code B ref 57434); Mon, 29 Aug 2022 14:20:01 +0000 Original-Received: (at 57434) by debbugs.gnu.org; 29 Aug 2022 14:19:03 +0000 Original-Received: from localhost ([127.0.0.1]:33336 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oSfbS-0001pZ-UE for submit@debbugs.gnu.org; Mon, 29 Aug 2022 10:19:03 -0400 Original-Received: from mail-yw1-f171.google.com ([209.85.128.171]:39563) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oSfbQ-0001p4-B9 for 57434@debbugs.gnu.org; Mon, 29 Aug 2022 10:19:01 -0400 Original-Received: by mail-yw1-f171.google.com with SMTP id 00721157ae682-3376851fe13so199276317b3.6 for <57434@debbugs.gnu.org>; Mon, 29 Aug 2022 07:19:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=8tB4KrpSXshsAUItJ5BM6o4UUkZc0Tz/rxGP3JiBWyU=; b=EO+N9jmk/QNIBnKLpsyA8Zv63FlDvEvQodwFv3TnlCSiGePGZZ/hA92VVgcoN6VwnD qlPxlHG9IdHTH+3iBoufY1365mOlLTxL1eHq68kJFDufwV7GRAb2aSSWf2sEl//5lQc2 Ys9NEppvTgCrz3VQvX3R+6Aw2JLAvRU5jT0awxAoBJhiuQgm9Y3ImPrTVktCgbRZMsoH N+mcXYHw+Xik2iCTiPco5vIEnZSt2KKZJk+axosPOrWJO+i45Uc+2HTXD5m/YFW8yZKE 7SJciWbJo4q3Us7sw6MSx3tx9XVy9KOz6jebdQ2FnhDMFqggWM0anVnHhAz5Fj3ehO1y YJ+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=8tB4KrpSXshsAUItJ5BM6o4UUkZc0Tz/rxGP3JiBWyU=; b=a1JxCbBn19UOPIH8BM68N73wMTdAV14znwU1VN6Co3acJ70Nnz6rE/zWIHmTpkkf23 Qtpj9zcINSyvLkmHiy9inSPusHlzqNEE887LvQsJbtpnpCOMg7pDh4ebVS1XWywwmfGe An8KluZhn3IkLuZZ23tiDczWXS/IxkLEiNvsFkmIBVI6xuGDjm/Cnxak4adznvk8qyET uvmBSqrNkUZe5qATKx7KM1x3nKtkBAOiMnhish1qVQviGOJUIPRZKGnvt8g0ohDtILKM XFQZ3wkYmthUQgR6rkc2z+UQJyn7dptUMV0x1XhLAW7su17mIv4UKs4XyIEXVSGqp22M Y1Bg== X-Gm-Message-State: ACgBeo2Lbi+FzVU2miwj34idZzYg5YOarpNmqC8KGaPJEjDZgkQMDSyF nLMM8UZsr9wLV4GsZjZKIiw0xeMNcZYugfn1iPtQHQ== X-Google-Smtp-Source: AA6agR41jyk+DEkdM5Pg6oKfEzHm6zLxvwQqKU5eQKB3nBkOP+5mZ2iM6d+pMC432QLh9KEr6Dwa+rEvoXG3RNNuTaM= X-Received: by 2002:a25:2183:0:b0:69c:116e:270c with SMTP id h125-20020a252183000000b0069c116e270cmr3200320ybh.40.1661782734380; Mon, 29 Aug 2022 07:18:54 -0700 (PDT) In-Reply-To: <83czclzms4.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:241027 Archived-At: --0000000000009421c105e761f174 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I am having difficulty running a debugger. I tried gdb and signing, but it didn't work. I also tried lldb, but it doesn't stop on a breakpoint for whatever reason. I compiled with `-O0 -g3`, then ``` lldb (lldb) file nextstep/Emacs.app/Contents/MacOS/Emacs Current executable set to '/Users/kuragin/Desktop/emacs/nextstep/Emacs.app/Contents/MacOS/Emacs' (x86_64). (lldb) breakpoint set -f scroll.c -l 270 Breakpoint 1: where =3D Emacs`do_scrolling + 485 at scroll.c:271:11, addres= s =3D 0x0000000100032da5 ``` But, it doesn't stop there... and I run Emacs like this: ``` arch --x86_64 make configure=3D"CFLAGS=3D'-O0 -g3'" -j 20 && nextstep/Emacs.app/Contents/MacOS/Emacs -nw ``` I can confirm that my patch fixes the problem for me, but I am not confident that the issue is in the estimation cost. When I have line numbers enabled, I assume, the scrolling logic would always try to insert/delete/write lines. In my case it might be: - Writing (Is that writing on top of the current lines?) is cheaper. - Screen flickers because of the specific frequency of the terminal (or the way we flush the buffer). For example, we insert empty lines and then the screen is updated, only then we add content in there and redisplay again. Potentially, some redrawing might happen inside of `ins_del_lines`? Instead of redrawing the whole screen, we redraw it in the middle of modifying it? Those are just my assumptions from reading the code. I'd appreciate any help in debugging the issue. On Sat, Aug 27, 2022 at 9:14 AM Eli Zaretskii wrote: > > From: Dmitrii Kuragin > > Date: Sat, 27 Aug 2022 09:01:22 -0700 > > Cc: Gerd M=C3=B6llmann , > > 57434@debbugs.gnu.org > > > > I think I can give it a try. I just need a bit more time to set up the > debugger workflow, since I run GDM only once > > in a few years :) > > Thanks. > > > I also do not really understand the meaning of "cost" here and what > metrics we use to measure that. But, I'd > > assume it is something empirical. > > It's supposed to measure the cost of moving the text-terminal cursor > from one point on the screen to another. And yes, it's heuristics. > --=20 *If you get an email from me outside of the 9-5 it is *not* because I'm always on or expect an immediate response from you; it is because of work flexibility . Evening and weekend emails are a sign I allocated some regular working hours for other things (such as family, gym, friends,...). And I encourage you to feel free to do the same. --0000000000009421c105e761f174 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I am having difficulty running a debugger.

=
I tried gdb and signing, but it didn't work. I also tried lldb= , but it doesn't stop on a breakpoint for whatever reason.

=
I compiled with `-O0 -g3`, then
```
lldb
(lldb) file= nextstep/Emacs.app/Contents/MacOS/Emacs
Current executable set to '= /Users/kuragin/Desktop/emacs/nextstep/Emacs.app/Contents/MacOS/Emacs' (= x86_64).
(lldb) breakpoint set -f scroll.c -l 270
Breakpoint 1: where= =3D Emacs`do_scrolling + 485 at scroll.c:271:11, address =3D 0x00000001000= 32da5
```

But, it doesn't stop there...

and I run Emacs like this:
```
arch --x86_64 = make configure=3D"CFLAGS=3D'-O0 -g3'" -j 20 && ne= xtstep/Emacs.app/Contents/MacOS/Emacs -nw
```

I can confirm that my patch fixes the problem for me, but I am not co= nfident that the issue is in the estimation cost.=C2=A0

<= div class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-serif= ">When I have line numbers enabled, I assume, the scrolling logic would alw= ays try to insert/delete/write lines. In my case it might be:
=C2= =A0- Writing (Is that writing on top of the current lines?) is cheaper.
=C2=A0- Screen flickers because of the specific frequency of the termi= nal (or the way we flush the buffer).
=C2=A0 =C2=A0For example, we = insert empty lines and then the screen is updated, only then we add content= in there and redisplay again.

Potentially, some redra= wing might happen inside of `ins_del_lines`? Instead of redrawing the whole= screen, we redraw it in the middle of modifying it?

T= hose are just my assumptions from reading the code.

I&= #39;d appreciate any help in debugging the issue.

On Sat, Aug 27, 2022= at 9:14 AM Eli Zaretskii <eliz@gnu.org<= /a>> wrote:
&= gt; From: Dmitrii Kuragin <kuragin@google.com>
> Date: Sat, 27 Aug 2022 09:01:22 -0700
> Cc: Gerd M=C3=B6llmann <gerd.moellmann@gmail.com>,
>=C2=A0 =C2=A0 =C2=A0 =C2=A057434@debbugs.gnu.org
>
> I think I can give it a try. I just need a bit more time to set up the= debugger workflow, since I run GDM only once
> in a few years :)

Thanks.

> I also do not really understand the meaning of "cost" here a= nd what metrics we use to measure that. But, I'd
> assume it is something empirical.

It's supposed to measure the cost of moving the text-terminal cursor from one point on the screen to another.=C2=A0 And yes, it's heuristics= .


--
*If you get an email from me outside of the 9-5 it is=C2= =A0not=C2=A0because I'm always on or expect an immediate respons= e from you; it is because of=C2=A0<= a href=3D"http://www.inc.com/john-boitnott/how-flexible-hours-can-create-a-= better-work-life-balance.html" style=3D"color:rgb(17,85,204)" target=3D"_bl= ank">work flexibility.=C2=A0=C2=A0= Evening and weekend emails are a sign I allocated some regular working hour= s for other things (such as family, gym, friends,...).=C2=A0 And I encourag= e you to feel free to do the same.

--0000000000009421c105e761f174--