public inbox for frysk-cvs@sourceware.org help / color / mirror / Atom feed
From: cagney@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Fix completion of: alias <TAB> Date: Fri, 09 Nov 2007 17:54:00 -0000 [thread overview] Message-ID: <20071109175445.21759.qmail@sourceware.org> (raw) The branch, master has been updated via 1e79ab9a46d499104cc07e265842e5b075a90a3b (commit) from 685835609bb5c145000f0dd69785b781672e7a36 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 1e79ab9a46d499104cc07e265842e5b075a90a3b Author: Andrew Cagney <cagney@redhat.com> Date: Fri Nov 9 12:53:08 2007 -0500 Fix completion of: alias <TAB> frysk-core/frysk/hpd/ChangeLog 2007-11-09 Andrew Cagney <cagney@redhat.com> * MultiLevelCommand.java: Handle null tokens. * ParameterizedCommand.java: Ditto. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/hpd/ChangeLog | 3 +++ frysk-core/frysk/hpd/MultiLevelCommand.java | 13 +++++++------ frysk-core/frysk/hpd/ParameterizedCommand.java | 6 +++++- 3 files changed, 15 insertions(+), 7 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog index 2d0e721..d03ce52 100644 --- a/frysk-core/frysk/hpd/ChangeLog +++ b/frysk-core/frysk/hpd/ChangeLog @@ -1,5 +1,8 @@ 2007-11-09 Andrew Cagney <cagney@redhat.com> + * MultiLevelCommand.java: Handle null tokens. + * ParameterizedCommand.java: Ditto. + * Input.java: Eliminate the sentinel. (remove(int)): Delete. (removeFirst()): New. diff --git a/frysk-core/frysk/hpd/MultiLevelCommand.java b/frysk-core/frysk/hpd/MultiLevelCommand.java index cd13717..793dcc2 100644 --- a/frysk-core/frysk/hpd/MultiLevelCommand.java +++ b/frysk-core/frysk/hpd/MultiLevelCommand.java @@ -123,14 +123,14 @@ public abstract class MultiLevelCommand extends Command { Input.Token incomplete = input.token(0); // The cursor is past this token. Find this level's // sub-command and pass the completion problem on to it. - if (incomplete.value != null && cursor > incomplete.end) { + if (incomplete != null && cursor > incomplete.end) { Command subCommand = (Command)subCommands.get(incomplete.value); if (subCommand == null) return -1; // give up return subCommand.complete(cli, input.accept(), cursor, candidates); } - if (incomplete.value == null) + if (incomplete == null) candidates.addAll(subCommands.keySet()); else { for (Iterator i = subCommands.keySet().iterator(); i.hasNext(); ) { @@ -141,9 +141,10 @@ public abstract class MultiLevelCommand extends Command { } // If there's only one token, append a trailing blank so that // things are ready for the next token. - if (candidates.size() == 1) { - candidates.set(0, ((String)candidates.get(0)) + " "); - } - return incomplete.start; + CompletionFactory.padSingleCandidate(candidates); + if (incomplete == null) + return cursor; + else + return incomplete.start; } } diff --git a/frysk-core/frysk/hpd/ParameterizedCommand.java b/frysk-core/frysk/hpd/ParameterizedCommand.java index b598809..558e367 100644 --- a/frysk-core/frysk/hpd/ParameterizedCommand.java +++ b/frysk-core/frysk/hpd/ParameterizedCommand.java @@ -174,7 +174,11 @@ abstract class ParameterizedCommand extends Command { * Complete the input. */ final int complete(CLI cli, Input input, int cursor, List candidates) { - int start = input.token(0).start; + int start; + if (input.size() == 0) + start = cursor; + else + start = input.token(0).start; int pos = complete(cli, cli.getCommandPTSet(input), input.stringValue(), cursor - start, candidates); if (pos >= 0) { hooks/post-receive -- frysk system monitor/debugger
reply other threads:[~2007-11-09 17:54 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20071109175445.21759.qmail@sourceware.org \ --to=cagney@sourceware.org \ --cc=frysk-cvs@sourceware.org \ --cc=frysk@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: linkBe 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; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).