From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway32.websitewelcome.com (gateway32.websitewelcome.com [192.185.145.113]) by sourceware.org (Postfix) with ESMTPS id C4C09383F85F for ; Sat, 27 Jun 2020 21:20:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C4C09383F85F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tom@tromey.com Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway32.websitewelcome.com (Postfix) with ESMTP id 65E60E339 for ; Sat, 27 Jun 2020 16:20:55 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id pIFrjDaPIXGIkpIFrjfciz; Sat, 27 Jun 2020 16:20:55 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=+xNoMQ/c0Qmy06NLSpC1G3WKhj/nHPFzocPX1SuG/c4=; b=ENsdhYjF52RvxsAkjME5dsoV71 ewOp9O2vHErK/iRKVzMcTB+s390Una4kVN+TJsiLrbD9D3CaygucydSjSBvMP8hXSTHyHYcn2eIYe /uNyR5xOMMCYE18M6uvslc7qX; Received: from 174-16-104-48.hlrn.qwest.net ([174.16.104.48]:39790 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1jpIFr-000Ue3-63; Sat, 27 Jun 2020 15:20:55 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 5/6] Use ISCNTRL in tui_copy_source_line Date: Sat, 27 Jun 2020 15:20:50 -0600 Message-Id: <20200627212051.6155-6-tom@tromey.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20200627212051.6155-1-tom@tromey.com> References: <20200627212051.6155-1-tom@tromey.com> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 174.16.104.48 X-Source-L: No X-Exim-ID: 1jpIFr-000Ue3-63 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 174-16-104-48.hlrn.qwest.net (bapiya.Home) [174.16.104.48]:39790 X-Source-Auth: tom+tromey.com X-Email-Count: 6 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3035.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_ABUSEAT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, RCVD_IN_SBL_CSS, SPF_HELO_PASS, SPF_NEUTRAL, TXREP, URIBL_CSS, URIBL_CSS_A autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jun 2020 21:20:57 -0000 This changes tui_copy_source_line to use ISCNTRL. This lets it work more nicely with UTF-8 input. Note that this still won't work for stateful multi-byte encodings; for that much more work would be required. However, I think this patch does not make gdb any worse in this scenario. gdb/ChangeLog 2020-06-27 Tom Tromey PR tui/25342: * tui/tui-winsource.c (tui_copy_source_line): Use ISNCTRL. --- gdb/ChangeLog | 5 +++++ gdb/tui/tui-winsource.c | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index 2300b9ab1e9..30b8f69027a 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -28,6 +28,7 @@ #include "source.h" #include "objfiles.h" #include "filenames.h" +#include "safe-ctype.h" #include "tui/tui.h" #include "tui/tui-data.h" @@ -107,7 +108,9 @@ tui_copy_source_line (const char **ptr, int *length) { /* Nothing. */ } - else if (c < 040 && c != '\t') + else if (c == '\t') + process_tab (); + else if (ISCNTRL (c)) { result.push_back ('^'); result.push_back (c + 0100); @@ -119,8 +122,6 @@ tui_copy_source_line (const char **ptr, int *length) result.push_back ('?'); ++column; } - else if (c == '\t') - process_tab (); else result.push_back (c); } -- 2.17.2