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:38:48 -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="00000000000067a9fe05e76239a5" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13556"; 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:40:13 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 1oSfvv-0003KW-Lq for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 29 Aug 2022 16:40:11 +0200 Original-Received: from localhost ([::1]:40824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSfvu-0001NS-Ox for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 29 Aug 2022 10:40:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39860) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSfvn-0001Mv-8g for bug-gnu-emacs@gnu.org; Mon, 29 Aug 2022 10:40:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43603) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oSfvm-0002ZL-VF for bug-gnu-emacs@gnu.org; Mon, 29 Aug 2022 10:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oSfvm-0002LN-6Y for bug-gnu-emacs@gnu.org; Mon, 29 Aug 2022 10:40:02 -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:40:02 +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.16617839488946 (code B ref 57434); Mon, 29 Aug 2022 14:40:02 +0000 Original-Received: (at 57434) by debbugs.gnu.org; 29 Aug 2022 14:39:08 +0000 Original-Received: from localhost ([127.0.0.1]:33350 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oSfut-0002KD-BV for submit@debbugs.gnu.org; Mon, 29 Aug 2022 10:39:07 -0400 Original-Received: from mail-yw1-f178.google.com ([209.85.128.178]:36700) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oSfur-0002Ji-1Z for 57434@debbugs.gnu.org; Mon, 29 Aug 2022 10:39:05 -0400 Original-Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-33dc345ad78so200787697b3.3 for <57434@debbugs.gnu.org>; Mon, 29 Aug 2022 07:39:05 -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=a3w0fgCGtQJNKSx5xtSwivTwk6wYdxcg4ohAvxlQDQw=; b=O5Rv76UsPOEj8hPrDvX9KCOAiIv+reud4m5a7aQhsZXGEgw0lXcaW0hRC8zzes0GIc ExJbDTOekzuaOYz/CYzsEIEXfspKvLDAnJv6smQWlq1t2Mw+kBMPUByaD/G2dc1jXExE LgcAoIYIq+C+mB1b0/eJK+QJkhr1xQsvXyj3am6loJWhpH7hFiKrSxbI8AlNyosqosl+ k1Zgdftsh26O7xgkFN2N7GRxvzP3KZJdZI+q3r9V8iuAWkZE+Etl/TqAElIJhuNk+xwU LDZCTit3HPgO3fquWBR+XcjjZZa4t2bbkK8tD/TJ/368d2D6NyyS2FdwxPwfAbay5tcw 9PBQ== 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=a3w0fgCGtQJNKSx5xtSwivTwk6wYdxcg4ohAvxlQDQw=; b=z9RgZg1yNIbYN/Ngwc2g81zC3IEfOaD1S/7bsygC7koTyuEOq7YWUXY/+ozITx04b/ 65ak92BD0VrCzsr31wbkHHrdm6KUKfX4PgfGoIkVufoaa3yfk8HA0NRaVk1K3ikXFCiw u/GFoqkiSfj4HGeJoHy9gF0T5GTF0WaaWnfyebRaAHWAu2qSHr/Dop0hqy/mwX0Nmp7B WMIX6GQjkkDlZ1/JEhVARAWjWUpZaxCL9M/fetESDaZWwW8ZR+yKG0IXhLEbrMKzS4Ig 2CcknGcdMtJsyn1jmoHMGi/kX+Y3eG66MolhsUqsgNkiu0sA0TfrrSn7vpj6QCF80P35 DfVA== X-Gm-Message-State: ACgBeo386woNSfdJBC1cglLyTVCszLperexWdvFe0xF0BsiGJyU2gFX3 aVSWAIFeNbjBLA5lbY5NNkohuMfXI97LojAdv2Qmyw== X-Google-Smtp-Source: AA6agR7aD9kOCpCbnvrAG46PmHzay2ynlJYdV0mHaNdC91yEBsRwgqtZ86uzy629Ittwhm66j9SavwZqPGU1323VhTE= X-Received: by 2002:a0d:c681:0:b0:33c:2e21:4756 with SMTP id i123-20020a0dc681000000b0033c2e214756mr9921157ywd.467.1661783939426; Mon, 29 Aug 2022 07:38:59 -0700 (PDT) In-Reply-To: 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:241029 Archived-At: --00000000000067a9fe05e76239a5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I also tried vim in the similar configuration (display line numbers, 2 splits, etc). I understand that it is unreasonable to compare 2 different things, but it doesn't show any flickering issues there. Do we actually need to redraw the whole line if we use relative numbers or we can just redraw the portion with line numbers? On Mon, Aug 29, 2022 at 7:18 AM Dmitrii Kuragin wrote: > 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, addr= ess > =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, onl= y > 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. >> > > > -- > *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 encoura= ge > you to feel free to do the same. > > --=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. --00000000000067a9fe05e76239a5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I also tried vim in the similar configuration=C2=A0(dis= play line numbers, 2 splits, etc).

I understand that = it is unreasonable to compare 2 different things, but it doesn't show a= ny flickering issues there.

Do we actually need to red= raw the whole line if we use relative numbers or we can just redraw the por= tion with line numbers?

On Mon, Aug 29, 2022 at 7:18 AM Dmitrii Kurag= in <kuragin@google.com> wro= te:
I am having difficulty running a debugger.

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

I c= ompiled with `-O0 -g3`, then
```
lldb
(lldb) file nextstep/Em= acs.app/Contents/MacOS/Emacs
Current executable set to '/Users/kurag= in/Desktop/emacs/nextstep/Emacs.app/Contents/MacOS/Emacs' (x86_64).
= (lldb) breakpoint set -f scroll.c -l 270
Breakpoint 1: where =3D Emacs`d= o_scrolling + 485 at scroll.c:271:11, address =3D 0x0000000100032da5
```=

But, it doesn't stop there...

<= div class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-serif= ">and I run Emacs like this:
```
arch --x86_64 make configu= re=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.=C2=A0

When I hav= e line numbers enabled, I assume, the scrolling logic would always try to i= nsert/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 terminal (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 an= d redisplay again.

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

Those are jus= t my assumptions from reading the code.

I'd apprec= iate any help in debugging the issue.

On Sat, Aug 27, 2022 at 9:14 AM = Eli Zaretskii <eliz@gn= u.org> wrote:
> 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 yo= u get an email from me outside of the 9-5 it is=C2=A0not=C2=A0becaus= e I'm always on or expect an immediate response from you; it is because= of=C2=A0work flexibility.=C2= =A0=C2=A0Evening and weekend emails= are a sign I allocated some regular working hours for other things (such a= s family, gym, friends,...).=C2=A0 And I encourage you to feel free to do t= he same.



--
*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.

--00000000000067a9fe05e76239a5--