Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752642AbdC0Khu (ORCPT ); Mon, 27 Mar 2017 06:37:50 -0400 Received: from tartarus.angband.pl ([89.206.35.136]:57236 "EHLO tartarus.angband.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752305AbdC0Kh2 (ORCPT ); Mon, 27 Mar 2017 06:37:28 -0400 From: Adam Borowski To: Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org Cc: Adam Borowski Date: Mon, 27 Mar 2017 12:37:04 +0200 Message-Id: <20170327103704.22171-2-kilobyte@angband.pl> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170327103704.22171-1-kilobyte@angband.pl> References: <20170327103517.tlvzfuobtjxk2vci@angband.pl> <20170327103704.22171-1-kilobyte@angband.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2001:6a0:118::6 X-SA-Exim-Mail-From: kilobyte@angband.pl Subject: [PATCH 2/2] vt: make mouse selection of non-ASCII consistent X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on tartarus.angband.pl) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1939 Lines: 60 For some reason a handful of ISO-8859-1 symbols are excluded from "word chars" while the vast majority of Unicode is hard-coded as included, even when inappropriate (we really would want to _not_ select line-drawing/etc). Those symbols are: ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿×÷ Thus, let's not special-case any non-ASCII anymore. Attempts to set these via ioctl will be silently ignored. As an extra bonus, we debloat the kernel by 128 bytes. Signed-off-by: Adam Borowski --- drivers/tty/vt/selection.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c index 2252e11d8347..c81c99165ea6 100644 --- a/drivers/tty/vt/selection.c +++ b/drivers/tty/vt/selection.c @@ -80,21 +80,17 @@ void clear_selection(void) /* * User settable table: what characters are to be considered alphabetic? - * 256 bits. Locked by the console lock. + * 128 bits. Locked by the console lock. */ -static u32 inwordLut[8]={ +static u32 inwordLut[4]={ 0x00000000, /* control chars */ 0x03FFE000, /* digits and "-./" */ 0x87FFFFFE, /* uppercase and '_' */ 0x07FFFFFE, /* lowercase */ - 0x00000000, - 0x00000000, - 0xFF7FFFFF, /* latin-1 accented letters, not multiplication sign */ - 0xFF7FFFFF /* latin-1 accented letters, not division sign */ }; static inline int inword(const u16 c) { - return c > 0xff || (( inwordLut[c>>5] >> (c & 0x1F) ) & 1); + return c > 0x7f || (( inwordLut[c>>5] >> (c & 0x1F) ) & 1); } /** @@ -106,10 +102,10 @@ static inline int inword(const u16 c) { */ int sel_loadlut(char __user *p) { - u32 tmplut[8]; - if (copy_from_user(tmplut, (u32 __user *)(p+4), 32)) + u32 tmplut[4]; + if (copy_from_user(tmplut, (u32 __user *)(p+4), 16)) return -EFAULT; - memcpy(inwordLut, tmplut, 32); + memcpy(inwordLut, tmplut, 16); return 0; } -- 2.11.0