From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25002 invoked by alias); 18 Jan 2004 22:49:31 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 24848 invoked from network); 18 Jan 2004 22:49:29 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sources.redhat.com with SMTP; 18 Jan 2004 22:49:29 -0000 Received: from drow by nevyn.them.org with local (Exim 4.30 #1 (Debian)) id 1AiLjV-0002BO-3G; Sun, 18 Jan 2004 17:49:29 -0500 Date: Sun, 18 Jan 2004 22:49:00 -0000 From: Daniel Jacobowitz To: bug-readline@gnu.org Cc: gdb@sources.redhat.com Subject: Difficulty with the readline completion interface in GDB Message-ID: <20040118224929.GA8226@nevyn.them.org> Mail-Followup-To: bug-readline@gnu.org, gdb@sources.redhat.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.1i X-SW-Source: 2004-01/txt/msg00222.txt.bz2 Hi Chet, I've spent this morning trying to fix a long-standing bug in GDB's tab completion. I think it's unsolvable with the current readline interface, so I'd like your suggestions on how to improve the situation. The gist of the problem is that different parts of the command line have different word break characters. For example, '/' is a word break character after a command or a symbol, but not after a directory name. There's no way to explain this to Readline. Right now, we do a lot of fudging rl_completer_word_break_chars, but it's never quite in time. As a result, we get this chain of events: - rl_completer_word_break_chars contains '/' and '.' - The user enters "file ./gdb.base" - GDB's complete_line is called from rl_complete. The text parameter is "base", because . was treated as a word separator. - We return, and readline stats the file to figure out whether to add a slash after it. It stats "base", having lost the "./gdb.". Stat fails. - A space is inserted instead of the slash (gdb.base is a directory). There's a lot of possible solutions. There could be a hook called before rl_complete generates the matches list, which could fudge the complete characters - most direct solution, not very elegant. A function could be called to get the list of complete characters, which would then be sensitive to rl_point - not sure what other issues this could cause. The filename completion code could search backwards according to the list of filename wordbreak characters; this would solve the specific problem but not the more general one. Probably there are others. What do you think? -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer