From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#57434: 28.1.91; Terminal Emacs Mac OS flickering. Date: Fri, 02 Sep 2022 10:26:45 +0300 Message-ID: <8335daqlsa.fsf@gnu.org> References: <83ler7vx3o.fsf@gnu.org> <838rn6x4h2.fsf@gnu.org> <834jxux3kd.fsf@gnu.org> <831qsyx2lr.fsf@gnu.org> <142be6aa-f25f-fad2-5597-6e02b0e3e4f6@gmail.com> <8335dcu0sg.fsf@gnu.org> <83mtbks7mo.fsf@gnu.org> <837d2mqm98.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6505"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 57434@debbugs.gnu.org To: gerd.moellmann@gmail.com, kuragin@google.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 02 09:27:17 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 1oU15B-0001Z4-8c for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 02 Sep 2022 09:27:17 +0200 Original-Received: from localhost ([::1]:39280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oU159-0005We-SP for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 02 Sep 2022 03:27:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51892) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oU14w-0005TR-Uu for bug-gnu-emacs@gnu.org; Fri, 02 Sep 2022 03:27:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54954) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oU14w-0000p9-LC for bug-gnu-emacs@gnu.org; Fri, 02 Sep 2022 03:27:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oU14w-0008JX-GY for bug-gnu-emacs@gnu.org; Fri, 02 Sep 2022 03:27:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 02 Sep 2022 07:27: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.166210358331904 (code B ref 57434); Fri, 02 Sep 2022 07:27:02 +0000 Original-Received: (at 57434) by debbugs.gnu.org; 2 Sep 2022 07:26:23 +0000 Original-Received: from localhost ([127.0.0.1]:44703 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oU14J-0008IW-2d for submit@debbugs.gnu.org; Fri, 02 Sep 2022 03:26:23 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:50532) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oU14H-0008IK-5Z for 57434@debbugs.gnu.org; Fri, 02 Sep 2022 03:26:21 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:53026) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oU14B-0000fC-SX; Fri, 02 Sep 2022 03:26:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=PB/tszbOvhd5o7rR326X+da/m45gnD/RBVyLbkJ+rpM=; b=dc0q5p43Ytc7 TQ7j8T9AMPemwyEzTQ64JSLbMwmjUswQ4IumQyj+oGdY4B43uZw1TM98p09tNDEk+42/AREZQyvYq 6RxJXmETQQj2fZVJlFCHu35sT4SveQVUwiaY0HehH3E4BlXaZRJI0Tpr7Sgu0HXI5hGtOnGoxRM02 nQpqZbrgpfI8sdr2HFndXZTE7pzG8/Mv/kGhchvVVWS++DzvpZ1ZIFWAH0SiWO3dL/Q4evdmbNt50 UE8RMV2B1iiUj8IwPtBHHLhsS7KpB6lFgCaIhuPIy4D+aMgZQh4jj2whXH7Lkck6yT70uj1xcT36/ 2Sw4IjwSf4ufRfUbZ4fvyw==; Original-Received: from [87.69.77.57] (port=1751 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oU14B-0001Wg-B3; Fri, 02 Sep 2022 03:26:15 -0400 In-Reply-To: <837d2mqm98.fsf@gnu.org> (message from Eli Zaretskii on Fri, 02 Sep 2022 10:16:35 +0300) 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:241294 Archived-At: > Cc: kuragin@google.com, 57434@debbugs.gnu.org > Date: Fri, 02 Sep 2022 10:16:35 +0300 > From: Eli Zaretskii > > A natural place to emit these is in, respectively, update_begin_hook > and update_end_hook. These two hooks are currently set to NULL (in > term.c) for TTY frames. So as a first try, I suggest to define these > hooks for TTY frames, and make them emit these two commands. If doing > so resolves the problem with flickering on alacritty, we can think how > to add that cleanly only for alacritty. Actually, I think we'll need one more small change. These hooks are called from update_begin and update_end like this: /* Update the display. */ if (FRAME_INITIAL_P (f)) /* No actual display to update so the "update" is a nop and obviously isn't interrupted by pending input. */ paused_p = false; else { update_begin (f); paused_p = update_frame_1 (f, force_p, inhibit_hairy_id_p, 1, false); update_end (f); } if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) { if (FRAME_TTY (f)->termscript) fflush (FRAME_TTY (f)->termscript); if (FRAME_TERMCAP_P (f)) fflush (FRAME_TTY (f)->output); } I think the fact that we call fflush (FRAME_TTY (f)->output) after update_end is a conceptual bug, which only goes unnoticed because update_end is a no-op on TTY frames. At least for the purpose of testing the above possible fix, the order should be reversed: we should fflush the terminal output _before_ we call update_end.