On my remote linux machine `line_is_del_ok` should be false where
```
  tty->line_ins_del_ok
    = (((tty->TS_ins_line || tty->TS_ins_multi_lines)
        && (tty->TS_del_line || tty->TS_del_multi_lines))
       || (tty->scroll_region_ok
           && tty->TS_fwd_scroll && tty->TS_rev_scroll));
```
because `tput al` and `tput AL` are both false and `tput sr` and `tput sf` are false ("unknown terminfo capability"). 

So, disabling `line_ins_del_ok` on mac os would lead to the same configuration I have on the linux. On the linux machine scroll never caused any troubles.

So, would it be ok to disable `line_ins_del_ok` for Mac OS? I would send a patch if it's OK.

On Mon, Aug 29, 2022 at 1:25 PM Dmitrii Kuragin <kuragin@google.com> wrote:
So far:
```
:~/Desktop% tput al; echo $?
0
:~/Desktop% tput AL; echo $?
1%dL0
:~/Desktop% tput dl; echo $?
0
:~/Desktop% tput DL; echo $?
1%dM0
:~/Desktop% tput sf; echo $?

0
0~/Desktop% tput sr; echo $?
:~/Desktop% tput wi; echo $?
tput: unknown terminfo capability 'wi'
4
:~/Desktop% tput cs; echo $?
%p1%d;%p2%dr0
:~/Desktop% tput cS; echo $?
tput: unknown terminfo capability 'cS'
4
```

Seems like Mac Os doesn't support "wi", but the condition is still going to be true.

```
tty->line_ins_del_ok = 0;
```

make the emacs really smooth w/o any flickering.

On Mon, Aug 29, 2022 at 12:37 PM Eli Zaretskii <eliz@gnu.org> wrote:
> From: Dmitrii Kuragin <kuragin@google.com>
> Date: Mon, 29 Aug 2022 12:26:07 -0700
> Cc: Gerd Möllmann <gerd.moellmann@gmail.com>,
>       57434@debbugs.gnu.org
>
> I tried different terminal emulators, Alacritty, iTerm2, Terminal.app (stock). All of them show the same issue.
> So, it is not a terminal emulator.

If this happens with all terminal emulators on macOS, we should reset
the line_ins_del_ok flag for macOS.  Look in term.c, where it is
initialized by consulting various terminfo features supported by the
terminal.  If all the features it consults indeed work on macOS, then
simply say something like

  #ifdef DARWIN_OS
    tty->line_ins_del_ok = 0;
  #else
  ... the current code...
  #endif

and see if the problem goes away.

Gerd, do you see the same on your system?


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



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