From patchwork Fri Jul 22 20:27:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alexander_F=2E_R=C3=B8dseth?= X-Patchwork-Id: 2070 Return-Path: Delivered-To: patchwork@archlinux.org Received: from mail.archlinux.org [95.216.189.61] by patchwork.archlinux.org with IMAP (fetchmail-6.4.30) for (single-drop); Fri, 22 Jul 2022 20:27:16 +0000 (UTC) Received: from mail.archlinux.org by mail.archlinux.org with LMTP id SIb3NCMI22LYtg0AK+/4rw (envelope-from ) for ; Fri, 22 Jul 2022 20:27:15 +0000 Received: from lists.archlinux.org (lists.archlinux.org [IPv6:2a01:4f9:c010:9eb4::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.archlinux.org (Postfix) with ESMTPS id 81AB3125E7BB; Fri, 22 Jul 2022 20:27:14 +0000 (UTC) Received: from lists.archlinux.org (localhost [IPv6:::1]) by lists.archlinux.org (Postfix) with ESMTP id 59B811227503; Fri, 22 Jul 2022 20:27:14 +0000 (UTC) X-Original-To: pacman-dev@lists.archlinux.org Delivered-To: pacman-dev@lists.archlinux.org Received: from mail.archlinux.org (mail.archlinux.org [IPv6:2a01:4f9:c010:3052::1]) by lists.archlinux.org (Postfix) with ESMTPS id 4207112274F5 for ; Fri, 22 Jul 2022 20:27:13 +0000 (UTC) From: =?utf-8?q?Alexander_F=2E_R=C3=B8dseth?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=archlinux.org; s=dkim-rsa; t=1658521633; 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=vJF2I32DxHQd1gE+vncMcLI1Rz4edllnw0TYKsDIcuo=; b=MqLLfjLPFYBVyvqO+Q8NpVn7jEfLOB7EiBlJU9dh51mARyGMHDIeNlhp2bkwmc2mfNJlYh 8mdZHDQv+ib36kEjJSdSCwBiHgeGo2CtjgBCeecBqcyKtbd56y5nFjRLCsR8LX/3PbOroF VCEAkmiYU5rOpS/MLZhRNTv6J9PxHIMiOxUfRnTihYiV9NSJLuSgnPqu1itwITrftRxRQ0 TRrx/OyrjckfpCxWf/SCr4BVxdrClcOCC1BQCLdfUoWIAydu/L3czBjsN2s8Zh9JmsEBz3 T7vB7tYkohlZqQgQ5EyrZZWTI5dsM3DUujiSMD2uL9lfZ/9lqG59nYOGdPQby19k7mIayy 3PxrIablwAkqk6aeal3j6wb3jpdaOkBb41qYuzBbMpuFjyRNYdlDoes3zRnx0lFdf+nbCT meMVDgNHvh3DDNDbqDXqtz7kbPCzA7LFf7wyqI5BrU3uuDlxV4veWO31lHTRCxLKpeZ8GX QKFaRHSrw2sERXhQ0XZ7po3zXzbWGMphBK6eeOWL0mAJhjViKbmGNRMfrHRVqLmzkd/a7y yG228GM6v4w5+oHAKRHf6PT0fmvSxHs//7ecQu5kFeJPdXV0apBOk80QvGo+UCOmgVYG+P RZHZ5yVne0sIYkuzEY+M7ZT6LeyLn0uob9q5TL4vtbY+253J8ZpQI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=archlinux.org; s=dkim-ed25519; t=1658521633; 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=vJF2I32DxHQd1gE+vncMcLI1Rz4edllnw0TYKsDIcuo=; b=IvQClf8WE1dXCjges1lDLLnw9y1pVNSEZCr3N4EIZY5WgqopqGzFbZmDoJ2eTV7XPIyN6d ehtnSuuVhUJcrNAQ== To: pacman-dev@lists.archlinux.org Cc: =?utf-8?q?Alexander_F=2E_R=C3=B8dseth?= Subject: [PATCH 2/2] pacman: let the progress bar "C"/"c" move up and down at a more regular rate Date: Fri, 22 Jul 2022 22:27:05 +0200 Message-Id: <20220722202705.67778-2-xyproto@archlinux.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220722202705.67778-1-xyproto@archlinux.org> References: <20220722202705.67778-1-xyproto@archlinux.org> MIME-Version: 1.0 X-BeenThere: pacman-dev@lists.archlinux.org X-Mailman-Version: 2.1.39 Precedence: list List-Id: Discussion list for pacman development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: pacman-dev-bounces@lists.archlinux.org Sender: "pacman-dev" X-Spamd-Result: default: False [-7.11 / 15.00]; REPLY(-4.00)[]; DWL_DNSWL_MED(-2.00)[archlinux.org:dkim]; MID_CONTAINS_FROM(1.00)[]; RCVD_DKIM_ARC_DNSWL_MED(-0.50)[]; DMARC_POLICY_ALLOW(-0.50)[archlinux.org,none]; RCVD_IN_DNSWL_MED(-0.40)[2a01:4f9:c010:9eb4::1:from,2a01:4f9:c010:3052::1:received]; R_DKIM_ALLOW(-0.20)[archlinux.org:s=dkim-rsa,archlinux.org:s=dkim-ed25519]; R_SPF_ALLOW(-0.20)[+ip6:2a01:4f9:c010:9eb4::1:c]; MAILLIST(-0.20)[mailman]; MIME_GOOD(-0.10)[text/plain]; HAS_LIST_UNSUB(-0.01)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:2a01:4f9::/32, country:DE]; RCVD_TLS_LAST(0.00)[]; ARC_NA(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[archlinux.org:+]; FROM_HAS_DN(0.00)[]; NEURAL_HAM(-0.00)[-1.000]; RCPT_COUNT_TWO(0.00)[2]; TO_DN_SOME(0.00)[]; FROM_NEQ_ENVFROM(0.00)[xyproto@archlinux.org,pacman-dev-bounces@lists.archlinux.org]; PREVIOUSLY_DELIVERED(0.00)[pacman-dev@lists.archlinux.org]; FORGED_SENDER_MAILLIST(0.00)[] X-Rspamd-Server: mail.archlinux.org X-Rspamd-Queue-Id: 81AB3125E7BB Authentication-Results: mail.archlinux.org; dkim=pass header.d=archlinux.org header.s=dkim-rsa header.b=MqLLfjLP; dkim=pass header.d=archlinux.org header.s=dkim-ed25519 header.b=IvQClf8W; dmarc=pass (policy=none) header.from=archlinux.org; spf=pass (mail.archlinux.org: domain of pacman-dev-bounces@lists.archlinux.org designates 2a01:4f9:c010:9eb4::1 as permitted sender) smtp.mailfrom=pacman-dev-bounces@lists.archlinux.org For some terminal widths, the "C"/"c" character does not alternate at regular intervals, but may look like it is stuck at either lowercase or uppercase. The previous behavior toggled based on the character position, while this new behavior toggles the chomp alternation based on the progress percentage value. This leads to slightly improved chomping. Signed-off-by: Alexander F. Rødseth --- src/pacman/callback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pacman/callback.c b/src/pacman/callback.c index df4032a4..aa6303bf 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -165,7 +165,7 @@ static void fill_progress(const int percent, const int proglen) if(i > hashlen - hash) { putchar('-'); } else if(i == hashlen - hash) { - if(i % 2 == 0) { + if(percent % 2 == 0) { fputs("\033[1;33mC\033[m", stdout); } else { fputs("\033[1;33mc\033[m", stdout);