From: Keith Seitz <keiths@redhat.com>
To: Doug Evans <dje@google.com>
Cc: "gdb-patches@sourceware.org ml" <gdb-patches@sourceware.org>
Subject: Re: [RFC] Cleanup for make_source_files_completion_list
Date: Mon, 13 May 2013 18:42:00 -0000 [thread overview]
Message-ID: <5191340B.60100@redhat.com> (raw)
In-Reply-To: <CADPb22Sj_5Bp+FhoQYk_9vR5c1D3fXsw4gLFu7v+jmDNSaOPFg@mail.gmail.com>
On 05/09/2013 04:45 PM, Doug Evans wrote:
> The caller of make_source_files_completion_list explains the decision
> to pass "text" for "word" here:
>
> /* If we only have file names as possible completion, we should
> bring them in sync with what rl_complete expects. The
> problem is that if the user types "break /foo/b TAB", and the
> possible completions are "/foo/bar" and "/foo/baz"
> rl_complete expects us to return "bar" and "baz", without the
> leading directories, as possible completions, because `word'
> starts at the "b". But we ignore the value of `word' when we
> call make_source_files_completion_list above (because that
> would not DTRT when the completion results in both symbols
> and file names), so make_source_files_completion_list returns
> the full "/foo/bar" and "/foo/baz" strings. This produces
> wrong results when, e.g., there's only one possible
> completion, because rl_complete will prepend "/foo/" to each
> candidate completion. The loop below removes that leading
> part. */
>
> Note that if you remove "word" from make_source_files_completion_list
> then add_filename_to_list collapses to a trivial function (which would
> otherwise be great except there's basic core functionality that I
> think should be kept). :-)
Indeed. I looked into this a bit further after Tom's comments, too. As
it is, I am convinced that this patch should not be accepted. [aka, Tom
is right -- those callers of make_source_files_completion_list which
pass text twice are suspicious.]
However, I think that the comment quoted above (and the surrounding
block of code which does the copying) should be removed and the callers
of make_source_files_completion list should pass text AND word instead
of text and text. add_filename_to_list (in symtab.c) does this text -
word adjustment already, so it is not necessary to repeat it here. WDYT?
> OTOH the "text" arg to completion_list_add_name can go, it's unused.
I'll take a look at that, too, while I'm at it. That didn't come up
during my completer implementation, so it escaped scrutiny.
Keith
next prev parent reply other threads:[~2013-05-13 18:42 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-07 19:46 Keith Seitz
2013-05-09 20:58 ` Tom Tromey
2013-05-09 23:45 ` Doug Evans
2013-05-13 18:42 ` Keith Seitz [this message]
2013-05-13 21:11 ` Keith Seitz
2013-05-15 17:36 ` Keith Seitz
2013-05-15 19:32 ` [RFA] completer test [was Re: [RFC] Cleanup for make_source_files_completion_list] Keith Seitz
2013-05-15 20:01 ` Tom Tromey
2013-05-15 21:22 ` Keith Seitz
2013-05-15 22:33 ` Sergio Durigan Junior
2013-05-15 23:47 ` Keith Seitz
2013-05-16 0:21 ` Sergio Durigan Junior
2013-05-16 0:27 ` Stan Shebs
2013-05-16 9:38 ` Pedro Alves
2013-05-16 5:30 ` Joel Brobecker
2013-05-16 5:49 ` Joel Brobecker
2013-05-16 15:41 ` Keith Seitz
2013-05-17 5:14 ` Joel Brobecker
2013-05-17 16:27 ` Tom Tromey
2013-05-20 5:28 ` Joel Brobecker
2013-05-20 14:47 ` Tom Tromey
2013-05-21 5:43 ` Checked in: " Joel Brobecker
2013-05-21 5:44 ` Joel Brobecker
2013-05-16 5:53 ` Sergio Durigan Junior
2013-05-16 6:00 ` Joel Brobecker
2013-05-16 9:19 ` Pedro Alves
2013-05-16 9:26 ` Joel Brobecker
2013-05-16 10:18 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5191340B.60100@redhat.com \
--to=keiths@redhat.com \
--cc=dje@google.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox