From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2942 invoked by alias); 24 Jan 2015 21:27:41 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 2925 invoked by uid 89); 24 Jan 2015 21:27:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f51.google.com Received: from mail-pa0-f51.google.com (HELO mail-pa0-f51.google.com) (209.85.220.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 24 Jan 2015 21:27:37 +0000 Received: by mail-pa0-f51.google.com with SMTP id fb1so4063346pad.10 for ; Sat, 24 Jan 2015 13:27:35 -0800 (PST) X-Received: by 10.68.194.170 with SMTP id hx10mr22226461pbc.135.1422134855741; Sat, 24 Jan 2015 13:27:35 -0800 (PST) Received: from seba.sebabeach.org.gmail.com (173-13-178-53-sfba.hfc.comcastbusiness.net. [173.13.178.53]) by mx.google.com with ESMTPSA id c17sm5675499pdl.6.2015.01.24.13.27.33 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Jan 2015 13:27:34 -0800 (PST) From: Doug Evans To: Eli Zaretskii Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] TUI: Expand TABs into spaces References: <83k3149k5b.fsf@gnu.org> <837fwn2cvc.fsf@gnu.org> <83a918s6k5.fsf@gnu.org> Date: Sun, 25 Jan 2015 11:31:00 -0000 In-Reply-To: <83a918s6k5.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 24 Jan 2015 14:32:10 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2015-01/txt/msg00674.txt.bz2 Eli Zaretskii writes: > Ping! Ping! OK to install? "Give me a ping, Vasili. One ping only, please." ref: http://www.imdb.com/title/tt0099810/quotes [just a little light humor] >> Date: Fri, 16 Jan 2015 08:32:15 -0800 >> From: Doug Evans >> Cc: "gdb-patches@sourceware.org" >> >> On Fri, Jan 16, 2015 at 3:17 AM, Eli Zaretskii wrote: >> > Ping! OK to install, master and 7.9 branch? >> > >> >> Date: Sat, 03 Jan 2015 13:30:08 +0200 >> >> From: Eli Zaretskii >> >> >> >> "gdb -tui" relies on the curses library and the underlying terminal >> >> driver to expand TAB characters into spaces. But ncurses on Windows >> >> doesn't do that, and instead displays an IBM graphics character. >> >> >> >> The patches below fix that in the command window and in displaying the >> >> registers. >> >> >> >> OK to commit? >> >> >> >> 2015-01-03 Eli Zaretskii >> >> >> >> * tui/tui-regs.c (tui_register_format): Expand TABs into the >> >> appropriate number of spaces. >> >> >> >> * tui/tui-io.c (tui_puts, tui_redisplay_readline): Expand TABs >> >> into the appropriate number of spaces. >> >> I'd have to read the patch more to say it's ok, >> but one thing that is missing are comments >> explaining *why* we are expanding tabs into spaces. I check the code (tui-source.c around line 185) and it has this: else { /* Store the charcter in the line buffer. If it is a tab, then translate to the correct number of chars so we don't overwrite our buffer. */ So it *does* have a comment explaining why tabs are being expanded. For tui_puts and tui_redisplay_readline let's add something like the following: /* Windows ncurses doesn't expand tabs, so we have to do that here. */ [else] if (c == '\t') For tui_register_format it used to be such a straightforward function, it's a shame to grow it by 2x for bitfiddly tab handling. Let's add a helper routine that takes one string and returns another with tabs expanded, and put this helper routine in, say tui-io.c (this routine isn't tui-regs specific), and then call that routine from tui_register_format. I didn't review the actual code to do the tab expansion with a microscope. I'm going to assume it at least mostly works. At least it'll be tucked away. Also, a note on the ChangeLog: No blank lines between related entries. > * tui/tui-regs.c (tui_register_format): Expand TABs into the > appropriate number of spaces. > > * tui/tui-io.c (tui_puts, tui_redisplay_readline): Expand TABs > into the appropriate number of spaces.