From mboxrd@z Thu Jan 1 00:00:00 1970 From: Elena Zannoni To: Eli Zaretskii Cc: ezannoni@cygnus.com, gdb-patches@sources.redhat.com Subject: Re: [RFA] Improve completion of locations Date: Mon, 14 May 2001 13:39:00 -0000 Message-id: <15104.17012.924972.590369@kwikemart.cygnus.com> References: <15096.22514.59476.717438@kwikemart.cygnus.com> <15100.47474.452149.693985@kwikemart.cygnus.com> <2950-Sat12May2001090418+0300-eliz@is.elta.co.il> X-SW-Source: 2001-05/msg00309.html Eli Zaretskii writes: > > From: Elena Zannoni > > Date: Sat, 12 May 2001 00:17:54 -0400 > > > > I was wondering how readline would get this right in case of > > completion on filenames. I had a closer look, and also in that case it > > gets it wrong. '.' is a word-break character, but not a filename-break > > character. The first time rl_complete() is invoked by pressing TAB, > > readline has the set of work-break characters installed. So it ends up > > calling line_completion_function() with an empty string, just like > > above. But line completion function switches the set of break chars > > from under readline's nose, installing the file-break ones, and > > basically redoing what readline got wrong before. So later on, gdb > > will try to complete on 'symtab.' and get it right. Fascinating. > > Indeed. What this means is the the M-TAB completion, which doesn't > get the second chance, sometimes gets its act wrong. This problem was > there since day one. Ah. Not nice. > > > BTW, I was playing with an older gdb, and a TAB after 'symtab.' > > wasn't doing anything. Somehow the behavior has changed in the last > > year. > > What version of GDB was that? I tried all the way down to 4.18, and > it still offers all the possible symbols given "symtab.". It > just that older versions take about forever to grind through all the > symbols, so you might think GDB is just sitting there idling. Dan's > patch about a month ago made that code much, much faster. > It was an internal version, so it may have been different. > > > I'd be glad to make this more smart, but it's not simple. By far the > > > nastiest problem is that Readline decides what is the word which is > > > being completed on _before_ our completion function is called. This > > > defeats many nifty tricks we could do using the context of the > > > completion. > > > > Yes. If we could decide what set of break characters to install before the > > tab is hit, it would be already a step in the right direction. > > Or make readline's find_completion_word() a hook for a gdb function. > > Something like that. Readline must cooperate with GDB better, for our > completion to be less error prone. Right now, Readline does not > support the kind of mode that GDB needs, where it completes on > different types of objects and therefore needs to change the > word-constituent characters. Bash completes only on file names, so it > never needs these complications. > > I think we need to ask Readline maintainers to add a couple of > features in the next releases. > Definitely. > > Anyway, now that I've looked stuff over more in detail, I think this > > can go in. (With the fix for the ':'). But Fernando is the > > completer.c maintainer, so we must give him a chance to go over the > > patch as well. > > Yes, I'm waiting for Fernando's approval. > Elena