Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4747828ybp; Mon, 14 Oct 2019 09:24:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/OE3Yrd5gNk9BTALNbvZMGSy1IWGCAawnKszMM/wZh8yAyfam5R33KQBHdhF2narRrBPe X-Received: by 2002:a50:da0f:: with SMTP id z15mr29109793edj.137.1571070246785; Mon, 14 Oct 2019 09:24:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571070246; cv=none; d=google.com; s=arc-20160816; b=vuRwKNjFHPdJnwyXZ60ZtBtzp+ikltHV0byeAIVup63zNWfxW8WGKj4NTDaNY+lXh2 HYe2Gdzt6sjmrojQ46CzDbYEFuzwMzzYkLiDoaTMZrOweXhjqKZuwSDgbNeJUqSYJdG8 gjA/V4gpSHxXF6sqJGkAgANtQbiPJNEz/k0LxKfqllh90m5jz8Vw51mk2oNKvPmFYavE f3kmnpaJgSabayiTl/SwFCJqj1fN7G4HSQ6l/zCDp9dthPRURxTUejB7xr1fHo7L4bKf 2cC8XI37Xr8gySANcNgWVaVe6iM1okkU8kUBPMC3OOsvs4xxWGQNYIAuTxVihs3L105B 4LPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1Av3ioNZKtn1IoIkmuPv2cbQ6HyfD+1rS28OweGIOdo=; b=OHZUCdjWYFuE3XWqieehZNt8lSW1RMeKB9j6MtpDBwGfYVx8HjRYuNNJudn7tAn/bC K1oVAfKbqmxjSt5Wn9NzQxjRt9U7gNTzbftX+DEsish5yS5Id9lPNV74ZhM9cGvlU92M WxtlMXTT9UkR+gxneml2Wn5TgjTt7SbZTsR2RKj1YzBK3RxYkAE9KGlmkVvRGzWxyezp Nf9uXwmpaRhaWGPn3r6880RZe0YJcdipoQMAxBF/i5GyVbpSBlw51UtvMOzuNjuuLPPy XjPPQizmPWveEAgJ+oNw+Lhpk+sM2WxeBWtu2/k9jlOao4GChZq4BB79WwiYBHeL+NjM FkYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YM1MA4Ug; 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 g18si11706995edq.209.2019.10.14.09.23.44; Mon, 14 Oct 2019 09:24:06 -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=YM1MA4Ug; 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 S2387810AbfJNPql (ORCPT + 99 others); Mon, 14 Oct 2019 11:46:41 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:38748 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387766AbfJNPqj (ORCPT ); Mon, 14 Oct 2019 11:46:39 -0400 Received: by mail-wr1-f66.google.com with SMTP id y18so10857155wrn.5 for ; Mon, 14 Oct 2019 08:46:37 -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 :mime-version:content-transfer-encoding; bh=1Av3ioNZKtn1IoIkmuPv2cbQ6HyfD+1rS28OweGIOdo=; b=YM1MA4Ug496qhJG5JvBKwtecmdfgxLvwt5inayWrP/lErf4KHykJ7C09zxlGL0sWGR 0BnL+DDPzZ1Ou6v+pY6BgmI+BkfA78ismkjLcC6D2QSxNMhAOLEdIMUDYx5gQLr652V1 uVl2mEp4TXv7sAqmay1F1z/HsX4N4Sr0bs6/d5bYPqBsaHPxgjSDzqufNnCbIUMpKGCp 1ElUPBkbaWpiV8m2jBrqZCkeNk+J4bHJvy0gNwI/KQy3DQ6D+mmqKgIr+F1qwg6I9LOK 9ddvnBHnmgIdnTjWTelfyj2NDxWX2akx+aLMXaYRmYL+10Vwxzpb0Y+5um9HeV4sSNYz hm/A== 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:mime-version:content-transfer-encoding; bh=1Av3ioNZKtn1IoIkmuPv2cbQ6HyfD+1rS28OweGIOdo=; b=H7ayTKVYqiieF0xQAOLqGKBq6h5OxEjPzaiI9TJcpR+KA2xDf2b1Ii4oCoIf73TzVe N0ORFgGzIsIiQBCrS6zM0/FAihWf2g3cN66SsWCfvKYj1OvQV7b2GKQ+SBXOvSAd5UUh +zvFD6Yo9qtrOnXHrXd/Y2Pe4AZcYCvXGjysIr9Ezck4NCVMZ11bc4RQ1dIIiZJxSsnG sVy+i4BUzTbcwqdbMXnLqaNirn/0mkzg5ZClYXHfOp1O90KGvNyIE20Nja0EwFMH0Y1d 5jnW48ol2+kS1cDC/sapWAd1UouLSdf2770X/EKrbIYtHp4LBB1XN8n3d9kYbuBOcY3T wvtQ== X-Gm-Message-State: APjAAAVKmgGZXbfit+FJnzXz3vGJoX2GZofqgMXoOejels4CizBU5wgb EJB4o2bLCTZ0Kka7MsaEQuJhvw== X-Received: by 2002:a5d:5271:: with SMTP id l17mr27011147wrc.19.1571067996855; Mon, 14 Oct 2019 08:46: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 q22sm16539738wmj.5.2019.10.14.08.46.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 08:46:36 -0700 (PDT) From: Daniel Thompson To: Jason Wessel , Douglas Anderson Cc: Daniel Thompson , kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, patches@linaro.org Subject: [PATCH v3 5/5] kdb: Tweak escape handling for vi users Date: Mon, 14 Oct 2019 16:46:26 +0100 Message-Id: <20191014154626.351-6-daniel.thompson@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191014154626.351-1-daniel.thompson@linaro.org> References: <20191014154626.351-1-daniel.thompson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 f9839566c7d6..5e71bb2596ed 100644 --- a/kernel/debug/kdb/kdb_io.c +++ b/kernel/debug/kdb/kdb_io.c @@ -161,8 +161,8 @@ char kdb_getchar(void) *pbuf++ = key; key = kdb_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 ? 1 : 0]; if (key > 0) return key; } -- 2.21.0