From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673000781; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kN+TGSrhUsQB6Jmk1CbxK2TEbZTQtMX16sxb/eKGfhc=; b=fbeUqk80UA2gvOrVpsyxhOT02Gh4WC3p1uCPZr3i+HVRS4pjxS14SFeNRHwhTd5hxSZPR3 qDrTaH3CYCSbZIwINUkiKrbJPfrBCYxwzXKT3goAjDvtn4CrmZq3YfWQ/fxQQSfjpea9Sa KgPevxEB0cfcSCg2XVnSHXZnPvdayZQ= 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) From: Andrew Burgess 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 List-Id: 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 () -- 2.25.4