Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp805199imm; Fri, 31 Aug 2018 13:54:08 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZPjoR1MRWz2wlyO+Q+rkMtDv0WkL17WWa52GrY3qpXSOR8Rc5uNGOk6WndJwnUAt7MM9Qh X-Received: by 2002:a62:1391:: with SMTP id 17-v6mr17555066pft.34.1535748848686; Fri, 31 Aug 2018 13:54:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535748848; cv=none; d=google.com; s=arc-20160816; b=ZPNf+BA6HDfh9KUd7jvN5Rtlh7U5K+yGSMWrT5gex7qR+86W7Rzc0X1j4YnMi7iw6z q3LefUVebIbs9sLhdiTB7ymLGo6Mw/1hVLhHadKtsh5tG20pF7N7Fu9XquU6B2r/iOOy bmoLRx54QRRutwjyoAYriYPPXUJSk4PvVLNvRyee1bsPCnmU9bMiT1w3kVnp5lXTw/Go 0a4QWSQVH+Fjg54nQ/bwlB6VQ0qkhICe2/zVcr15iep0saET9Af+vDLlrl1nKX6ZA11v ifda7FshJ+q+z9G05t1o0L1DxV2e7z9aeQZb+2kmmxzlovAcFpd0ygNAy5EZT5ly/5QR 4ARw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=LFaXeC2Evd+DuiB5BQjy+jnfA9tN+/uH8Nu3cT+zAnw=; b=blftwOfkamOzqHIx0CAJU0uw8Mj3OMAg55ta7dKX5zqcJ1ykt3l9Vmd2EpDZReejCV h7jRJNkfuCMXNAh00dPX5we/H0TzBkx36EMRYcF8ugTUT6HkpdfFzpyVksxmuMjwCh3r KTbkJyMQ8T9Ek9OAAJzUdfSQSYgm59d1wtvpPaS7qTW5sfUOPxVrdsTfgCShcmUZN9Qx HCafUOtNXONr3uGl4mBLpdpCZwuovIdgvmO81s/OT/z6A7H+bBtZfStkVKIz/y1CSkRx 56WqM8XhH9tOJTjl/H4tg/moPzUjPQZz0E246wuoMwzwGrqSIWFliag4JSXJSMKbJusj BDmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UWAhmCQg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 87-v6si11543443pfi.60.2018.08.31.13.53.54; Fri, 31 Aug 2018 13:54:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UWAhmCQg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727821AbeIABBu (ORCPT + 99 others); Fri, 31 Aug 2018 21:01:50 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:41699 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726869AbeIABBu (ORCPT ); Fri, 31 Aug 2018 21:01:50 -0400 Received: by mail-wr1-f67.google.com with SMTP id z96-v6so12328313wrb.8 for ; Fri, 31 Aug 2018 13:52:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LFaXeC2Evd+DuiB5BQjy+jnfA9tN+/uH8Nu3cT+zAnw=; b=UWAhmCQgMm/puX4vhN8WFvN8sLKez0w4aDfF1gQeVxVXxl/pbuZ25gNl4oGBKWfa8g o3as7YkCKXgtPdGsut7Ym5b675w8f8MjhecIrEeFJ88zH66zSzSXlRUHYM+79Vup4ERs Z3z5bWDdh9hflFp6HMc9R3Vu1qbOQX5S7SnM8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LFaXeC2Evd+DuiB5BQjy+jnfA9tN+/uH8Nu3cT+zAnw=; b=ZlsEg0ndGIfXuDZ5GmcL+CdY4x/lstUaFYoIRv8LlRwzVHXvrIDtrHokeSl2j+jaHA zjJ9rfMCsu0RCLgkT4GlTIRNIJB2V3N8QQWq7wcectVQpnWKOe72TDaN/+Sjd9gzK/tQ UUD2pXpvXBqWC3pyQXDbEPz72EuydmDsLG0YgkOnJDSUIpQhfebTg2nGilqo+GLKErkv sr/uWFJbBGHu3aMtjTbSUeN7Q7lNzSrxS6Rk1DMuGLMRq5kKC3L967POfriXrGb9k3n+ XOHNCCWVZ9Vmit4BfUDA2jO4zWcmK23hrhMEnctWk4yBUpJImxUj7ujMlmN+vh3q1WKN vtzg== X-Gm-Message-State: APzg51BbKDSVI4R0MC2BvaDDjfyL9K3FQIVUNuXLLNBg/D2fa1jgAUPV XQLFAfVKXJndDyx7w+ypKar5Tw== X-Received: by 2002:adf:9c12:: with SMTP id f18-v6mr12578275wrc.93.1535748756069; Fri, 31 Aug 2018 13:52:36 -0700 (PDT) Received: from wychelm.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.gmail.com with ESMTPSA id u4-v6sm7659356wro.47.2018.08.31.13.52.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 31 Aug 2018 13:52:35 -0700 (PDT) From: Daniel Thompson To: Jason Wessel Cc: Daniel Thompson , kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, patches@linaro.org Subject: [PATCH 5/5] kdb: Tweak escape handling for vi users Date: Fri, 31 Aug 2018 21:51:42 +0100 Message-Id: <20180831205142.23609-6-daniel.thompson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180831205142.23609-1-daniel.thompson@linaro.org> References: <20180831205142.23609-1-daniel.thompson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently if sequences such as "\ehelp\r" are delivered to the console then the h gets eaten by the escape handling code. Since pressing escape becomes something of a nervous twitch for vi users (and that escape doesn't have much effect at a shell prompt) it is more helpful to emit the 'h' than the '\e'. We don't simply choose to emit the final character for all escape sequences since that will do odd things for unsupported escape sequences (in other words we retain the existing behaviour once we see '\e['). Signed-off-by: Daniel Thompson --- kernel/debug/kdb/kdb_io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c index 8f2470016250..6ee8f812d656 100644 --- a/kernel/debug/kdb/kdb_io.c +++ b/kernel/debug/kdb/kdb_io.c @@ -154,8 +154,8 @@ static int kdb_getchar(void) *pbuf++ = key; key = kdb_read_handle_escape(buf, pbuf - buf); - if (key < 0) /* no escape sequence; return first character */ - return buf[0]; + if (key < 0) /* no escape sequence; return best character */ + return buf[pbuf - buf != 2 ? 0 : 1]; if (key > 0) return key; } -- 2.17.1