From patchwork Fri Jan 6 10:25:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 62787 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3CC9038708F5 for ; Fri, 6 Jan 2023 10:27:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3CC9038708F5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673000857; bh=kN+TGSrhUsQB6Jmk1CbxK2TEbZTQtMX16sxb/eKGfhc=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=KczD+bjjr+0MoT6Zl9eXLt5vwoRCUmRdukUgsVkBPFllCb+3CPvhSoasVkcG2qS87 LbVknKQon7+mcyCRtdSsnwYUZPCza8G4oliGmTRDyZrDnecQQva4iEVCP86hl1EMxL jEmhzvmm3WXh5WmjowUEzfekWcefqo+9jPEEhsTM= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id B9E88385B516 for ; Fri, 6 Jan 2023 10:26:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B9E88385B516 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-470-Ie8Z_CLwPhefej1Y4moCTw-1; Fri, 06 Jan 2023 05:26:19 -0500 X-MC-Unique: Ie8Z_CLwPhefej1Y4moCTw-1 Received: by mail-ej1-f71.google.com with SMTP id xh12-20020a170906da8c00b007413144e87fso869620ejb.14 for ; Fri, 06 Jan 2023 02:26:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kN+TGSrhUsQB6Jmk1CbxK2TEbZTQtMX16sxb/eKGfhc=; b=pkUkLZfRycCr67N1O58uhexNzsJ/sygL0wqWx5kcUlyqZXFfnkxDmtmRK6Xn7TC5OE REwDV8i4BTbkZVXOgwQS2Vb1qdsqec59WOm+tLyJh/hAyzd30ZoclQElPtE4IH6w0lYt iUffyeyTZK0PgAIPsb5VD1X237NqPsyXC9g5RC8QIPsI1XI+pSHk53OV2Z/il58xqIgk DUA9/k7sxH39ZIYvl3g87FdbL1U7jMSuFwJNZ+7I8bf/eUWhkmsmgK3L5vQAS2fBWkwj 2LQbXZ+Ey7gZ+X4RgG9G5HMdh70EnB8izBPuQKQlQQdMYR3XWP7eiGbszAO315krTSXe Mu4A== X-Gm-Message-State: AFqh2ko5fLFc9RourWS5Gm0xPLlBiCmtrnLW4RMxMn8C9/Q0ktOMAPHX /QwYnR1+XKPLeEp247Ebnt63r8zXm/gaR0AvaLL0kW5Oxz5o13J+0N8010XFwCfYpeggMokw5A8 yBlxXIwl+O60c7LPRTgo15aISPjcARfMlvEefegRCBKdQ/FS67QVZbPQYRbuy+1QVrpRKbpBVHA == X-Received: by 2002:a05:6402:2b93:b0:47e:5b70:de79 with SMTP id fj19-20020a0564022b9300b0047e5b70de79mr48779122edb.17.1673000778673; Fri, 06 Jan 2023 02:26:18 -0800 (PST) X-Google-Smtp-Source: AMrXdXtucJVjde6eWM7yNjMi1CtdjSaAyhSBNd9FE5BMDxGOtszr9Cn14Z+Fq9AJX+yDv2CVM0/wng== X-Received: by 2002:a05:6402:2b93:b0:47e:5b70:de79 with SMTP id fj19-20020a0564022b9300b0047e5b70de79mr48779105edb.17.1673000778410; Fri, 06 Jan 2023 02:26:18 -0800 (PST) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id c24-20020aa7c998000000b004589da5e5cesm355555edt.41.2023.01.06.02.26.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Jan 2023 02:26:18 -0800 (PST) To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 12/15] gdb/tui: avoid extra refresh_window on horizontal scroll Date: Fri, 6 Jan 2023 10:25:39 +0000 Message-Id: X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Andrew Burgess via Gdb-patches From: Andrew Burgess Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" While working on the previous patches I noticed that in some cases I was seeing two calls to tui_source_window_base::refresh_window when scrolling the window horizontally. The two calls would trigger in for the tui-disasm-long-lines.exp test when the pad needed to be refilled. The two called both come from tui_source_window_base::show_source_content. The first call is nested within check_and_display_highlight_if_needed, while the second call is done directly at the end of show_source_content. The check_and_display_highlight_if_needed is being used to draw the window box to the window, this is needed here because show_source_content is what gets called when the window needs updating, e.g. after a resize. We could potentially do the boxing in refresh_window, but then we'd be doing it each time we scroll, even though the box doesn't need changing in this case. However, we can move the check_and_display_highlight_if_needed to be the last thing done in show_source_content, this means that we can rely on the refresh_window call within it to be our single refresh call. There should be no user visible changes after this commit. --- gdb/tui/tui-winsource.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index 6e22638ec74..50efa80576f 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -348,8 +348,6 @@ tui_source_window_base::show_source_content () { gdb_assert (!m_content.empty ()); - check_and_display_highlight_if_needed (); - /* The pad should be at least as wide as the window, but ideally, as wide as the content, however, for some very wide content this might not be possible. */ @@ -399,7 +397,11 @@ tui_source_window_base::show_source_content () for (int lineno = 0; lineno < m_content.size (); lineno++) show_source_line (lineno); - refresh_window (); + /* Calling check_and_display_highlight_if_needed will call refresh_window + (so long as the current window can be boxed), which will ensure that + the newly loaded window content is copied to the screen. */ + gdb_assert (can_box ()); + check_and_display_highlight_if_needed (); } tui_source_window_base::tui_source_window_base ()