From patchwork Tue Jun 18 16:00:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 805265 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:144:b0:362:4979:7f74 with SMTP id r4csp275938wrx; Tue, 18 Jun 2024 09:11:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVO86TS6U+o4A3g02cvBcFwR1Lp5UUy0MjP707PsXe6952W3CEEQk1mq0V3OIoV6Y4//6gVcSnw/pJQao9JPfbM X-Google-Smtp-Source: AGHT+IEbs8obiVl432nCVrZB9pV2G8HH1+tPtale70lJjrVoc2PPpdG6idlvK56fvuZ+s+7mnwwx X-Received: by 2002:a0c:da85:0:b0:6ae:e4f7:6c5f with SMTP id 6a1803df08f44-6b501eb4a00mr1798136d6.52.1718727076386; Tue, 18 Jun 2024 09:11:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718727076; cv=none; d=google.com; s=arc-20160816; b=s/rzUZiG/8rzpvkmIDKh626W3khg/fP6ZvblBa17xq/Y6YH3vfI+Ei8LK/w9FCjDT8 /OVyiCK1W48btOTKtToLusdAKjXXpZaD3VmenjqUot6vIIFgPaJJ8JvuxOdRmFnfuser geWCYvVxQ9RAyU9LIvtkDNxDX8Cz2VVXinAc4vfba1dw5dLbn2ElXO+muyoq52LhbA0Y MwzjB987glDKy9fC1agMefEnV+CMDS8Lq54pwm9Q51mVez6WHbvL9hNcK9obnBssOp56 ymF8Bkcg+cckVf+Vz9qmvQfpZmhb6y8V9rBIbqqrgG3KBO2HPDBNHiIaRxV1HTQOaZlV DXIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PS+Ds4Sxagrc7IIxNg9ZZud7Od1JFilSTGGm4uz6pIM=; fh=pZcG4NSfKQ5SN0gxGz7Y/cXigufyIVK6IJCS2EFEHg8=; b=U1LAsIw+JH7tbiqxnNL4/ibFpSMuutV2No8cUAB2GxeQVdcWCI3MqFUS7w6OvRJBat bZ1aFN0bZPN9W5R/+VPeC8tqQXU19w/UsWPUddm8/laQaFBUA48J9Vnw2cgTe2ehBN3H uWD08fwBchF0PDNeedMLgB8VHzWs2UEyzYitR4YA+kl4Pu8e7iUQfzXwDg8i6lYl121Q kVlezNgh6Ivdp8LUj+FUliVa7Y12wBttxRbEzjc/gI04EeBvScTIqJdgaMy+hywZJ9Pz HVFqDG/u1ZrIKtp8IwiPAO931ysDNAabpIanu3AqTrE6wywd+FdaSf7s8W9G3BuhIBZW 1Lyg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VFY+lOI7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6b2a5a1764bsi128696576d6.72.2024.06.18.09.11.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Jun 2024 09:11:16 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VFY+lOI7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sJbN0-0004Gu-VG; Tue, 18 Jun 2024 12:07:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sJbMl-0003kl-Sm for qemu-devel@nongnu.org; Tue, 18 Jun 2024 12:07:31 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sJbMk-0007x9-0z for qemu-devel@nongnu.org; Tue, 18 Jun 2024 12:07:27 -0400 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-35f27eed98aso4572035f8f.2 for ; Tue, 18 Jun 2024 09:07:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718726844; x=1719331644; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PS+Ds4Sxagrc7IIxNg9ZZud7Od1JFilSTGGm4uz6pIM=; b=VFY+lOI7zzf0/XZQybqtM3JpQ6DtCRlgf2AOnKK+kfgWfajTzrVDA/joRvWpOYpknX 1/w65l8As+IbXLEqrsvUQh99BEvNT4MblfyxXTDgYt8goYR1oslGMxNrPd1oG/m+ePkZ JzhKM11nJK+X0ecSI4rP37RZ4wY1EAlAsjGrwVIlMAutWwjC+EKixlBzz8ZVZduOKYRJ 9UDHladWGcPYO6EbNToEAYGVWRKRupEF0zYj9VtFdGR1CcPFqYWTUeFwIeaAqqNKYZBC tEZICAlwazTidHgeMipXD1r7YoffjT9xz5cLUGq9TmtFXGNVqp5lPAPyNgb+/jOMDkwW +DRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718726844; x=1719331644; 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=PS+Ds4Sxagrc7IIxNg9ZZud7Od1JFilSTGGm4uz6pIM=; b=XSQKh5KeXCXsEw+DA2UehkpuYM2LrOkn1p+73rjD+ZN2vyvOispT5o18SACp7OSWrM MwOCZjbG4x/QgP+yMMtVsJT63UbvgMrLx4BB1duiesBDzIN/K1zIF9HfXyREyh3bu06M zxqpSD+zQ2bXPE28piyIpbyfITbVkK3JUBXQdruUMkSEyxOUJJTUySggzrG840bvQ+ix 4c0h3gq6WNYmlLLgKeFhguwifclXfmY6jxLkSEjPblC8kHqrIVqlXOyZfRhjwrQ1ETb9 qaLNqCDW471LqnwSmPfA6Rv/R3LdN97xuJsEu0k5fJW7yiDd1dlDGf4Ngmat+oshQgeo xURw== X-Gm-Message-State: AOJu0YwPMsd2BDLfSTm6I7quVJCaHUVUu9vVQYuTh46g4KtEAeBZeaCx aTf4z3fYKwzg//UiKt6DB1UYxDiy3WqgUwr0e1mTDgUS6zp5RdeB5odtS+Vdc3fGuWzEYOOgcvd 7 X-Received: by 2002:adf:9789:0:b0:361:d3ec:1031 with SMTP id ffacd0b85a97d-36317b7d4e1mr28270f8f.31.1718726844276; Tue, 18 Jun 2024 09:07:24 -0700 (PDT) Received: from m1x-phil.lan ([176.187.212.55]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3607509c9a0sm14398446f8f.27.2024.06.18.09.07.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 18 Jun 2024 09:07:23 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Manos Pitsidianakis , =?utf-8?q?Marc-And?= =?utf-8?q?r=C3=A9_Lureau?= , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= Subject: [PULL 70/76] util/readline: Add C-u shortcut Date: Tue, 18 Jun 2024 18:00:32 +0200 Message-ID: <20240618160039.36108-71-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240618160039.36108-1-philmd@linaro.org> References: <20240618160039.36108-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=philmd@linaro.org; helo=mail-wr1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Manos Pitsidianakis Add support for the unix-line-discard readline action, which erases from the cursor position up to the beginning of the line. The default binding, C-u, was chosen. This is useful to quickly erase command input while working on the monitor interface. Signed-off-by: Manos Pitsidianakis Reviewed-by: Marc-André Lureau Message-ID: <6772067e1c0d4b1c5310e5446e9e3e1c6b3b5bc0.1718265822.git.manos.pitsidianakis@linaro.org> Signed-off-by: Philippe Mathieu-Daudé --- util/readline.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/util/readline.c b/util/readline.c index 0b627d62ad..0f19674f52 100644 --- a/util/readline.c +++ b/util/readline.c @@ -271,6 +271,14 @@ static void readline_hist_add(ReadLineState *rs, const char *cmdline) rs->hist_entry = -1; } +static void readline_kill_line(ReadLineState *rs) +{ + while (rs->cmd_buf_index > 0) { + readline_backward_char(rs); + readline_delete_char(rs); + } +} + /* completion support */ void readline_add_completion(ReadLineState *rs, const char *str) @@ -426,6 +434,10 @@ void readline_handle_byte(ReadLineState *rs, int ch) /* ^P Prev line in history */ readline_up_char(rs); break; + case 21: + /* ^U Kill backward from point to the beginning of the line. */ + readline_kill_line(rs); + break; case 23: /* ^W */ readline_backword(rs);